Title: [290558] trunk/Source/WebKit
Revision
290558
Author
[email protected]
Date
2022-02-27 04:06:16 -0800 (Sun, 27 Feb 2022)

Log Message

Exposing RemoteVideoFrameProxy::write is unneeded
https://bugs.webkit.org/show_bug.cgi?id=237212

Reviewed by Eric Carlson.

Exposing RemoteVideoFrameProxy::write is unneeded as RemoteVideoFrameProxy is immutable.
It is best to remove it as calling write() inadvertently would break things.
Renaming read() to newReadReference() to make it clear that we are creating a new read reference
that needs to be sent to GPUProcess to prevent leaks.
No change of behavior.

* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::copyTextureFromMedia):
* WebProcess/GPU/media/RemoteVideoFrameProxy.cpp:
(WebKit::RemoteVideoFrameProxy::~RemoteVideoFrameProxy):
(WebKit::RemoteVideoFrameProxy::newReadReference const):
(WebKit::RemoteVideoFrameProxy::pixelBuffer const):
(WebKit::RemoteVideoFrameProxy::write const): Deleted.
(WebKit::RemoteVideoFrameProxy::read const): Deleted.
* WebProcess/GPU/media/RemoteVideoFrameProxy.h:
* WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::encodeFrame):
* WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp:
(WebKit::RemoteVideoFrameObjectHeapProxyProcessor::getVideoFrameBuffer):
* WebProcess/GPU/webrtc/SharedVideoFrame.cpp:
(WebKit::SharedVideoFrameWriter::write):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (290557 => 290558)


--- trunk/Source/WebKit/ChangeLog	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/ChangeLog	2022-02-27 12:06:16 UTC (rev 290558)
@@ -1,3 +1,32 @@
+2022-02-27  Youenn Fablet  <[email protected]>
+
+        Exposing RemoteVideoFrameProxy::write is unneeded
+        https://bugs.webkit.org/show_bug.cgi?id=237212
+
+        Reviewed by Eric Carlson.
+
+        Exposing RemoteVideoFrameProxy::write is unneeded as RemoteVideoFrameProxy is immutable.
+        It is best to remove it as calling write() inadvertently would break things.
+        Renaming read() to newReadReference() to make it clear that we are creating a new read reference
+        that needs to be sent to GPUProcess to prevent leaks.
+        No change of behavior.
+
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+        (WebKit::RemoteGraphicsContextGLProxy::copyTextureFromMedia):
+        * WebProcess/GPU/media/RemoteVideoFrameProxy.cpp:
+        (WebKit::RemoteVideoFrameProxy::~RemoteVideoFrameProxy):
+        (WebKit::RemoteVideoFrameProxy::newReadReference const):
+        (WebKit::RemoteVideoFrameProxy::pixelBuffer const):
+        (WebKit::RemoteVideoFrameProxy::write const): Deleted.
+        (WebKit::RemoteVideoFrameProxy::read const): Deleted.
+        * WebProcess/GPU/media/RemoteVideoFrameProxy.h:
+        * WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
+        (WebKit::LibWebRTCCodecs::encodeFrame):
+        * WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp:
+        (WebKit::RemoteVideoFrameObjectHeapProxyProcessor::getVideoFrameBuffer):
+        * WebProcess/GPU/webrtc/SharedVideoFrame.cpp:
+        (WebKit::SharedVideoFrameWriter::write):
+
 2022-02-26  Kimmo Kinnunen  <[email protected]>
 
         RemoteCaptureSampleManager, UserMediaSampleCaptureManagerProxy create the RemoteVideoFrame in incorrectly

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (290557 => 290558)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2022-02-27 12:06:16 UTC (rev 290558)
@@ -190,7 +190,7 @@
     if (!videoFrame || !is<RemoteVideoFrameProxy>(*videoFrame))
         return false;
     bool result = false;
