Title: [277003] trunk/Source
Revision
277003
Author
[email protected]
Date
2021-05-04 22:41:30 -0700 (Tue, 04 May 2021)

Log Message

[GPUP] Implement SourceBufferPrivateRemote::bufferFull()
https://bugs.webkit.org/show_bug.cgi?id=224139

Reviewed by Jer Noble.

Source/WebCore:

* platform/graphics/SourceBufferPrivate.h:
(WebCore::SourceBufferPrivate::setBufferFull): This function will be used
by `SourceBufferPrivateRemote::evictCodedFrames()` and `SourceBufferPrivateRemote::reenqueueMediaIfNeeded()`.

Source/WebKit:

Modify two IPC messages to implement `SourceBufferPrivateRemote::bufferFull()`.

* GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::evictCodedFrames):
(WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded):
* GPUProcess/media/RemoteSourceBufferProxy.h:
* GPUProcess/media/RemoteSourceBufferProxy.messages.in:

* WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
(WebKit::SourceBufferPrivateRemote::evictCodedFrames):
(WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277002 => 277003)


--- trunk/Source/WebCore/ChangeLog	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebCore/ChangeLog	2021-05-05 05:41:30 UTC (rev 277003)
@@ -1,3 +1,14 @@
+2021-05-04  Peng Liu  <[email protected]>
+
+        [GPUP] Implement SourceBufferPrivateRemote::bufferFull()
+        https://bugs.webkit.org/show_bug.cgi?id=224139
+
+        Reviewed by Jer Noble.
+
+        * platform/graphics/SourceBufferPrivate.h:
+        (WebCore::SourceBufferPrivate::setBufferFull): This function will be used
+        by `SourceBufferPrivateRemote::evictCodedFrames()` and `SourceBufferPrivateRemote::reenqueueMediaIfNeeded()`.
+
 2021-05-04  Antti Koivisto  <[email protected]>
 
         REGRESSION(iOS 14): Author shadow DOM invalidated unnecessarily on pseudo element change

Modified: trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h (277002 => 277003)


--- trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2021-05-05 05:41:30 UTC (rev 277003)
@@ -166,6 +166,7 @@
     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);
     uint64_t totalTrackBufferSizeInBytes() const;
 

Modified: trunk/Source/WebKit/ChangeLog (277002 => 277003)


--- trunk/Source/WebKit/ChangeLog	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebKit/ChangeLog	2021-05-05 05:41:30 UTC (rev 277003)
@@ -1,3 +1,22 @@
+2021-05-04  Peng Liu  <[email protected]>
+
+        [GPUP] Implement SourceBufferPrivateRemote::bufferFull()
+        https://bugs.webkit.org/show_bug.cgi?id=224139
+
+        Reviewed by Jer Noble.
+
+        Modify two IPC messages to implement `SourceBufferPrivateRemote::bufferFull()`.
+
+        * GPUProcess/media/RemoteSourceBufferProxy.cpp:
+        (WebKit::RemoteSourceBufferProxy::evictCodedFrames):
+        (WebKit::RemoteSourceBufferProxy::reenqueueMediaIfNeeded):
+        * GPUProcess/media/RemoteSourceBufferProxy.h:
+        * GPUProcess/media/RemoteSourceBufferProxy.messages.in:
+
+        * WebProcess/GPU/media/SourceBufferPrivateRemote.cpp:
+        (WebKit::SourceBufferPrivateRemote::evictCodedFrames):
+        (WebKit::SourceBufferPrivateRemote::reenqueueMediaIfNeeded):
+
 2021-05-04  Jiewen Tan  <[email protected]>
 
         PCM: Find a way to validate source_secret_token and source_secret_token_signature

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp (277002 => 277003)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp	2021-05-05 05:41:30 UTC (rev 277003)
@@ -257,9 +257,10 @@
     });
 }
 
-void RemoteSourceBufferProxy::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded)
+void RemoteSourceBufferProxy::evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded, CompletionHandler<void(bool)>&& completionHandler)
 {
     m_sourceBufferPrivate->evictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded);
+    completionHandler(m_sourceBufferPrivate->bufferFull());
 }
 
 void RemoteSourceBufferProxy::addTrackBuffer(TrackPrivateRemoteIdentifier trackPrivateRemoteIdentifier)
@@ -284,9 +285,10 @@
     m_sourceBufferPrivate->setAllTrackBuffersNeedRandomAccess();
 }
 
