[webkit-changes] [WebKit/WebKit] dab283: [ManagedMSE] onbufferedchange fired too many times...

Jean-Yves Avenard noreply at github.com
Wed May 24 01:20:00 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dab28312bc80bc475196b7d6221b060347254e33
      https://github.com/WebKit/WebKit/commit/dab28312bc80bc475196b7d6221b060347254e33
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2023-05-24 (Wed, 24 May 2023)

  Changed paths:
    M LayoutTests/media/media-source/media-managedmse-bufferedchange-expected.txt
    M LayoutTests/media/media-source/media-managedmse-bufferedchange.html
    M Source/WebCore/Modules/mediasource/SourceBuffer.cpp
    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/RemoteSourceBufferProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h
    M Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in
    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:
  -----------
  [ManagedMSE] onbufferedchange fired too many times if GPU process isn't in use.
https://bugs.webkit.org/show_bug.cgi?id=257057
rdar://problem/109586019

Reviewed by Youenn Fablet.

In bug 253560, changes were made so that we correctly re-calculated the
buffered range and notify of the changes back to the SourcebufferPrivateClient.
However it left an issue open: the SourceBufferPrivateClient would be notified
twice whenever the buffered attribute changed.
When running in the GPU process, this wasn't a problem as the RemoteSourceBufferProxy
would then only send a single message to the content process, and so the
event was only fired once.
But in WK1, both would lead the `bufferedchanged` event to be fired, and
the test in place only ensured that it was fired, not how many times.
We remove the redundant call to `sourceBufferPrivateBufferedChanged`.

Fly-by fix: The SourceBuffer once closed would notify the SourceBufferPrivate
that it should recalculate the buffered range to execute step 6.2.2.4.2
(https://w3c.github.io/media-source/#htmlmediaelement-extensions-buffered)
which is a synchronous process.
This caused the need for UpdateBufferedFromTrackBuffers IPC message to be
synchronous as well as it required access to the SourceBuffer's track buffers
living in the GPU process.
To get around this, we add a new IPC method that allows the CP's SourceBufferPrivateRemote
to cache its own copy of all the track buffers ranges. So that when the SourceBuffer
gets ended, we can immediately locally calculate the new buffered range
without the need to query the GPU process and the sync call can be removed.
The track buffers' ranges are updated in the CP's SourceBufferPrivateRemote
when:
- during the prepare append algorithm
- after an append operation
- after a remove operation
- if ManagedSourceBuffer, after a memory pressure signal.

There is now only one SourceBufferPrivate synchronous IPC method left: EvictCodedFrames.

* LayoutTests/media/media-source/media-managedmse-bufferedchange-expected.txt:
* LayoutTests/media/media-source/media-managedmse-bufferedchange.html: log whenever
the bufferedchange event is called.
* Source/WebCore/Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::readyStateChanged):
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::trackBuffersRanges const):
(WebCore::SourceBufferPrivate::clientReadyStateChanged):
(WebCore::SourceBufferPrivate::updateBufferedFromTrackBuffers):
(WebCore::SourceBufferPrivate::processAppendCompletedOperation):
(WebCore::SourceBufferPrivate::clearTrackBuffers):
(WebCore::SourceBufferPrivate::removeCodedFrames):
* Source/WebCore/platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::setShouldGenerateTimestamps):
(WebCore::SourceBufferPrivate::updateBufferedFromTrackBuffers):
* Source/WebCore/platform/graphics/SourceBufferPrivateClient.h:
(WebCore::SourceBufferPrivateClient::sourceBufferPrivateTrackBuffersChanged):
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateTrackBuffersChanged):
(WebKit::RemoteSourceBufferProxy::clientReadyStateChanged):
(WebKit::RemoteSourceBufferProxy::updateBufferedFromTrackBuffers): Deleted.
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h:
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::clientReadyStateChanged):
(WebKit::SourceBufferPrivateRemote::sourceBufferPrivateTrackBuffersChanged):
(WebKit::SourceBufferPrivateRemote::updateBufferedFromTrackBuffers): Deleted.
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h:
* Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.messages.in:

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




More information about the webkit-changes mailing list