[webkit-changes] [WebKit/WebKit] 7149a1: [Cocoa] MSE video playback disappears after system...

Jer Noble noreply at github.com
Thu Sep 21 16:29:23 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7149a1fcc02e960cb426c91a9aa5a1a391ed7d8a
      https://github.com/WebKit/WebKit/commit/7149a1fcc02e960cb426c91a9aa5a1a391ed7d8a
  Author: Jer Noble <jer.noble at apple.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h
    M Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm
    M Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm

  Log Message:
  -----------
  [Cocoa] MSE video playback disappears after system interruption until pause/play
https://bugs.webkit.org/show_bug.cgi?id=261834
rdar://113647070

Reviewed by Tim Horton and Dean Jackson.

On some Cocoa platforms, the system will interrupt AVSampleBufferDisplayLayer rendering
when the process is backgrounded until a flush operation. This is detectable on iOS through
a specific error code, but API has been added for this purpose as well. Detect this state
and, when the page again becomes visible, flush visible AVSBDLs and re-enqueue with video
samples.

Flushing the display layer has the paradoxical effect of pausing playback, as a display
layer without a decoded sample will usually prevent playback from starting. In the case
where we are re-enqueuing due to visibility change, note the reason for the flush in the
MediaPlayerPrivate and do not pause playback in that case.

* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPageIsVisible):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldBePlaying const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::effectiveRateChanged):
* Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::flushActiveSourceBuffersIfNeeded):
* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(-[WebAVSampleBufferErrorListener beginObservingLayer:]):
(-[WebAVSampleBufferErrorListener layerRequiresFlushToResumeDecodingChanged:]):
(WebCore::SourceBufferPrivateAVFObjC::flushIfNeeded):
(WebCore::SourceBufferPrivateAVFObjC::layerRequiresFlushToResumeDecodingChanged):
(WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):

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




More information about the webkit-changes mailing list