Title: [236553] trunk/Source/WebCore
Revision
236553
Author
[email protected]
Date
2018-09-27 09:45:24 -0700 (Thu, 27 Sep 2018)

Log Message

Use kCVPixelFormatType_420YpCbCr8Planar for capturing frames
https://bugs.webkit.org/show_bug.cgi?id=190014

Reviewed by Eric Carlson.

On Mac, rely on the monoplanar format which can be displayed without any issue.
Once rendering is fixed, we should change it back to biplanar as it is closer to what libwebrtc consumes.
Covered by manual testing.

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::avVideoCapturePixelBufferFormat):
(WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
(WebCore::AVVideoCaptureSource::setupCaptureSession):
(WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236552 => 236553)


--- trunk/Source/WebCore/ChangeLog	2018-09-27 16:44:49 UTC (rev 236552)
+++ trunk/Source/WebCore/ChangeLog	2018-09-27 16:45:24 UTC (rev 236553)
@@ -1,3 +1,20 @@
+2018-09-27  Youenn Fablet  <[email protected]>
+
+        Use kCVPixelFormatType_420YpCbCr8Planar for capturing frames
+        https://bugs.webkit.org/show_bug.cgi?id=190014
+
+        Reviewed by Eric Carlson.
+
+        On Mac, rely on the monoplanar format which can be displayed without any issue.
+        Once rendering is fixed, we should change it back to biplanar as it is closer to what libwebrtc consumes.
+        Covered by manual testing.
+
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::avVideoCapturePixelBufferFormat):
+        (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
+        (WebCore::AVVideoCaptureSource::setupCaptureSession):
+        (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
+
 2018-09-27  Andy Estes  <[email protected]>
 
         [Apple Pay] Support granular errors in PaymentDetailsUpdate

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (236552 => 236553)


--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2018-09-27 16:44:49 UTC (rev 236552)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2018-09-27 16:45:24 UTC (rev 236553)
@@ -114,6 +114,16 @@
 
 namespace WebCore {
 
+static inline OSType avVideoCapturePixelBufferFormat()
+{
+    // FIXME: Use preferedPixelBufferFormat() once rdar://problem/44391444 is fixed.
+#if PLATFORM(MAC)
+    return kCVPixelFormatType_420YpCbCr8Planar;
+#else
+    return preferedPixelBufferFormat();
+#endif
+}
+
 static dispatch_queue_t globaVideoCaptureSerialQueue()
 {
     static dispatch_queue_t globalQueue;
@@ -335,7 +345,7 @@
                 [device() setActiveFormat:avPreset->format.get()];
 #if PLATFORM(MAC)
                 auto settingsDictionary = @{
-                    (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(preferedPixelBufferFormat()),
+                    (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(avVideoCapturePixelBufferFormat()),
                     (__bridge NSString *)kCVPixelBufferWidthKey: @(avPreset->size.width()),
                     (__bridge NSString *)kCVPixelBufferHeightKey: @(avPreset->size.height())
                 };
@@ -444,7 +454,7 @@
     [session() addInput:videoIn.get()];
 
     m_videoOutput = adoptNS([allocAVCaptureVideoDataOutputInstance() init]);
-    auto settingsDictionary = adoptNS([[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:preferedPixelBufferFormat()], kCVPixelBufferPixelFormatTypeKey, nil]);
+    auto settingsDictionary = adoptNS([[NSMutableDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:avVideoCapturePixelBufferFormat()], kCVPixelBufferPixelFormatTypeKey, nil]);
 
     [m_videoOutput setVideoSettings:settingsDictionary.get()];
     [m_videoOutput setAlwaysDiscardsLateVideoFrames:YES];
@@ -548,7 +558,7 @@
             m_pixelBufferResizer = nullptr;
 
         if (!m_pixelBufferResizer)
-            m_pixelBufferResizer = std::make_unique<PixelBufferResizer>(m_requestedSize, preferedPixelBufferFormat());
+            m_pixelBufferResizer = std::make_unique<PixelBufferResizer>(m_requestedSize, avVideoCapturePixelBufferFormat());
     } else
         m_pixelBufferResizer = nullptr;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to