Title: [278603] trunk/Source
Revision
278603
Author
[email protected]
Date
2021-06-08 05:29:51 -0700 (Tue, 08 Jun 2021)

Log Message

[MSE] Rework handling of SourceBuffer's buffer full.
https://bugs.webkit.org/show_bug.cgi?id=226711
<rdar://problem/78937909>

Reviewed by Jer Noble.

Source/WebCore:

Bug 225630 modified the handling of the Source Buffer "buffer full" algorithm.
Per spec, we are to reject a buffer only once we know that the source buffer is full.
The first appendBuffer should always complete.
https://w3c.github.io/media-source/#sourcebuffer-buffer-full-flag
"The buffer full flag keeps track of whether appendBuffer() is allowed to accept
 more bytes. It is set to false when the SourceBuffer object is created and gets
 updated as data is appended and removed."

"buffer full flag" only gets modified to true in the 3.5.1 Segment Parser Loop
algorithm, step 6.3
https://w3c.github.io/media-source/#sourcebuffer-segment-parser-loop
"If this SourceBuffer is full and cannot accept more media data, then set the
 buffer full flag to true."

On the 2nd call to the appendBuffer, in the Prepare Append algorithm, step 3.5.4.6:
https://w3c.github.io/media-source/#sourcebuffer-prepare-append

"If the buffer full flag equals true, then throw a QuotaExceededError exception
 and abort these steps."

This change moves the check of the source buffer size back into SourceBufferPrivate
so that checking if we have sufficient space or not is hidden from the SourceBuffer.
Rather than deal with a single "buffer full" flag, we use instead a isBufferFullFor()
method which allows to easily swap between the previous per-spec behaviour and the
one introduced by bug 225630 as it does present some advantages.
We can always determine if we have sufficient space by checking the current source
buffer memory size and the requested limit.
The previous algorithm took into consideration the allocated capacity of the
temporary SourceBuffer::m_pendingAppendData ; this approach was flawed in that we
always checked if m_pendingAppendData.capacity + newDataSize would fit in the
source buffer. However newDataSize would always happen to fit within the existing
capacity, so it was accounted for twice.
We remove check on the capacity allocated as it simplifies the code a great deal,
and avoid the piggy-backing of unrelated methods (such as
SourceBufferPrivate::reenqueueMediaIfNeeded that ended up also checking capacity)

This change is already covered with existing tests.

* Modules/mediasource/SourceBuffer.cpp: call new isBufferFullFor to check if
sufficient is available.
(WebCore::SourceBuffer::appendBufferInternal):
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
* platform/graphics/SourceBufferPrivate.h: Add isBufferFullFor method
remove m_bufferFull member.
* platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::reenqueueMediaIfNeeded): remove reference to
buffer capacity
(WebCore::SourceBufferPrivate::evictCodedFrames): remove reference to
buffer capacity
(WebCore::SourceBufferPrivate::isBufferFullFor): To get per-spec behaviour
we only need to stop checking the value of the requiredSize argument.

Source/WebKit:

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::evictCodedFrames):
(WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in: Remove capacity and
buffer full references from all methods; relying on the totalTrackBufferSizeInBytes
instead.
* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::evictCodedFrames):
(WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded):
* WebProcess/GPU/media/SourceBufferPrivateRemote.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278602 => 278603)


