Title: [257470] trunk/Source
Revision
257470
Author
[email protected]
Date
2020-02-26 07:29:35 -0800 (Wed, 26 Feb 2020)

Log Message

Conversion between MediaSample and RemoteVideoSample should preserve the rotation information
https://bugs.webkit.org/show_bug.cgi?id=208240

Reviewed by Eric Carlson.

Source/WebCore:

Update RemoteVideoSample to have surface getter be const.
Add a new routine to convert a RemoteVideoSample in a MediaSample, with proper rotation and mirrored information.
Covered by manual testing.

* platform/graphics/RemoteVideoSample.cpp:
(WebCore::RemoteVideoSample::surface const):
* platform/graphics/RemoteVideoSample.h:
(WebCore::RemoteVideoSample::mirrored const):
* platform/graphics/cv/ImageTransferSessionVT.h:
* platform/graphics/cv/ImageTransferSessionVT.mm:
(WebCore::ImageTransferSessionVT::createMediaSample):

Source/WebKit:

Use new routine that preserves rotation.

* GPUProcess/webrtc/RemoteMediaRecorder.cpp:
(WebKit::RemoteMediaRecorder::videoSampleAvailable):
* GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
(WebKit::RemoteSampleBufferDisplayLayer::enqueueSample):
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (257469 => 257470)


--- trunk/Source/WebCore/ChangeLog	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebCore/ChangeLog	2020-02-26 15:29:35 UTC (rev 257470)
@@ -1,3 +1,22 @@
+2020-02-26  Youenn Fablet  <[email protected]>
+
+        Conversion between MediaSample and RemoteVideoSample should preserve the rotation information
+        https://bugs.webkit.org/show_bug.cgi?id=208240
+
+        Reviewed by Eric Carlson.
+
+        Update RemoteVideoSample to have surface getter be const.
+        Add a new routine to convert a RemoteVideoSample in a MediaSample, with proper rotation and mirrored information.
+        Covered by manual testing.
+
+        * platform/graphics/RemoteVideoSample.cpp:
+        (WebCore::RemoteVideoSample::surface const):
+        * platform/graphics/RemoteVideoSample.h:
+        (WebCore::RemoteVideoSample::mirrored const):
+        * platform/graphics/cv/ImageTransferSessionVT.h:
+        * platform/graphics/cv/ImageTransferSessionVT.mm:
+        (WebCore::ImageTransferSessionVT::createMediaSample):
+
 2020-02-26  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC][Floats] ASSERT(committedInlineItemCount || line.hasIntrusiveFloat()) in LineLayoutContext::close

Modified: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp (257469 => 257470)


--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp	2020-02-26 15:29:35 UTC (rev 257470)
@@ -141,10 +141,10 @@
 {
 }
 
-IOSurfaceRef RemoteVideoSample::surface()
+IOSurfaceRef RemoteVideoSample::surface() const
 {
     if (!m_ioSurface && m_sendRight)
-        m_ioSurface = WebCore::IOSurface::createFromSendRight(WTFMove(m_sendRight), sRGBColorSpaceRef());
+        const_cast<RemoteVideoSample*>(this)->m_ioSurface = WebCore::IOSurface::createFromSendRight(WTFMove(const_cast<RemoteVideoSample*>(this)->m_sendRight), sRGBColorSpaceRef());
 
     return m_ioSurface ? m_ioSurface->surface() : nullptr;
 }

Modified: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h (257469 => 257470)


--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h	2020-02-26 15:29:35 UTC (rev 257470)
@@ -50,7 +50,7 @@
 #if HAVE(IOSURFACE)
     WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(MediaSample&);
     WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(CVPixelBufferRef, MediaTime&& presentationTime, MediaSample::VideoRotation = MediaSample::VideoRotation::None);
-    WEBCORE_EXPORT IOSurfaceRef surface();
+    WEBCORE_EXPORT IOSurfaceRef surface() const;
 #endif
 
     const MediaTime& time() const { return m_time; }
@@ -57,6 +57,7 @@
     uint32_t videoFormat() const { return m_videoFormat; }
     IntSize size() const { return m_size; }
     MediaSample::VideoRotation rotation() const { return m_rotation; }
