Title: [271178] trunk
Revision
271178
Author
[email protected]
Date
2021-01-05 15:02:40 -0800 (Tue, 05 Jan 2021)

Log Message

[Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
https://bugs.webkit.org/show_bug.cgi?id=220334

Reviewed by Eric Carlson.

Source/WebCore:

Add a completion handler parameter to SourceBufferPrivate::removeCodedFrames(),
and the caller (SourceBuffer) will fire `update` and `updateend` events when
the completion handler is called.

No new tests. Fix failures of the following tests:
- imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html
- imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
- imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::removeTimerFired):
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::removeCodedFrames):
* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::removeCodedFrames):

Source/WebKit:

Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement
SourceBufferPrivateRemote::removeCodedFrames().

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::removeCodedFrames):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::removeCodedFrames):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:

LayoutTests:

* gpu-process/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271177 => 271178)


--- trunk/LayoutTests/ChangeLog	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/LayoutTests/ChangeLog	2021-01-05 23:02:40 UTC (rev 271178)
@@ -1,3 +1,12 @@
+2021-01-05  Peng Liu  <[email protected]>
+
+        [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
+        https://bugs.webkit.org/show_bug.cgi?id=220334
+
+        Reviewed by Eric Carlson.
+
+        * gpu-process/TestExpectations:
+
 2021-01-05  Chris Fleizach  <[email protected]>
 
         AX: aria-orientation is ignored on input[type="range"]

Modified: trunk/LayoutTests/gpu-process/TestExpectations (271177 => 271178)


--- trunk/LayoutTests/gpu-process/TestExpectations	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/LayoutTests/gpu-process/TestExpectations	2021-01-05 23:02:40 UTC (rev 271178)
@@ -458,7 +458,6 @@
 imported/w3c/web-platform-tests/mediacapture-streams [ Skip ]
 imported/w3c/web-platform-tests/media-source/mediasource-buffered.html [ Failure ]
 imported/w3c/web-platform-tests/media-source/mediasource-changetype.html [ Failure ]
-imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html [ Failure ]
 imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html [ Failure ]
 imported/w3c/web-platform-tests/media-source/mediasource-remove.html [ Failure ]
 imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (271177 => 271178)


--- trunk/Source/WebCore/ChangeLog	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebCore/ChangeLog	2021-01-05 23:02:40 UTC (rev 271178)
@@ -1,3 +1,26 @@
+2021-01-05  Peng Liu  <[email protected]>
+
+        [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
+        https://bugs.webkit.org/show_bug.cgi?id=220334
+
+        Reviewed by Eric Carlson.
+
+        Add a completion handler parameter to SourceBufferPrivate::removeCodedFrames(),
+        and the caller (SourceBuffer) will fire `update` and `updateend` events when
+        the completion handler is called.
+
+        No new tests. Fix failures of the following tests:
+        - imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html
+        - imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-audio-bitrate.html
+        - imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-video-bitrate.html
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::removeTimerFired):
+        * platform/graphics/SourceBufferPrivate.cpp:
+        (WebCore::SourceBufferPrivate::removeCodedFrames):
+        * platform/graphics/SourceBufferPrivate.h:
+        (WebCore::SourceBufferPrivate::removeCodedFrames):
+
 2021-01-05  Fujii Hironori  <[email protected]>
 
         [WinCairo][curl] Enable CURLSSLOPT_NATIVE_CA flag to use system's CA certs instead of cacert.pem

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (271177 => 271178)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2021-01-05 23:02:40 UTC (rev 271178)
@@ -613,18 +613,18 @@
 
     // 6. Run the coded frame removal algorithm with start and end as the start and end of the removal range.
 
-    m_private->removeCodedFrames(m_pendingRemoveStart, m_pendingRemoveEnd, m_source->currentTime(), m_source->isEnded());
+    m_private->removeCodedFrames(m_pendingRemoveStart, m_pendingRemoveEnd, m_source->currentTime(), m_source->isEnded(), [this, protectedThis = makeRef(*this)] {
+        // 7. Set the updating attribute to false.
+        m_updating = false;
+        m_pendingRemoveStart = MediaTime::invalidTime();
+        m_pendingRemoveEnd = MediaTime::invalidTime();
 
-    // 7. Set the updating attribute to false.
-    m_updating = false;
-    m_pendingRemoveStart = MediaTime::invalidTime();
-    m_pendingRemoveEnd = MediaTime::invalidTime();
+        // 8. Queue a task to fire a simple event named update at this SourceBuffer object.
+        scheduleEvent(eventNames().updateEvent);
 
-    // 8. Queue a task to fire a simple event named update at this SourceBuffer object.
-    scheduleEvent(eventNames().updateEvent);
-
-    // 9. Queue a task to fire a simple event named updateend at this SourceBuffer object.
-    scheduleEvent(eventNames().updateendEvent);
+        // 9. Queue a task to fire a simple event named updateend at this SourceBuffer object.
+        scheduleEvent(eventNames().updateendEvent);
+    });
 }
 
 uint64_t SourceBuffer::maximumBufferSize() const

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp (271177 => 271178)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp	2021-01-05 23:02:40 UTC (rev 271178)
@@ -523,11 +523,13 @@
     return erasedRanges;
 }
 