--- trunk/Source/WebCore/ChangeLog	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebCore/ChangeLog	2021-06-08 12:29:51 UTC (rev 278603)
@@ -1,3 +1,63 @@
+2021-06-08  Jean-Yves Avenard  <[email protected]>
+
+        [MSE] Rework handling of SourceBuffer's buffer full.
+        https://bugs.webkit.org/show_bug.cgi?id=226711
+        <rdar://problem/78937909>
+
+        Reviewed by Jer Noble.
+
+        Bug 225630 modified the handling of the Source Buffer "buffer full" algorithm.
+        Per spec, we are to reject a buffer only once we know that the source buffer is full.
+        The first appendBuffer should always complete.
+        https://w3c.github.io/media-source/#sourcebuffer-buffer-full-flag
+        "The buffer full flag keeps track of whether appendBuffer() is allowed to accept
+         more bytes. It is set to false when the SourceBuffer object is created and gets
+         updated as data is appended and removed."
+
+        "buffer full flag" only gets modified to true in the 3.5.1 Segment Parser Loop
+        algorithm, step 6.3
+        https://w3c.github.io/media-source/#sourcebuffer-segment-parser-loop
+        "If this SourceBuffer is full and cannot accept more media data, then set the
+         buffer full flag to true."
+
+        On the 2nd call to the appendBuffer, in the Prepare Append algorithm, step 3.5.4.6:
+        https://w3c.github.io/media-source/#sourcebuffer-prepare-append
+
+        "If the buffer full flag equals true, then throw a QuotaExceededError exception
+         and abort these steps."
+
+        This change moves the check of the source buffer size back into SourceBufferPrivate
+        so that checking if we have sufficient space or not is hidden from the SourceBuffer.
+        Rather than deal with a single "buffer full" flag, we use instead a isBufferFullFor()
+        method which allows to easily swap between the previous per-spec behaviour and the
+        one introduced by bug 225630 as it does present some advantages.
+        We can always determine if we have sufficient space by checking the current source
+        buffer memory size and the requested limit.
+        The previous algorithm took into consideration the allocated capacity of the
+        temporary SourceBuffer::m_pendingAppendData ; this approach was flawed in that we
+        always checked if m_pendingAppendData.capacity + newDataSize would fit in the
+        source buffer. However newDataSize would always happen to fit within the existing
+        capacity, so it was accounted for twice.
+        We remove check on the capacity allocated as it simplifies the code a great deal,
+        and avoid the piggy-backing of unrelated methods (such as
+        SourceBufferPrivate::reenqueueMediaIfNeeded that ended up also checking capacity)
+
+        This change is already covered with existing tests.
+
+        * Modules/mediasource/SourceBuffer.cpp: call new isBufferFullFor to check if
+        sufficient is available.
+        (WebCore::SourceBuffer::appendBufferInternal):
+        (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
+        * platform/graphics/SourceBufferPrivate.h: Add isBufferFullFor method
+        remove m_bufferFull member.
+        * platform/graphics/SourceBufferPrivate.cpp:
+        (WebCore::SourceBufferPrivate::reenqueueMediaIfNeeded): remove reference to
+        buffer capacity
+        (WebCore::SourceBufferPrivate::evictCodedFrames): remove reference to
+        buffer capacity
+        (WebCore::SourceBufferPrivate::isBufferFullFor): To get per-spec behaviour
+        we only need to stop checking the value of the requiredSize argument.
+
 2021-06-08  Antti Koivisto  <[email protected]>
 
         `text-decoration: underline` is not applied to web component

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (278602 => 278603)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2021-06-08 12:29:51 UTC (rev 278603)
@@ -483,10 +483,10 @@
     m_source->openIfInEndedState();
 
     // 4. Run the coded frame eviction algorithm.
-    m_private->evictCodedFrames(size, m_pendingAppendData.size(), maximumBufferSize(), m_source->currentTime(), m_source->duration(), m_source->isEnded());
+    m_private->evictCodedFrames(size, maximumBufferSize(), m_source->currentTime(), m_source->duration(), m_source->isEnded());
 
     // 5. If the buffer full flag equals true, then throw a QuotaExceededError exception and abort these step.
-    if (m_private->bufferFull() || m_private->totalTrackBufferSizeInBytes() + m_pendingAppendData.size() + size >= maximumBufferSize()) {
+    if (m_private->isBufferFullFor(size, maximumBufferSize())) {
         ERROR_LOG(LOGIDENTIFIER, "buffer full, failing with QuotaExceededError error");
         return Exception { QuotaExceededError };
     }
@@ -573,7 +573,7 @@
     scheduleEvent(eventNames().updateendEvent);
 
     m_source->monitorSourceBuffers();
-    m_private->reenqueueMediaIfNeeded(m_source->currentTime(), m_pendingAppendData.capacity(), maximumBufferSize());
+    m_private->reenqueueMediaIfNeeded(m_source->currentTime());
 
     DEBUG_LOG(LOGIDENTIFIER);
 }

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp (278602 => 278603)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.cpp	2021-06-08 12:29:51 UTC (rev 278603)
@@ -35,6 +35,7 @@
 #include "SampleMap.h"
 #include "SourceBufferPrivateClient.h"
 #include "TimeRanges.h"
+#include <wtf/CheckedArithmetic.h>
 #include <wtf/MediaTime.h>
 #include <wtf/StringPrintStream.h>
 
@@ -419,7 +420,7 @@
     trackBuffer.needsReenqueueing = false;
 }
 
