Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 04a684748a691cdd03e751013f722e7c180566a1
      
https://github.com/WebKit/WebKit/commit/04a684748a691cdd03e751013f722e7c180566a1
  Author: Jean-Yves Avenard <j...@apple.com>
  Date:   2023-03-01 (Wed, 01 Mar 2023)

  Changed paths:
    A 
LayoutTests/media/media-source/media-source-appendbuffer-durationchange-expected.txt
    A 
LayoutTests/media/media-source/media-source-appendbuffer-durationchange.html
    M Source/WebCore/Modules/mediasource/SourceBuffer.cpp
    M Source/WebCore/Modules/mediasource/SourceBuffer.h
    M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
    M Source/WebCore/platform/graphics/SourceBufferPrivate.h
    M Source/WebCore/platform/graphics/SourceBufferPrivateClient.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp
    M 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
    M 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
    M Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp
    M Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h
    M Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp
    M Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h
    M Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in

  Log Message:
  -----------
  [MSE] Only fire durationchange after parsing media buffer.
https://bugs.webkit.org/show_bug.cgi?id=252886
rdar://105870526

Reviewed by Youenn Fablet and Jer Noble.

Per spec MSE spec and the Coded Frame Processing algorithm [1]
"5. if the media segment contains data beyond the current duration, then
run the duration change algorithm with new duration set to the maximum of
the current duration and the [[group end timestamp]]."

Which occurs once all frames of a media segment added to a source buffer have 
been processed.
We were running step 5. after each frame parsed.

Only perform step 5. once we have parsed the entire buffer.
Note: Per spec, we should be firing a durationchange event after parsing
each individual media segment.
However, our data parsing infrastucture doesn't provide such level of details
and we can only parse the entire buffer (potentially made of multiple media 
segments)
at once, so we only fire a single durationchange in all cases.
However, this behaviour is preferable to firing hundreds of events 
unnecessarily.

The handling of a `durationchange` must occur before the `updateend` is
fired, so we make the method sourceBufferPrivateDurationChanged asynchronous
and continue the process once the it completes.

[1] https://w3c.github.io/media-source/#sourcebuffer-coded-frame-processing

* 
LayoutTests/media/media-source/media-source-appendbuffer-durationchange-expected.txt:
 Added.
* LayoutTests/media/media-source/media-source-appendbuffer-durationchange.html: 
Added.
* Source/WebCore/Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDurationChanged):
* Source/WebCore/Modules/mediasource/SourceBuffer.h:
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::appendCompleted): Must be called once all 
samples have been processed.
(WebCore::SourceBufferPrivate::didReceiveSample):
* Source/WebCore/platform/graphics/SourceBufferPrivate.h:
* Source/WebCore/platform/graphics/SourceBufferPrivateClient.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
* Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::consumeAppsinksAvailableSamples):
* 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged): Remove handling of 
longer needed blockDurationChanges/unblockDurationChanges
(WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges): Deleted.
(WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges): Deleted.
* 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
* Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp:
(WebCore::MockSourceBufferPrivate::append): Call appendCompleted.
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged):
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateDurationChanged):
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to