[webkit-changes] [WebKit/WebKit] e1d76f: readyState may not move from HAVE_METADATA followi...

Jean-Yves Avenard noreply at github.com
Wed Mar 22 02:07:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e1d76fd08756b9610c3a8340ee4f4eaabcc91707
      https://github.com/WebKit/WebKit/commit/e1d76fd08756b9610c3a8340ee4f4eaabcc91707
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2023-03-22 (Wed, 22 Mar 2023)

  Changed paths:
    M LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-audio-only-expected.txt
    M LayoutTests/media/media-source/media-source-allowed-codecs-expected.txt
    M LayoutTests/media/media-source/media-source-allowed-codecs.html
    M LayoutTests/media/media-source/media-source-monitor-playing-event-expected.txt
    M Source/WebCore/Modules/mediasource/ManagedMediaSource.cpp
    M Source/WebCore/Modules/mediasource/MediaSource.cpp
    M Source/WebCore/Modules/mediasource/MediaSource.h
    M Source/WebCore/Modules/mediasource/SourceBuffer.cpp
    M Source/WebCore/Modules/mediasource/SourceBuffer.h
    M Source/WebCore/platform/graphics/MediaSourcePrivate.h
    M Source/WebCore/platform/graphics/MediaSourcePrivateClient.h
    M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
    M Source/WebCore/platform/graphics/SourceBufferPrivate.h
    M Source/WebCore/platform/graphics/SourceBufferPrivateClient.h
    M Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.h
    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:
  -----------
  readyState may not move from HAVE_METADATA following a seek.
https://bugs.webkit.org/show_bug.cgi?id=254136
rdar://problem/106914173

Reviewed by Youenn Fablet.

Seen with LayoutTests/media/media-source/media-source-end-of-stream-buffered.html
when running in the GPU process.
When we seeked to the end of the video while the MediaSource is still in
open state, the readyState moved to HAVE_METADATA.
Once MediaSource.endOfStream() was called the readyState should be moved
to HAVE_CURRENT_DATA (https://html.spec.whatwg.org/multipage/media.html#dom-media-have_current_data)
However, we didn't update the readyState under those circumstances.
As such if play() was called, the waiting event would fire instead of play()

We partially have to revert webkit.org/b/253560 as in this change we
only re-calculated the buffered when queried.
We need to do so whenever the MediaSource's buffered attribute change
(such as when the MediaSource's readyState has changed) and for running
the SourceBuffer monitoring algorithm which will in turn update the
HTMLMediaElement's readyState accordingly.

Additionally, similar to bug 252886 (durationchanged to be fired befure updateend)
per spec https://w3c.github.io/media-source/#sourcebuffer-coded-frame-processing
step 4, we have "If the HTMLMediaElement.readyState attribute is
HAVE_CURRENT_DATA and the new coded frames cause HTMLMediaElement.buffered
to have a TimeRanges that includes the current playback position and some
time beyond the current playback position, then set the HTMLMediaElement
readyState attribute to HAVE_FUTURE_DATA."
This step is to happen before we end the coded frame processing algorithm
and we complete the appendBuffer() operation and fire `updateend` event.
As such, we make `sourceBufferPrivateBufferedChanged()` asynchronous so
that we resume the AppendComplete operation only after we have modified
the buffered range and processed the readyState change.
This change is required as the order of events changed with WK1 and to
keep test expectations we need to also update the behaviour for when the
GPU process is active.

We update some test expectations accordingly as events related to the readyState
changed will be fired before `updateend`, in particular events such as
`canplay` or `canplaythrough`.

LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-audio-only-expected.txt
LayoutTests/media/media-source/media-source-monitor-playing-event-expected.txt

* LayoutTests/http/tests/media/fairplay/fps-mse-unmuxed-audio-only-expected.txt:
* LayoutTests/media/media-source/media-source-allowed-codecs-expected.txt: mp4v is an invalid codec and reported as such in recent CoreMedia framework.
* LayoutTests/media/media-source/media-source-allowed-codecs.html:
* LayoutTests/media/media-source/media-source-monitor-playing-event-expected.txt:
* Source/WebCore/Modules/mediasource/ManagedMediaSource.cpp:
(WebCore::ManagedMediaSource::isBuffered const):
* Source/WebCore/Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource):
(WebCore::MediaSource::buffered const):
(WebCore::MediaSource::onReadyStateChange):
(WebCore::MediaSource::sourceBufferBufferedChanged):
(WebCore::MediaSource::updateBufferedIfNeeded):
(WebCore::MediaSource::buffered): Deleted.
* Source/WebCore/Modules/mediasource/MediaSource.h:
* Source/WebCore/Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateBufferedChanged):
(WebCore::SourceBuffer::setBufferedDirty):
* Source/WebCore/Modules/mediasource/SourceBuffer.h:
* Source/WebCore/platform/graphics/MediaSourcePrivate.h:
(WebCore::MediaSourcePrivate::bufferedChanged):
* Source/WebCore/platform/graphics/MediaSourcePrivateClient.h:
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::setBufferedRanges):
(WebCore::SourceBufferPrivate::appendCompleted):
* Source/WebCore/platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::setBufferedRanges):
* Source/WebCore/platform/graphics/SourceBufferPrivateClient.h:
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.cpp:
(WebKit::RemoteMediaSourceProxy::buffered const):
(WebKit::RemoteMediaSourceProxy::buffered): Deleted.
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.h:
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedChanged):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateAppendComplete):
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateAppendComplete):
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateBufferedChanged):
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:

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




More information about the webkit-changes mailing list