-void SourceBufferPrivate::reenqueueMediaIfNeeded(const MediaTime& currentTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
+void SourceBufferPrivate::reenqueueMediaIfNeeded(const MediaTime& currentTime)
 {
     for (auto& trackBufferPair : m_trackBufferMap) {
         TrackBuffer& trackBuffer = trackBufferPair.value;
@@ -431,9 +432,6 @@
         } else
             provideMediaData(trackBuffer, trackID);
     }
-
-    if (totalTrackBufferSizeInBytes() + pendingAppendDataCapacity > maximumBufferSize)
-        m_bufferFull = true;
 }
 
 static WARN_UNUSED_RETURN bool decodeTimeComparator(const PresentationOrderSampleMap::MapType::value_type& a, const PresentationOrderSampleMap::MapType::value_type& b)
@@ -628,7 +626,7 @@
     completionHandler();
 }
 
-void SourceBufferPrivate::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
+void SourceBufferPrivate::evictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
 {
     // 3.5.13 Coded Frame Eviction Algorithm
     // http://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-eviction
@@ -639,7 +637,7 @@
     // This algorithm is run to free up space in this source buffer when new data is appended.
     // 1. Let new data equal the data that is about to be appended to this SourceBuffer.
     // 2. If the buffer full flag equals false, then abort these steps.
-    if (!m_bufferFull && totalTrackBufferSizeInBytes() + pendingAppendDataCapacity + newDataSize < maximumBufferSize)
+    if (!isBufferFullFor(newDataSize, maximumBufferSize))
         return;
 
     // 3. Let removal ranges equal a list of presentation time ranges that can be evicted from
@@ -661,8 +659,7 @@
         // 4. For each range in removal ranges, run the coded frame removal algorithm with start and
         // end equal to the removal range start and end timestamp respectively.
         removeCodedFrames(rangeStart, std::min(rangeEnd, maximumRangeEnd), currentTime, isEnded);
-        if (totalTrackBufferSizeInBytes() + pendingAppendDataCapacity + newDataSize < maximumBufferSize) {
-            m_bufferFull = false;
+        if (!isBufferFullFor(newDataSize, maximumBufferSize)) {
             break;
         }
 
@@ -670,7 +667,7 @@
         rangeEnd += thirtySeconds;
     }
 
-    if (!m_bufferFull) {
+    if (!isBufferFullFor(newDataSize, maximumBufferSize)) {
 #if !RELEASE_LOG_DISABLED
         DEBUG_LOG(LOGIDENTIFIER, "evicted ", initialBufferedSize - totalTrackBufferSizeInBytes());
 #endif
@@ -705,8 +702,7 @@
         // end equal to the removal range start and end timestamp respectively.
         removeCodedFrames(std::max(minimumRangeStart, rangeStart), rangeEnd, currentTime, isEnded);
 
-        if (totalTrackBufferSizeInBytes() + pendingAppendDataCapacity + newDataSize < maximumBufferSize) {
-            m_bufferFull = false;
+        if (!isBufferFullFor(newDataSize, maximumBufferSize)) {
             break;
         }
 
@@ -715,7 +711,7 @@
     }
 
 #if !RELEASE_LOG_DISABLED
-    if (m_bufferFull)
+    if (isBufferFullFor(newDataSize, maximumBufferSize))
         ERROR_LOG(LOGIDENTIFIER, "FAILED to free enough after evicting ", initialBufferedSize - totalTrackBufferSizeInBytes());
     else
         DEBUG_LOG(LOGIDENTIFIER, "evicted ", initialBufferedSize - totalTrackBufferSizeInBytes());
@@ -722,6 +718,15 @@
 #endif
 }
 
+bool SourceBufferPrivate::isBufferFullFor(uint64_t requiredSize, uint64_t maximumBufferSize)
+{
+    auto totalRequired = checkedSum<uint64_t>(totalTrackBufferSizeInBytes(), requiredSize);
+    if (totalRequired.hasOverflowed())
+        return true;
+
+    return totalRequired >= maximumBufferSize;
+}
+
 uint64_t SourceBufferPrivate::totalTrackBufferSizeInBytes() const
 {
     uint64_t totalSizeInBytes = 0;

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (278602 => 278603)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2021-06-08 12:29:51 UTC (rev 278603)
@@ -77,7 +77,7 @@
 
     WEBCORE_EXPORT virtual void setMediaSourceEnded(bool);
     virtual void setMode(SourceBufferAppendMode mode) { m_appendMode = mode; }
-    WEBCORE_EXPORT virtual void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize);
+    WEBCORE_EXPORT virtual void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime);
     WEBCORE_EXPORT virtual void addTrackBuffer(const AtomString& trackId, RefPtr<MediaDescription>&&);
     WEBCORE_EXPORT virtual void resetTrackBuffers();
     WEBCORE_EXPORT virtual void clearTrackBuffers();
@@ -87,7 +87,7 @@
     virtual void setShouldGenerateTimestamps(bool flag) { m_shouldGenerateTimestamps = flag; }
     WEBCORE_EXPORT virtual void updateBufferedFromTrackBuffers(bool sourceIsEnded);
     WEBCORE_EXPORT 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);
