Title: [230227] trunk/Source
Revision
230227
Author
you...@apple.com
Date
2018-04-03 17:44:24 -0700 (Tue, 03 Apr 2018)

Log Message

RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
https://bugs.webkit.org/show_bug.cgi?id=184281
rdar://problem/39153262

Reviewed by Jer Noble.

Source/ThirdParty/libwebrtc:

Introduce a routine to create the wrapper around native pixel buffers as expected by the new libwebrtc H264 encoder.

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:
* Source/webrtc/sdk/WebKit/WebKitUtilities.h:
* Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
(webrtc::pixelBufferToFrame):

Source/WebCore:

Covered by manual testing by going to WebRTC web sites.

* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-04-04 00:44:24 UTC (rev 230227)
@@ -1,3 +1,20 @@
+2018-04-03  Youenn Fablet  <you...@apple.com>
+
+        RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
+        https://bugs.webkit.org/show_bug.cgi?id=184281
+        rdar://problem/39153262
+
+        Reviewed by Jer Noble.
+
+        Introduce a routine to create the wrapper around native pixel buffers as expected by the new libwebrtc H264 encoder.
+
+        * Configurations/libwebrtc.iOS.exp:
+        * Configurations/libwebrtc.iOSsim.exp:
+        * Configurations/libwebrtc.mac.exp:
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
+        (webrtc::pixelBufferToFrame):
+
 2018-04-02  Alejandro G. Castro  <a...@igalia.com>
 
         Unreviewed fixing GTK port X86 32bits compilation after r230152.

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2018-04-04 00:44:24 UTC (rev 230227)
@@ -130,3 +130,4 @@
 __ZN6webrtc32createVideoToolboxEncoderFactoryEv
 __ZN6webrtc29setH264HardwareEncoderAllowedEb
 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameE
+__ZN6webrtc18pixelBufferToFrameEP10__CVBuffer

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2018-04-04 00:44:24 UTC (rev 230227)
@@ -130,3 +130,4 @@
 __ZN6webrtc32createVideoToolboxEncoderFactoryEv
 __ZN6webrtc29setH264HardwareEncoderAllowedEb
 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameE
+__ZN6webrtc18pixelBufferToFrameEP10__CVBuffer

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2018-04-04 00:44:24 UTC (rev 230227)
@@ -131,3 +131,4 @@
 __ZN6webrtc32createVideoToolboxEncoderFactoryEv
 __ZN6webrtc29setH264HardwareEncoderAllowedEb
 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameE
+__ZN6webrtc18pixelBufferToFrameEP10__CVBuffer

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2018-04-04 00:44:24 UTC (rev 230227)
@@ -26,6 +26,8 @@
 #pragma once
 
 #include "api/video_codecs/video_encoder_factory.h"
+#include "api/video/video_frame_buffer.h"
+#include "rtc_base/scoped_ref_ptr.h"
 
 typedef struct __CVBuffer* CVPixelBufferRef;
 
@@ -44,5 +46,6 @@
 bool isH264HardwareEncoderAllowed();
 
 CVPixelBufferRef pixelBufferFromFrame(const VideoFrame&);
+rtc::scoped_refptr<webrtc::VideoFrameBuffer> pixelBufferToFrame(CVPixelBufferRef);
 
 }

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm	2018-04-04 00:44:24 UTC (rev 230227)
@@ -117,6 +117,12 @@
     return h264HardwareEncoderAllowed;
 }
 
+rtc::scoped_refptr<webrtc::VideoFrameBuffer> pixelBufferToFrame(CVPixelBufferRef pixelBuffer)
+{
+    RTCCVPixelBuffer *frameBuffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer: pixelBuffer];
+    return new rtc::RefCountedObject<webrtc::ObjCFrameBuffer>(frameBuffer);
+}
+
 CVPixelBufferRef pixelBufferFromFrame(const VideoFrame& frame)
 {
     auto buffer = frame.video_frame_buffer();

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/Video/objc_frame_buffer.mm (230226 => 230227)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/Video/objc_frame_buffer.mm	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/Video/objc_frame_buffer.mm	2018-04-04 00:44:24 UTC (rev 230227)
@@ -50,7 +50,10 @@
 ObjCFrameBuffer::ObjCFrameBuffer(id<RTCVideoFrameBuffer> frame_buffer)
     : frame_buffer_(frame_buffer), width_(frame_buffer.width), height_(frame_buffer.height) {}
 
-ObjCFrameBuffer::~ObjCFrameBuffer() {}
+ObjCFrameBuffer::~ObjCFrameBuffer() {
+    // FIXME: Activate ARC.
+    [frame_buffer_ release];
+}
 
 VideoFrameBuffer::Type ObjCFrameBuffer::type() const {
   return Type::kNative;

Modified: trunk/Source/WebCore/ChangeLog (230226 => 230227)


--- trunk/Source/WebCore/ChangeLog	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/WebCore/ChangeLog	2018-04-04 00:44:24 UTC (rev 230227)
@@ -1,3 +1,16 @@
+2018-04-03  Youenn Fablet  <you...@apple.com>
+
+        RealtimeOutgoingVideoSourceMac should pass a ObjCFrameBuffer buffer
+        https://bugs.webkit.org/show_bug.cgi?id=184281
+        rdar://problem/39153262
+
+        Reviewed by Jer Noble.
+
+        Covered by manual testing by going to WebRTC web sites.
+
+        * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
+        (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
+
 2018-04-03  Filip Pizlo  <fpi...@apple.com>
 
         GC shouldn't do object distancing

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp (230226 => 230227)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp	2018-04-03 23:52:09 UTC (rev 230226)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp	2018-04-04 00:44:24 UTC (rev 230227)
@@ -31,6 +31,7 @@
 #include "Logging.h"
 #include <webrtc/api/video/i420_buffer.h>
 #include <webrtc/common_video/libyuv/include/webrtc_libyuv.h>
+#include <webrtc/sdk/WebKit/WebKitUtilities.h>
 #include <webrtc/sdk/objc/Framework/Classes/Video/corevideo_frame_buffer.h>
 #include <pal/cf/CoreMediaSoftLink.h>
 #include "CoreVideoSoftLink.h"
@@ -147,7 +148,7 @@
     auto pixelFormatType = CVPixelBufferGetPixelFormatType(pixelBuffer);
 
     if (pixelFormatType == kCVPixelFormatType_420YpCbCr8Planar || pixelFormatType == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
-        rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer = new rtc::RefCountedObject<webrtc::CoreVideoFrameBuffer>(pixelBuffer);
+        rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer = webrtc::pixelBufferToFrame(pixelBuffer);
         if (m_shouldApplyRotation && m_currentRotation != webrtc::kVideoRotation_0) {
             // FIXME: We should make AVVideoCaptureSource handle the rotation whenever possible.
             // This implementation is inefficient, we should rotate on the CMSampleBuffer directly instead of doing this double allocation.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to