Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 895987c5c5acc58caebdd74f48618bba50f8d2b0
      
https://github.com/WebKit/WebKit/commit/895987c5c5acc58caebdd74f48618bba50f8d2b0
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2025-02-06 (Thu, 06 Feb 2025)

  Changed paths:
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/platform/cocoa/EffectiveRateChangedListener.h
    A Source/WebCore/platform/cocoa/EffectiveRateChangedListener.mm
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm
    M Source/WebCore/platform/mac/WebPlaybackControlsManager.mm

  Log Message:
  -----------
  YouTube.com: Only Audio Resumes after Pause, Video remains still
https://bugs.webkit.org/show_bug.cgi?id=287123
rdar://144274075

Reviewed by Youenn Fablet.

When the timebase's rate change from 0 to 1 (or vice versa) we can observe
that sometimes the currentTime moves slightly either backward or forward.

The VideoMediaSampleRenderer sets a timer to fire at the time the next
available video frame should be displayed.
When the timebase's rate change and the time moved forward slightly, the
timer doesn't fire.
This prevented from the next video frame to be painted and another timer to
be set for the next frame making the media playing only with audio and the
last painted video frame showing forever.

To get around this, we now observe the timebase rate change and when it
changes from 0, re-schedule a purge&display cycle.
Code to observe the timebase's rate change is extracted from 
MediaPlayerPrivateMediaSourceAVFObjC
into its own separate EffectiveRateChangedListener class.

Manually tested. Automated testing is difficult as the typical way to check
that the video frames are regularly changing would be to paint them into a 
canvas.
However, painting into a canvas forcibly refresh the video frame showing.
Video frames can also be dropped if they are late, which can easily happen
on a busy host, making a reftest results inconsistent.

* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/cocoa/EffectiveRateChangedListener.h: Added. Code was 
extracted from MediaPlayerPrivateMediaSourceAVFObjC
* Source/WebCore/platform/cocoa/EffectiveRateChangedListener.mm: Added.
(-[WebEffectiveRateChangedListenerObjCAdapter 
initWithEffectiveRateChangedListener:]):
(-[WebEffectiveRateChangedListenerObjCAdapter protectedListener]):
(WebCore::timebaseEffectiveRateChangedCallback):
(WebCore::EffectiveRateChangedListener::EffectiveRateChangedListener):
(WebCore::EffectiveRateChangedListener::~EffectiveRateChangedListener):
(WebCore::EffectiveRateChangedListener::effectiveRateChanged):
(WebCore::EffectiveRateChangedListener::stop):
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
 Shuffle headers around to fix unified build.
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
(-[WebEffectiveRateChangedListenerObjCAdapter 
initWithEffectiveRateChangedListener:]): Deleted.
(-[WebEffectiveRateChangedListenerObjCAdapter protectedListener]): Deleted.
(WebCore::EffectiveRateChangedListener::create): Deleted.
(WebCore::EffectiveRateChangedListener::effectiveRateChanged): Deleted.
(WebCore::timebaseEffectiveRateChangedCallback): Deleted.
(WebCore::EffectiveRateChangedListener::stop): Deleted.
(WebCore::EffectiveRateChangedListener::EffectiveRateChangedListener): Deleted.
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h:
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm:
(WebCore::VideoMediaSampleRenderer::setTimebase):
(WebCore::VideoMediaSampleRenderer::clearTimebase):
* Source/WebCore/platform/mac/WebPlaybackControlsManager.mm:

Canonical link: https://commits.webkit.org/289922@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to