+    WEBCORE_EXPORT virtual void evictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
     WEBCORE_EXPORT virtual uint64_t totalTrackBufferSizeInBytes() const;
     WEBCORE_EXPORT virtual void resetTimestampOffsetInTrackBuffers();
     virtual void startChangingType() { m_pendingInitializationSegmentForChangeType = true; }
@@ -102,7 +102,7 @@
 
     const TimeRanges* buffered() const { return m_buffered.get(); }
 
-    bool bufferFull() const { return m_bufferFull; }
+    bool isBufferFullFor(uint64_t requiredSize, uint64_t maximumBufferSize);
 
     // Methods used by MediaSourcePrivate
     bool hasAudio() const { return m_hasAudio; }
@@ -167,7 +167,6 @@
     WEBCORE_EXPORT void didReceiveInitializationSegment(SourceBufferPrivateClient::InitializationSegment&&, CompletionHandler<void()>&&);
     WEBCORE_EXPORT void didReceiveSample(Ref<MediaSample>&&);
     WEBCORE_EXPORT void setBufferedRanges(const PlatformTimeRanges&);
-    void setBufferFull(bool bufferFull) { m_bufferFull = bufferFull; }
     void provideMediaData(const AtomString& trackID);
 
     SourceBufferPrivateClient* m_client { nullptr };
@@ -201,7 +200,6 @@
     MediaTime m_groupStartTimestamp { MediaTime::invalidTime() };
     MediaTime m_groupEndTimestamp { MediaTime::zeroTime() };
 
-    bool m_bufferFull { false };
     bool m_isMediaSourceEnded { false };
     RefPtr<TimeRanges> m_buffered;
 };

Modified: trunk/Source/WebKit/ChangeLog (278602 => 278603)


