Title: [282374] trunk/Source/WebCore
- Revision
- 282374
- Author
- [email protected]
- Date
- 2021-09-13 18:17:25 -0700 (Mon, 13 Sep 2021)
Log Message
Playback stops although the progress bar moves
https://bugs.webkit.org/show_bug.cgi?id=230210
rdar://81123838
Reviewed by Eric Carlson.
When playback has stalled due to insufficient data being buffered, the effective rate
should be 0 as time is no longer progressing.
While the GPU process would indicate that the rate has changed once the player has
stalled, the effective rate reported would remain the same causing the current time
position to continue moving as it's estimated based on the effective rate.
This is also workaround rdar://83048005 which can report that the buffer is both
full and empty at the same time.
Fly-By fix: set the new rate in HTMLMediaElement if previously the requested rate
is different.
The buffering is handled by the AVPlayer and is dependent on network conditions making
it difficult to test.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updatePlaybackRate):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatus const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::effectiveRate const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (282373 => 282374)
--- trunk/Source/WebCore/ChangeLog 2021-09-14 00:18:36 UTC (rev 282373)
+++ trunk/Source/WebCore/ChangeLog 2021-09-14 01:17:25 UTC (rev 282374)
@@ -1,3 +1,32 @@
+2021-09-13 Jean-Yves Avenard <[email protected]>
+
+ Playback stops although the progress bar moves
+ https://bugs.webkit.org/show_bug.cgi?id=230210
+ rdar://81123838
+
+ Reviewed by Eric Carlson.
+
+ When playback has stalled due to insufficient data being buffered, the effective rate
+ should be 0 as time is no longer progressing.
+ While the GPU process would indicate that the rate has changed once the player has
+ stalled, the effective rate reported would remain the same causing the current time
+ position to continue moving as it's estimated based on the effective rate.
+ This is also workaround rdar://83048005 which can report that the buffer is both
+ full and empty at the same time.
+
+ Fly-By fix: set the new rate in HTMLMediaElement if previously the requested rate
+ is different.
+
+ The buffering is handled by the AVPlayer and is dependent on network conditions making
+ it difficult to test.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::updatePlaybackRate):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatus const):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::effectiveRate const):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
+
2021-09-13 Wenson Hsieh <[email protected]>
[macOS] -toggleAutomaticSpellingCorrection: menu item validation shouldn't require post-layout editor state
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (282373 => 282374)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2021-09-14 00:18:36 UTC (rev 282373)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2021-09-14 01:17:25 UTC (rev 282374)
@@ -3500,7 +3500,7 @@
void HTMLMediaElement::updatePlaybackRate()
{
double requestedRate = requestedPlaybackRate();
- if (m_player && potentiallyPlaying() && m_player->effectiveRate() != requestedRate)
+ if (m_player && potentiallyPlaying() && m_player->rate() != requestedRate)
m_player->setRate(requestedRate);
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (282373 => 282374)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-09-14 00:18:36 UTC (rev 282373)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-09-14 01:17:25 UTC (rev 282374)
@@ -1229,10 +1229,18 @@
return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusFailed;
if (m_cachedLikelyToKeepUp)
return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackLikelyToKeepUp;
+ // From AVPlayer.h:
+ // AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate
+ // This state is entered when
+ // 1) the playback buffer becomes empty and playback stalls in AVPlayerTimeControlStatusPlaying,
+ // 2) when rate is set from zero to non-zero in AVPlayerTimeControlStatusPaused and insufficient media data has been buffered for playback to occur, or
+ // 3) when the player has no item to play, i.e. when the receiver's currentItem is nil.
+ // In this state, the value of the rate property is not currently effective but instead indicates the rate at which playback will start or resume.
+ // We can't rely on just m_cachedBufferFull and m_cachedBufferEmpty due to rdar://83048005.
+ if (m_cachedTimeControlStatus == AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate || m_cachedBufferEmpty)
+ return MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty;
if (m_cachedBufferFull)
return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackBufferFull;
- if (m_cachedBufferEmpty)
- return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty;
return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusReadyToPlay;
}
@@ -1600,7 +1608,7 @@
if (!metaDataAvailable())
return 0;
- return m_cachedRate;
+ return m_cachedTimeControlStatus == AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate ? 0.0 : m_cachedRate;
}
double MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesLastModifiedTime() const
@@ -3451,6 +3459,7 @@
return;
m_cachedTimeControlStatus = timeControlStatus;
+ updateStates();
rateChanged();
m_wallClockAtCachedCurrentTime = std::nullopt;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes