Title: [290368] trunk/Source
Revision
290368
Author
[email protected]
Date
2022-02-23 05:47:10 -0800 (Wed, 23 Feb 2022)

Log Message

RemoteVideoFrameObjectHeap::getVideoFrameBuffer can use base class pixelBuffer accessor
https://bugs.webkit.org/show_bug.cgi?id=237020

Reviewed by Kimmo Kinnunen.

Source/WebCore:

No change of behavior.
Covered by existing tests.

* platform/graphics/cv/VideoFrameCV.h:
(WebCore::VideoFrameC$V::pixelBuffer const: Mark it as final.

Source/WebKit:

Make use of pixelBuffer virtual method to simplify things.
Add a missing early return in case of not found pixel buffer.

* GPUProcess/media/RemoteVideoFrameObjectHeap.cpp:
(WebKit::RemoteVideoFrameObjectHeap::getVideoFrameBuffer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290367 => 290368)


--- trunk/Source/WebCore/ChangeLog	2022-02-23 13:19:45 UTC (rev 290367)
+++ trunk/Source/WebCore/ChangeLog	2022-02-23 13:47:10 UTC (rev 290368)
@@ -1,3 +1,16 @@
+2022-02-23  Youenn Fablet  <[email protected]>
+
+        RemoteVideoFrameObjectHeap::getVideoFrameBuffer can use base class pixelBuffer accessor
+        https://bugs.webkit.org/show_bug.cgi?id=237020
+
+        Reviewed by Kimmo Kinnunen.
+
+        No change of behavior.
+        Covered by existing tests.
+
+        * platform/graphics/cv/VideoFrameCV.h:
+        (WebCore::VideoFrameC$V::pixelBuffer const: Mark it as final.
+
 2022-02-23  Zan Dobersek  <[email protected]>
 
         [GStreamer] Add WebKitDMABufVideoSink

Modified: trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.h (290367 => 290368)


--- trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.h	2022-02-23 13:19:45 UTC (rev 290367)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoFrameCV.h	2022-02-23 13:47:10 UTC (rev 290368)
@@ -40,7 +40,7 @@
     WEBCORE_EXPORT static Ref<VideoFrameCV> create(MediaTime presentationTime, bool isMirrored, VideoRotation, RetainPtr<CVPixelBufferRef>&&);
     WEBCORE_EXPORT ~VideoFrameCV();
 
-    CVPixelBufferRef pixelBuffer() const { return m_pixelBuffer.get(); }
+    CVPixelBufferRef pixelBuffer() const final { return m_pixelBuffer.get(); }
     ImageOrientation orientation() const;
 
     template<typename Encoder> void encode(Encoder&) const;

Modified: trunk/Source/WebKit/ChangeLog (290367 => 290368)


--- trunk/Source/WebKit/ChangeLog	2022-02-23 13:19:45 UTC (rev 290367)
+++ trunk/Source/WebKit/ChangeLog	2022-02-23 13:47:10 UTC (rev 290368)
@@ -1,3 +1,16 @@
+2022-02-23  Youenn Fablet  <[email protected]>
+
+        RemoteVideoFrameObjectHeap::getVideoFrameBuffer can use base class pixelBuffer accessor
+        https://bugs.webkit.org/show_bug.cgi?id=237020
+
+        Reviewed by Kimmo Kinnunen.
+
+        Make use of pixelBuffer virtual method to simplify things.
+        Add a missing early return in case of not found pixel buffer.
+
+        * GPUProcess/media/RemoteVideoFrameObjectHeap.cpp:
+        (WebKit::RemoteVideoFrameObjectHeap::getVideoFrameBuffer):
+
 2022-02-23  Kimmo Kinnunen  <[email protected]>
 
         Fix GPUP WebGL generator script wrt uninitialised sized span

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp (290367 => 290368)


--- trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp	2022-02-23 13:19:45 UTC (rev 290367)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp	2022-02-23 13:47:10 UTC (rev 290368)
@@ -94,22 +94,27 @@
     auto identifier = read.identifier();
     auto videoFrame = retire(WTFMove(read), 0_s);
 
-    if (!videoFrame)
+    if (!videoFrame) {
         m_connection->send(Messages::RemoteVideoFrameObjectHeapProxyProcessor::VideoFrameBufferNotFound { identifier }, 0);
-    RetainPtr<CVPixelBufferRef> pixelBuffer;
-    if (is<VideoFrameCV>(videoFrame))
-        pixelBuffer = downcast<VideoFrameCV>(*videoFrame).pixelBuffer();
-    else if (is<MediaSampleAVFObjC>(*videoFrame))
-        pixelBuffer = downcast<MediaSampleAVFObjC>(*videoFrame).pixelBuffer();
-    else {
+        return;
+    }
+
+    auto pixelBuffer = videoFrame->pixelBuffer();
+    if (!pixelBuffer) {
+        m_connection->send(Messages::RemoteVideoFrameObjectHeapProxyProcessor::VideoFrameBufferNotFound { identifier }, 0);
         ASSERT_NOT_REACHED();
         return;
     }
 
-    m_sharedVideoFrameWriter.write(pixelBuffer.get(),
+    bool result = m_sharedVideoFrameWriter.write(pixelBuffer,
         [&](auto& semaphore) { m_connection->send(Messages::RemoteVideoFrameObjectHeapProxyProcessor::SetSharedVideoFrameSemaphore { semaphore }, 0); },
         [&](auto& handle) { m_connection->send(Messages::RemoteVideoFrameObjectHeapProxyProcessor::SetSharedVideoFrameMemory { handle }, 0); }
     );
+    if (!result) {
+        // FIXME: We should ASSERT_NOT_REACHED once we support enough pixel buffer types.
+        m_connection->send(Messages::RemoteVideoFrameObjectHeapProxyProcessor::VideoFrameBufferNotFound { identifier }, 0);
+        return;
+    }
     m_connection->send(Messages::RemoteVideoFrameObjectHeapProxyProcessor::NewVideoFrameBuffer { identifier }, 0);
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to