--- trunk/Source/WebKit/ChangeLog	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebKit/ChangeLog	2021-06-08 12:29:51 UTC (rev 278603)
@@ -1,3 +1,23 @@
+2021-06-08  Jean-Yves Avenard  <[email protected]>
+
+        [MSE] Rework handling of SourceBuffer's buffer full.
+        https://bugs.webkit.org/show_bug.cgi?id=226711
+        <rdar://problem/78937909>
+
+        Reviewed by Jer Noble.
+
+        * GPUProcess/media/RemoteSourceBufferProxy.cpp:
+        (WebKit::RemoteSourceBufferProxy::evictCodedFrames):
+        (WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded):
+        * GPUProcess/media/RemoteSourceBufferProxy.h:
+        * GPUProcess/media/RemoteSourceBufferProxy.messages.in: Remove capacity and
+        buffer full references from all methods; relying on the totalTrackBufferSizeInBytes
+        instead.
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
+        (WebKit::SourceBufferPrivateRemote::evictCodedFrames):
+        (WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded):
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.h:
+
 2021-06-08  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.33.2 release

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp (278602 => 278603)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2021-06-08 12:29:51 UTC (rev 278603)
@@ -257,10 +257,10 @@
     });
 }
 
-void RemoteSourceBufferProxy::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded, EvictCodedFramesDelayedReply&& completionHandler)
+void RemoteSourceBufferProxy::evictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded, EvictCodedFramesDelayedReply&& completionHandler)
 {
-    m_sourceBufferPrivate->evictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded);
-    completionHandler(m_sourceBufferPrivate->bufferFull(), m_sourceBufferPrivate->totalTrackBufferSizeInBytes());
+    m_sourceBufferPrivate->evictCodedFrames(newDataSize, maximumBufferSize, currentTime, duration, isEnded);
+    completionHandler(m_sourceBufferPrivate->totalTrackBufferSizeInBytes());
 }
 
 void RemoteSourceBufferProxy::addTrackBuffer(TrackPrivateRemoteIdentifier trackPrivateRemoteIdentifier)
@@ -285,10 +285,9 @@
     m_sourceBufferPrivate->setAllTrackBuffersNeedRandomAccess();
 }
 
-void RemoteSourceBufferProxy::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, CompletionHandler<void(bool)>&& completionHandler)
+void RemoteSourceBufferProxy::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime)
 {
-    m_sourceBufferPrivate->reenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize);
-    completionHandler(m_sourceBufferPrivate->bufferFull());
+    m_sourceBufferPrivate->reenqueueMediaIfNeeded(currentMediaTime);
 }
 
 void RemoteSourceBufferProxy::setGroupStartTimestamp(const MediaTime& timestamp)

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h (278602 => 278603)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2021-06-08 12:29:51 UTC (rev 278603)
@@ -98,12 +98,12 @@
     using RemoveCodedFramesAsyncReply = Messages::RemoteSourceBufferProxy::RemoveCodedFramesAsyncReply;
     using EvictCodedFramesDelayedReply= Messages::RemoteSourceBufferProxy::EvictCodedFramesDelayedReply;
     void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, RemoveCodedFramesAsyncReply&&);
-    void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded, EvictCodedFramesDelayedReply&&);
+    void evictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded, EvictCodedFramesDelayedReply&&);
     void addTrackBuffer(TrackPrivateRemoteIdentifier);
     void resetTrackBuffers();
     void clearTrackBuffers();
     void setAllTrackBuffersNeedRandomAccess();
-    void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, CompletionHandler<void(bool)>&&);
+    void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime);
     void setGroupStartTimestamp(const MediaTime&);
     void setGroupStartTimestampToEndTimestamp();
     void setShouldGenerateTimestamps(bool);

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


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2021-06-08 12:29:51 UTC (rev 278603)
@@ -42,8 +42,8 @@
     ClearTrackBuffers()
     SetAllTrackBuffersNeedRandomAccess()
     RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded) -> (WebCore::PlatformTimeRanges buffered, uint64_t totalTrackBufferSizeInBytes) Async