-void RemoteSourceBufferProxy::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize)
+void RemoteSourceBufferProxy::reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, CompletionHandler<void(bool)>&& completionHandler)
 {
     m_sourceBufferPrivate->reenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize);
+    completionHandler(m_sourceBufferPrivate->bufferFull());
 }
 
 void RemoteSourceBufferProxy::setGroupStartTimestamp(const MediaTime& timestamp)

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h (277002 => 277003)


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h	2021-05-05 05:41:30 UTC (rev 277003)
@@ -95,12 +95,12 @@
     void startChangingType();
     void updateBufferedFromTrackBuffers(bool sourceIsEnded, CompletionHandler<void(WebCore::PlatformTimeRanges&&)>&&);
     void removeCodedFrames(const MediaTime& start, const MediaTime& end, const MediaTime& currentTime, bool isEnded, CompletionHandler<void(WebCore::PlatformTimeRanges&&)>&&);
-    void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded);
+    void evictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, const MediaTime& currentTime, const MediaTime& duration, bool isEnded, CompletionHandler<void(bool)>&&);
     void addTrackBuffer(TrackPrivateRemoteIdentifier);
     void resetTrackBuffers();
     void clearTrackBuffers();
     void setAllTrackBuffersNeedRandomAccess();
-    void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize);
+    void reenqueueMediaIfNeeded(const MediaTime& currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, CompletionHandler<void(bool)>&&);
     void setGroupStartTimestamp(const MediaTime&);
     void setGroupStartTimestampToEndTimestamp();
     void setShouldGenerateTimestamps(bool);

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


--- trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.messages.in	2021-05-05 05:41:30 UTC (rev 277003)
@@ -42,8 +42,8 @@
     ClearTrackBuffers()
     SetAllTrackBuffersNeedRandomAccess()
     RemoveCodedFrames(MediaTime start, MediaTime end, MediaTime currentTime, bool isEnded) -> (WebCore::PlatformTimeRanges buffered) 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)
+    EvictCodedFrames(uint64_t newDataSize, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize, MediaTime currentTime, MediaTime duration, bool isEnded) -> (bool bufferFull) Synchronous
+    ReenqueueMediaIfNeeded(MediaTime currentMediaTime, uint64_t pendingAppendDataCapacity, uint64_t maximumBufferSize) -> (bool bufferFull) Async
     SetGroupStartTimestamp(MediaTime timestamp)
     SetGroupStartTimestampToEndTimestamp()
     SetShouldGenerateTimestamps(bool shouldGenerateTimestamps)

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


--- trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2021-05-05 05:38:21 UTC (rev 277002)
+++ trunk/Source/WebKit/WebProcess/GPU/media/SourceBufferPrivateRemote.cpp	2021-05-05 05:41:30 UTC (rev 277003)
@@ -199,7 +199,9 @@
     if (!m_gpuProcessConnection)
         return;
 
-    m_gpuProcessConnection->connection().send(Messages::RemoteSourceBufferProxy::EvictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded), m_remoteSourceBufferIdentifier);
+    bool bufferFull = false;
+    if (m_gpuProcessConnection->connection().sendSync(Messages::RemoteSourceBufferProxy::EvictCodedFrames(newDataSize, pendingAppendDataCapacity, maximumBufferSize, currentTime, duration, isEnded), Messages::RemoteSourceBufferProxy::EvictCodedFrames::Reply(bufferFull), m_remoteSourceBufferIdentifier))
+        setBufferFull(bufferFull);
 }
 
 void SourceBufferPrivateRemote::addTrackBuffer(const AtomString& trackId, RefPtr<MediaDescription>&&)
@@ -264,7 +266,9 @@
     if (!m_gpuProcessConnection)
         return;
 
-    m_gpuProcessConnection->connection().send(Messages::RemoteSourceBufferProxy::ReenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize), m_remoteSourceBufferIdentifier);
+    m_gpuProcessConnection->connection().sendWithAsyncReply(Messages::RemoteSourceBufferProxy::ReenqueueMediaIfNeeded(currentMediaTime, pendingAppendDataCapacity, maximumBufferSize), [this, protectedThis = makeRef(*this)](auto bufferFull) mutable {
+        setBufferFull(bufferFull);
+    }, m_remoteSourceBufferIdentifier);
 }
 
 void SourceBufferPrivateRemote::resetTimestampOffsetInTrackBuffers()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to