Changeset 282374 in webkit


Ignore:
Timestamp:
Sep 13, 2021 6:17:25 PM (10 months ago)
Author:
Jean-Yves Avenard
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r282370 r282374  
     12021-09-13  Jean-Yves Avenard  <jya@apple.com>
     2
     3        Playback stops although the progress bar moves
     4        https://bugs.webkit.org/show_bug.cgi?id=230210
     5        rdar://81123838
     6
     7        Reviewed by Eric Carlson.
     8
     9        When playback has stalled due to insufficient data being buffered, the effective rate
     10        should be 0 as time is no longer progressing.
     11        While the GPU process would indicate that the rate has changed once the player has
     12        stalled, the effective rate reported would remain the same causing the current time
     13        position to continue moving as it's estimated based on the effective rate.
     14        This is also workaround rdar://83048005 which can report that the buffer is both
     15        full and empty at the same time.
     16
     17        Fly-By fix: set the new rate in HTMLMediaElement if previously the requested rate
     18        is different.
     19
     20        The buffering is handled by the AVPlayer and is dependent on network conditions making
     21        it difficult to test.
     22
     23        * html/HTMLMediaElement.cpp:
     24        (WebCore::HTMLMediaElement::updatePlaybackRate):
     25        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     26        (WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatus const):
     27        (WebCore::MediaPlayerPrivateAVFoundationObjC::effectiveRate const):
     28        (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
     29
    1302021-09-13  Wenson Hsieh  <wenson_hsieh@apple.com>
    231
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r282220 r282374  
    35013501{
    35023502    double requestedRate = requestedPlaybackRate();
    3503     if (m_player && potentiallyPlaying() && m_player->effectiveRate() != requestedRate)
     3503    if (m_player && potentiallyPlaying() && m_player->rate() != requestedRate)
    35043504        m_player->setRate(requestedRate);
    35053505}
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r282242 r282374  
    12301230    if (m_cachedLikelyToKeepUp)
    12311231        return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackLikelyToKeepUp;
     1232    // From AVPlayer.h:
     1233    // AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate
     1234    // This state is entered when
     1235    // 1) the playback buffer becomes empty and playback stalls in AVPlayerTimeControlStatusPlaying,
     1236    // 2) when rate is set from zero to non-zero in AVPlayerTimeControlStatusPaused and insufficient media data has been buffered for playback to occur, or
     1237    // 3) when the player has no item to play, i.e. when the receiver's currentItem is nil.
     1238    // 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.
     1239    // We can't rely on just m_cachedBufferFull and m_cachedBufferEmpty due to rdar://83048005.
     1240    if (m_cachedTimeControlStatus == AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate || m_cachedBufferEmpty)
     1241        return MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty;
    12321242    if (m_cachedBufferFull)
    12331243        return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackBufferFull;
    1234     if (m_cachedBufferEmpty)
    1235         return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusPlaybackBufferEmpty;
    12361244
    12371245    return MediaPlayerPrivateAVFoundation::MediaPlayerAVPlayerItemStatusReadyToPlay;
     
    16011609        return 0;
    16021610
    1603     return m_cachedRate;
     1611    return m_cachedTimeControlStatus == AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate ? 0.0 : m_cachedRate;
    16041612}
    16051613
     
    34523460
    34533461    m_cachedTimeControlStatus = timeControlStatus;
     3462    updateStates();
    34543463    rateChanged();
    34553464    m_wallClockAtCachedCurrentTime = std::nullopt;
Note: See TracChangeset for help on using the changeset viewer.