-    EvictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded) -> (bool bufferFull, uint64_t totalTrackBufferSizeInBytes) Synchronous
-    ReenqueueMediaIfNeeded(MediaTime currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize) -> (bool bufferFull) Async
+    EvictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded) -> (uint64_t totalTrackBufferSizeInBytes) Synchronous
+    ReenqueueMediaIfNeeded(MediaTime currentMediaTime)
     SetGroupStartTimestamp(MediaTime timestamp)
     SetGroupStartTimestampToEndTimestamp()
     SetShouldGenerateTimestamps(bool shouldGenerateTimestamps)

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


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2021-06-08 12:29:51 UTC (rev 278603)
@@ -200,15 +200,13 @@
         m_remoteSourceBufferIdentifier);
 }
 
-void SourceBufferPrivateRemote::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
+void SourceBufferPrivateRemote::evictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
 {
     if (!m_gpuProcessConnection)
         return;
 
-    bool bufferFull = false;
     uint64_t totalBufferSizeInBytes = 0;
-    if (m_gpuProcessConnection->connection().sendSync(Messages::RemoteSourceBufferProxy::EvictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded), Messages::RemoteSourceBufferProxy::EvictCodedFrames::Reply(bufferFull, totalBufferSizeInBytes), m_remoteSourceBufferIdentifier)) {
-        setBufferFull(bufferFull);
+    if (m_gpuProcessConnection->connection().sendSync(Messages::RemoteSourceBufferProxy::EvictCodedFrames(newDataSize, maximumBufferSize, currentTime, duration, isEnded), Messages::RemoteSourceBufferProxy::EvictCodedFrames::Reply(totalBufferSizeInBytes), m_remoteSourceBufferIdentifier)) {
         m_totalTrackBufferSizeInBytes = totalBufferSizeInBytes;
     }
 }
@@ -271,14 +269,12 @@
     m_gpuProcessConnection->connection().send(Messages::RemoteSourceBufferProxy::SetShouldGenerateTimestamps(shouldGenerateTimestamps), m_remoteSourceBufferIdentifier);
 }
 
-void SourceBufferPrivateRemote::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
+void SourceBufferPrivateRemote::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime)
 {
     if (!m_gpuProcessConnection)
         return;
 
-    m_gpuProcessConnection->connection().sendWithAsyncReply(Messages::RemoteSourceBufferProxy::ReenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize), [this, protectedThis = makeRef(*this)](auto bufferFull) mutable {
-        setBufferFull(bufferFull);
-    }, m_remoteSourceBufferIdentifier);
+    m_gpuProcessConnection->connection().send(Messages::RemoteSourceBufferProxy::ReenqueueMediaIfNeeded(currentMediaTime), m_remoteSourceBufferIdentifier);
 }
 
 void SourceBufferPrivateRemote::resetTimestampOffsetInTrackBuffers()

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


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h	2021-06-08 12:11:32 UTC (rev 278602)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.h	2021-06-08 12:29:51 UTC (rev 278603)
@@ -81,7 +81,7 @@
     bool canSwitchToType(const WebCore::ContentType&) final;
     void setMediaSourceEnded(bool) final;
     void setMode(WebCore::SourceBufferAppendMode) final;
-    void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize) final;
+    void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime) final;
     void addTrackBuffer(const AtomString& trackId, RefPtr<WebCore::MediaDescription>&&) final;
     void resetTrackBuffers() final;
     void clearTrackBuffers() final;
@@ -91,7 +91,7 @@
     void setShouldGenerateTimestamps(bool) final;
     void updateBufferedFromTrackBuffers(bool sourceIsEnded) 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 evictCodedFrames(uint64_t newDataSize, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded) final;
     void resetTimestampOffsetInTrackBuffers() final;
     void startChangingType() final;
     void setTimestampOffset(const MediaTime&) final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to