-void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded)
+void SourceBufferPrivate::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void()>&& completionHandler)
 {
     ASSERT(start < end);
-    if (start >= end)
+    if (start >= end) {
+        completionHandler();
         return;
+    }
 
     // 3.5.9 Coded Frame Removal Algorithm
     // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer-coded-frame-removal
@@ -620,6 +622,8 @@
     updateHighestPresentationTimestamp();
 
     LOG(Media, "SourceBuffer::removeCodedFrames(%p) - buffered = %s", this, toString(m_buffered->ranges()).utf8().data());
+
+    completionHandler();
 }
 
 void SourceBufferPrivate::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (271177 => 271178)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2021-01-05 23:02:40 UTC (rev 271178)
@@ -86,7 +86,7 @@
     virtual void setGroupStartTimestampToEndTimestamp() { m_groupStartTimestamp = m_groupEndTimestamp; }
     virtual void setShouldGenerateTimestamps(bool flag) { m_shouldGenerateTimestamps = flag; }
     WEBCORE_EXPORT virtual void updateBufferedFromTrackBuffers(bool sourceIsEnded);
-    virtual void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded);
+    virtual void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded, CompletionHandler<void()>&& = [] { });
     WEBCORE_EXPORT virtual void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
     virtual void resetTimestampOffsetInTrackBuffers();
     virtual void startChangingType() { m_pendingInitializationSegmentForChangeType = true; }

Modified: trunk/Source/WebKit/ChangeLog (271177 => 271178)


--- trunk/Source/WebKit/ChangeLog	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebKit/ChangeLog	2021-01-05 23:02:40 UTC (rev 271178)
@@ -1,3 +1,21 @@
+2021-01-05  Peng Liu  <[email protected]>
+
+        [Media in GPU Process][MSE] SourceBuffer fires update and updateend events before the coded frames are removed
+        https://bugs.webkit.org/show_bug.cgi?id=220334
+
+        Reviewed by Eric Carlson.
+
+        Update the IPC message RemoteSourceBufferProxy::RemoveCodedFrames to implement
+        SourceBufferPrivateRemote::removeCodedFrames().
+
+        * GPUProcess/media/RemoteSourceBufferProxy.cpp:
+        (WebKit::RemoteSourceBufferProxy::removeCodedFrames):
+        * GPUProcess/media/RemoteSourceBufferProxy.h:
+        * GPUProcess/media/RemoteSourceBufferProxy.messages.in:
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
+        (WebKit::SourceBufferPrivateRemote::removeCodedFrames):
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
+
 2021-01-05  Ryan Haddad  <[email protected]>
 
         Unreviewed, reverting r271169.

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp (271177 => 271178)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2021-01-05 23:02:40 UTC (rev 271178)
@@ -210,9 +210,9 @@
     m_sourceBufferPrivate->updateBufferedFromTrackBuffers(sourceIsEnded);
 }
 
-void RemoteSourceBufferProxy::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded)
+void RemoteSourceBufferProxy::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void()>&& completionHandler)
 {
-    m_sourceBufferPrivate->removeCodedFrames(start, end, currentTime, isEnded);
+    m_sourceBufferPrivate->removeCodedFrames(start, end, currentTime, isEnded, WTFMove(completionHandler));
 }
 
 void RemoteSourceBufferProxy::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h (271177 => 271178)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2021-01-05 23:02:40 UTC (rev 271178)
@@ -93,7 +93,7 @@
     void setReadyState(WebCore::MediaPlayer::ReadyState);
     void startChangingType();
     void updateBufferedFromTrackBuffers(bool sourceIsEnded);
-    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded);
+    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void()>&&);
     void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
     void addTrackBuffer(TrackPrivateRemoteIdentifier);
     void resetTrackBuffers();

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in (271177 => 271178)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2021-01-05 23:02:40 UTC (rev 271178)
@@ -40,7 +40,7 @@
     ResetTrackBuffers()
     ClearTrackBuffers()
     SetAllTrackBuffersNeedRandomAccess()
-    RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded)
+    RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded) -> () Async
     EvictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded)
     ReenqueueMediaIfNeeded(MediaTime currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
     SetGroupStartTimestamp(MediaTime timestamp)

Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp (271177 => 271178)


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2021-01-05 23:02:40 UTC (rev 271178)
@@ -142,9 +142,9 @@
     m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::UpdateBufferedFromTrackBuffers(sourceIsEnded), m_remoteSourceBufferIdentifier);
 }
 
-void SourceBufferPrivateRemote::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded)
+void SourceBufferPrivateRemote::removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded, CompletionHandler<void()>&& completionHandler)
 {
-    m_gpuProcessConnection.connection().send(Messages::RemoteSourceBufferProxy::RemoveCodedFrames(start, end, currentMediaTime, isEnded), m_remoteSourceBufferIdentifier);
+    m_gpuProcessConnection.connection().sendWithAsyncReply(Messages::RemoteSourceBufferProxy::RemoveCodedFrames(start, end, currentMediaTime, isEnded), WTFMove(completionHandler), m_remoteSourceBufferIdentifier);
 }
 
 void SourceBufferPrivateRemote::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)

Modified: trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h (271177 => 271178)


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h	2021-01-05 22:42:53 UTC (rev 271177)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h	2021-01-05 23:02:40 UTC (rev 271178)
@@ -91,7 +91,7 @@
     void setGroupStartTimestampToEndTimestamp() final;
     void setShouldGenerateTimestamps(bool) final;
     void updateBufferedFromTrackBuffers(bool sourceIsEnded) final;
-    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded) final;
+    void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentMediaTime, bool isEnded, CompletionHandler<void()>&&) final;
     void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded) final;
     void resetTimestampOffsetInTrackBuffers() final;
     void startChangingType() final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to