+    bool mirrored() const { return m_mirrored; }
 
     template<class Encoder> void encode(Encoder& encoder) const
     {

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h (257469 => 257470)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h	2020-02-26 15:29:35 UTC (rev 257470)
@@ -40,6 +40,8 @@
 
 namespace WebCore {
 
+class RemoteVideoSample;
+
 class ImageTransferSessionVT {
 public:
     static std::unique_ptr<ImageTransferSessionVT> create(uint32_t pixelFormat)
@@ -53,6 +55,7 @@
 
 #if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
     WEBCORE_EXPORT RefPtr<MediaSample> createMediaSample(IOSurfaceRef, const MediaTime&, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
+    WEBCORE_EXPORT RefPtr<MediaSample> createMediaSample(const RemoteVideoSample&);
 #endif
 
 #if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm (257469 => 257470)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2020-02-26 15:29:35 UTC (rev 257470)
@@ -31,6 +31,7 @@
 #import "GraphicsContextCG.h"
 #import "Logging.h"
 #import "MediaSampleAVFObjC.h"
+#import "RemoteVideoSample.h"
 #import <CoreMedia/CMFormatDescription.h>
 #import <CoreMedia/CMSampleBuffer.h>
 
@@ -367,6 +368,11 @@
 }
 
 #if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+RefPtr<MediaSample> ImageTransferSessionVT::createMediaSample(const RemoteVideoSample& remoteSample)
+{
+    return createMediaSample(remoteSample.surface(), remoteSample.time(), remoteSample.size(), remoteSample.rotation(), remoteSample.mirrored());
+}
+
 RefPtr<MediaSample> ImageTransferSessionVT::createMediaSample(IOSurfaceRef surface, const MediaTime& sampleTime, const IntSize& size, MediaSample::VideoRotation rotation, bool mirrored)
 {
     auto sampleBuffer = createCMSampleBuffer(surface, sampleTime, size);

Modified: trunk/Source/WebKit/ChangeLog (257469 => 257470)


--- trunk/Source/WebKit/ChangeLog	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebKit/ChangeLog	2020-02-26 15:29:35 UTC (rev 257470)
@@ -1,3 +1,19 @@
+2020-02-26  Youenn Fablet  <[email protected]>
+
+        Conversion between MediaSample and RemoteVideoSample should preserve the rotation information
+        https://bugs.webkit.org/show_bug.cgi?id=208240
+
+        Reviewed by Eric Carlson.
+
+        Use new routine that preserves rotation.
+
+        * GPUProcess/webrtc/RemoteMediaRecorder.cpp:
+        (WebKit::RemoteMediaRecorder::videoSampleAvailable):
+        * GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
+        (WebKit::RemoteSampleBufferDisplayLayer::enqueueSample):
+        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable):
+
 2020-02-26  Antti Koivisto  <[email protected]>
 
         Remove throttling code from RenderLayerCompositor

Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp (257469 => 257470)


--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp	2020-02-26 15:29:35 UTC (rev 257470)
@@ -111,7 +111,7 @@
         return;
     }
 
-    auto sampleBuffer = m_imageTransferSession->createMediaSample(remoteSample.surface(), remoteSample.time(), remoteSample.size());
+    auto sampleBuffer = m_imageTransferSession->createMediaSample(remoteSample);
     if (!sampleBuffer) {
         ASSERT_NOT_REACHED();
         return;

Modified: trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp (257469 => 257470)


--- trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp	2020-02-26 15:29:35 UTC (rev 257470)
@@ -107,7 +107,7 @@
     if (!m_imageTransferSession)
         return;
 
-    auto sample = m_imageTransferSession->createMediaSample(remoteSample.surface(), remoteSample.time(), remoteSample.size());
+    auto sample = m_imageTransferSession->createMediaSample(remoteSample);
 
     ASSERT(sample);
     if (!sample)

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp (257469 => 257470)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2020-02-26 15:05:13 UTC (rev 257469)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2020-02-26 15:29:35 UTC (rev 257470)
@@ -181,7 +181,7 @@
             return;
         }
 
-        auto sampleRef = m_imageTransferSession->createMediaSample(remoteSample.surface(), remoteSample.time(), remoteSample.size());
+        auto sampleRef = m_imageTransferSession->createMediaSample(remoteSample);
         if (!sampleRef) {
             ASSERT_NOT_REACHED();
             return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to