-    auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::CopyTextureFromVideoFrame(downcast<RemoteVideoFrameProxy>(*videoFrame).read(), texture, target, level, internalFormat, format, type, premultiplyAlpha, flipY), Messages::RemoteGraphicsContextGL::CopyTextureFromVideoFrame::Reply(result));
+    auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::CopyTextureFromVideoFrame(downcast<RemoteVideoFrameProxy>(*videoFrame).newReadReference(), texture, target, level, internalFormat, format, type, premultiplyAlpha, flipY), Messages::RemoteGraphicsContextGL::CopyTextureFromVideoFrame::Reply(result));
     if (!sendResult) {
         markContextLost();
         return false;

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.cpp (290557 => 290558)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.cpp	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.cpp	2022-02-27 12:06:16 UTC (rev 290558)
@@ -81,7 +81,7 @@
 
 RemoteVideoFrameProxy::~RemoteVideoFrameProxy()
 {
-    releaseRemoteVideoFrameProxy(m_connection, write());
+    releaseRemoteVideoFrameProxy(m_connection, m_referenceTracker.write());
 }
 
 RemoteVideoFrameIdentifier RemoteVideoFrameProxy::identifier() const
@@ -89,13 +89,8 @@
     return m_referenceTracker.identifier();
 }
 
-RemoteVideoFrameWriteReference RemoteVideoFrameProxy::write() const
+RemoteVideoFrameReadReference RemoteVideoFrameProxy::newReadReference() const
 {
-    return m_referenceTracker.write();
-}
-
-RemoteVideoFrameReadReference RemoteVideoFrameProxy::read() const
-{
     return m_referenceTracker.read();
 }
 
@@ -122,7 +117,7 @@
             semaphore.wait();
         } else {
             RetainPtr<CVPixelBufferRef> pixelBuffer;
-            auto result = m_connection->sendSync(Messages::RemoteVideoFrameObjectHeap::PixelBuffer(read()), Messages::RemoteVideoFrameObjectHeap::PixelBuffer::Reply(pixelBuffer), 0, defaultTimeout);
+            auto result = m_connection->sendSync(Messages::RemoteVideoFrameObjectHeap::PixelBuffer(newReadReference()), Messages::RemoteVideoFrameObjectHeap::PixelBuffer::Reply(pixelBuffer), 0, defaultTimeout);
             if (result)
                 m_pixelBuffer = WTFMove(pixelBuffer);
         }

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.h (290557 => 290558)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.h	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteVideoFrameProxy.h	2022-02-27 12:06:16 UTC (rev 290558)
@@ -78,8 +78,7 @@
     ~RemoteVideoFrameProxy() final;
 
     RemoteVideoFrameIdentifier identifier() const;
-    RemoteVideoFrameWriteReference write() const;
-    RemoteVideoFrameReadReference read() const;
+    RemoteVideoFrameReadReference newReadReference() const;
 
     WebCore::IntSize size() const { return m_size; }
 

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp (290557 => 290558)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp	2022-02-27 12:06:16 UTC (rev 290558)
@@ -466,7 +466,7 @@
     if (auto* provider = webrtc::videoFrameBufferProvider(frame)) {
         auto* videoFrame = static_cast<VideoFrame*>(provider);
         if (is<RemoteVideoFrameProxy>(videoFrame))
-            remoteVideoFrameReadReference = downcast<RemoteVideoFrameProxy>(videoFrame)->read();
+            remoteVideoFrameReadReference = downcast<RemoteVideoFrameProxy>(videoFrame)->newReadReference();
     }
 
     RetainPtr<CVPixelBufferRef> buffer;

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp (290557 => 290558)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp	2022-02-27 12:06:16 UTC (rev 290558)
@@ -119,7 +119,7 @@
         videoFrameBufferNotFound(frame.identifier());
         return;
     }
-    IPC::Connection::send(m_connectionID, Messages::RemoteVideoFrameObjectHeap::GetVideoFrameBuffer(frame.read()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
+    IPC::Connection::send(m_connectionID, Messages::RemoteVideoFrameObjectHeap::GetVideoFrameBuffer(frame.newReadReference()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
 }
 
 }

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.cpp (290557 => 290558)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.cpp	2022-02-27 11:44:58 UTC (rev 290557)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.cpp	2022-02-27 12:06:16 UTC (rev 290558)
@@ -92,7 +92,7 @@
 {
     SharedVideoFrame sharedVideoFrame { frame.presentationTime(), frame.videoMirrored(), frame.videoRotation(), nullptr };
     if (is<RemoteVideoFrameProxy>(frame)) {
-        sharedVideoFrame.buffer = downcast<RemoteVideoFrameProxy>(frame).read();
+        sharedVideoFrame.buffer = downcast<RemoteVideoFrameProxy>(frame).newReadReference();
         return sharedVideoFrame;
     }
     if (is<MediaSampleAVFObjC>(frame)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to