Enable VCP for iOS and reenable it for MacOS
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Sep 2018 17:15:56 +0000 (17:15 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Sep 2018 17:15:56 +0000 (17:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189635
<rdar://problem/43621029>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Make sure VCP API is used to set encoding session parameters.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc:
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h:

Source/WebCore:

Covered by exsiting and modified tests.
Instead of using libwebrtc YUV frames for black frames, use CVPixelBuffer to make it efficient.
Add internal API to know whether VCP is enabled so as to make capture-webrtc test pass on all platforms.

* platform/mediastream/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
* platform/mediastream/RealtimeOutgoingVideoSource.h:
* platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
* platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
(WebCore::createBlackPixelBuffer):
(WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
(WebCore::RealtimeOutgoingVideoSourceCocoa::createBlackFrame):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
* testing/Internals.cpp:
(WebCore::Internals::supportsVCPEncoder):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html:
For platforms suppporting VCP, arbitrary size should be supported.
* webrtc/routines.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236070 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html
LayoutTests/webrtc/routines.js
Source/ThirdParty/libwebrtc/ChangeLog
Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h
Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm
Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc
Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h
Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj
Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp
Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h
Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h
Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h
Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 9fe498c..d6215dd 100644 (file)
@@ -1,3 +1,15 @@
+2018-09-17  Youenn Fablet  <youenn@apple.com>
+
+        Enable VCP for iOS and reenable it for MacOS
+        https://bugs.webkit.org/show_bug.cgi?id=189635
+        <rdar://problem/43621029>
+
+        Reviewed by Eric Carlson.
+
+        * platform/mac/webrtc/captureCanvas-webrtc-software-encoder.html:
+        For platforms suppporting VCP, arbitrary size should be supported.
+        * webrtc/routines.js:
+
 2018-09-17  Alexey Proskuryakov  <ap@apple.com>
 
         Revert https://trac.webkit.org/r235910, because the new test times out.
index b3e81af..aa2d07a 100644 (file)
@@ -53,6 +53,7 @@ var sender;
 promise_test((test) => {
     canvas0.color = "green";
     printRectangle(canvas0);
+    const shouldMatchCanvas1AfterReplaceTrack = window.internals ? internals.supportsVCPEncoder() : true;
     return new Promise((resolve, reject) => {
         createConnections((firstConnection) => {
             var stream = canvas0.captureStream();
@@ -77,9 +78,9 @@ promise_test((test) => {
     }).then(() => {
         return waitFor(200);
     }).then(() => {
-        return testCanvas("test2", canvas1, false);
+        return testCanvas("test2", canvas1, shouldMatchCanvas1AfterReplaceTrack);
     }).then(() => {
-        return testCanvas("test3", canvas0, true);
+        return testCanvas("test3", canvas0, !shouldMatchCanvas1AfterReplaceTrack);
     }).then(() => {
         return sender.replaceTrack(canvas0Track);
     }).then(() => {
index aebe26f..11499ae 100644 (file)
@@ -170,10 +170,10 @@ function isVideoBlack(canvas, video, startX, startY, grabbedWidth, grabbedHeight
     canvas.width = video.videoWidth;
     canvas.height = video.videoHeight;
     if (!grabbedHeight) {
-        startX = 0;
-        startY = 0;
-        grabbedWidth = canvas.width;
-        grabbedHeight = canvas.height;
+        startX = 10;
+        startY = 10;
+        grabbedWidth = canvas.width - 20;
+        grabbedHeight = canvas.height - 20;
     }
 
     canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
@@ -193,6 +193,8 @@ async function checkVideoBlack(expected, canvas, video, errorMessage, counter)
     if (isVideoBlack(canvas, video) === expected)
         return Promise.resolve();
 
+    if (counter === undefined)
+        counter = 0;
     if (counter > 50) {
         if (!errorMessage)
             errorMessage = "checkVideoBlack timed out expecting " + expected;
index 6274d2b..f22d923 100644 (file)
@@ -1,3 +1,19 @@
+2018-09-17  Youenn Fablet  <youenn@apple.com>
+
+        Enable VCP for iOS and reenable it for MacOS
+        https://bugs.webkit.org/show_bug.cgi?id=189635
+        <rdar://problem/43621029>
+
+        Reviewed by Eric Carlson.
+
+        Make sure VCP API is used to set encoding session parameters.
+
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
+        (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+        * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc:
+        * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h:
+
 2018-09-07  Youenn Fablet  <youenn@apple.com>
 
         Add support for unified plan transceivers
index cfa9dd6..92c7fc4 100644 (file)
 // Macro taken from WTF/wtf/Platform.h
 #if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
 
-#if (defined(TARGET_IPHONE_SIMULATOR)  && TARGET_IPHONE_SIMULATOR)
-#define ENABLE_VCP_ENCODER 0
-#elif (defined(TARGET_OS_IPHONE)  && TARGET_OS_IPHONE)
-#define ENABLE_VCP_ENCODER 0
-#elif (defined(TARGET_OS_MAC)  && TARGET_OS_MAC)
-#define ENABLE_VCP_ENCODER 0 //(__MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)
+#if (defined(TARGET_OS_IPHONE)  && TARGET_OS_IPHONE)
+#define ENABLE_VCP_ENCODER (__IPHONE_OS_VERSION_MAX_ALLOWED >= 120000)
+#elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
+#define ENABLE_VCP_ENCODER (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)
+#endif
+
 #endif
 
+#if !defined(ENABLE_VCP_ENCODER)
+#define ENABLE_VCP_ENCODER 0
 #endif
 
+#if !defined(ALWAYS_INLINE)
 #define ALWAYS_INLINE inline
+#endif
 
 #ifdef __cplusplus
 #define WTF_EXTERN_C_BEGIN extern "C" {
index d47818f..28c391a 100644 (file)
@@ -603,7 +603,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) {
     pixelFormat = nullptr;
   }
   CFDictionaryRef encoderSpecs = nullptr;
-#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
+#if (!defined(WEBRTC_IOS) || ENABLE_VCP_ENCODER)
   auto useHardwareEncoder = webrtc::isH264HardwareEncoderAllowed() ? kCFBooleanTrue : kCFBooleanFalse;
   // Currently hw accl is supported above 360p on mac, below 360p
   // the compression session will be created with hw accl disabled.
@@ -611,6 +611,7 @@ CFStringRef ExtractProfile(webrtc::SdpVideoFormat videoFormat) {
   CFTypeRef sessionValues[] = { useHardwareEncoder, useHardwareEncoder, kCFBooleanTrue };
   encoderSpecs = CFDictionaryCreate(kCFAllocatorDefault, sessionKeys, sessionValues, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
 #endif
+
   OSStatus status =
       CompressionSessionCreate(nullptr,  // use default allocator
                                  _width,
index ac957f1..46daf44 100644 (file)
@@ -35,12 +35,12 @@ std::string CFStringToString(const CFStringRef cf_string) {
 }
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session,
+void SetVTSessionProperty(CompressionSessionRef session,
                           CFStringRef key,
                           int32_t value) {
   CFNumberRef cfNum =
       CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);
-  OSStatus status = VTSessionSetProperty(session, key, cfNum);
+  OSStatus status = CompressionSessionSetProperty(session, key, cfNum);
   CFRelease(cfNum);
   if (status != noErr) {
     std::string key_string = CFStringToString(key);
@@ -50,13 +50,13 @@ void SetVTSessionProperty(VTSessionRef session,
 }
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session,
+void SetVTSessionProperty(CompressionSessionRef session,
                           CFStringRef key,
                           uint32_t value) {
   int64_t value_64 = value;
   CFNumberRef cfNum =
       CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value_64);
-  OSStatus status = VTSessionSetProperty(session, key, cfNum);
+  OSStatus status = CompressionSessionSetProperty(session, key, cfNum);
   CFRelease(cfNum);
   if (status != noErr) {
     std::string key_string = CFStringToString(key);
@@ -66,9 +66,9 @@ void SetVTSessionProperty(VTSessionRef session,
 }
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session, CFStringRef key, bool value) {
+void SetVTSessionProperty(CompressionSessionRef session, CFStringRef key, bool value) {
   CFBooleanRef cf_bool = (value) ? kCFBooleanTrue : kCFBooleanFalse;
-  OSStatus status = VTSessionSetProperty(session, key, cf_bool);
+  OSStatus status = CompressionSessionSetProperty(session, key, cf_bool);
   if (status != noErr) {
     std::string key_string = CFStringToString(key);
     RTC_LOG(LS_ERROR) << "VTSessionSetProperty failed to set: " << key_string
@@ -77,10 +77,10 @@ void SetVTSessionProperty(VTSessionRef session, CFStringRef key, bool value) {
 }
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session,
+void SetVTSessionProperty(CompressionSessionRef session,
                           CFStringRef key,
                           CFStringRef value) {
-  OSStatus status = VTSessionSetProperty(session, key, value);
+  OSStatus status = CompressionSessionSetProperty(session, key, value);
   if (status != noErr) {
     std::string key_string = CFStringToString(key);
     std::string val_string = CFStringToString(value);
index 0683ea7..0c669e8 100644 (file)
@@ -16,6 +16,8 @@
 #include <VideoToolbox/VideoToolbox.h>
 #include <string>
 
+#include "sdk/WebKit/EncoderUtilities.h"
+
 // Convenience function for creating a dictionary.
 inline CFDictionaryRef CreateCFTypeDictionary(CFTypeRef* keys,
                                               CFTypeRef* values,
@@ -29,18 +31,18 @@ inline CFDictionaryRef CreateCFTypeDictionary(CFTypeRef* keys,
 std::string CFStringToString(const CFStringRef cf_string);
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session, CFStringRef key, int32_t value);
+void SetVTSessionProperty(CompressionSessionRef session, CFStringRef key, int32_t value);
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session,
+void SetVTSessionProperty(CompressionSessionRef session,
                           CFStringRef key,
                           uint32_t value);
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session, CFStringRef key, bool value);
+void SetVTSessionProperty(CompressionSessionRef session, CFStringRef key, bool value);
 
 // Convenience function for setting a VT property.
-void SetVTSessionProperty(VTSessionRef session,
+void SetVTSessionProperty(CompressionSessionRef session,
                           CFStringRef key,
                           CFStringRef value);
 
index 8aea011..4087d23 100644 (file)
                41A392211EFC5CFA00C4516A /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 41A391EB1EFC493000C4516A /* aes.c */; };
                41AF2D13212CD6AC00D033D5 /* RTCVideoCodecH264.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEAB520630108009D5141 /* RTCVideoCodecH264.mm */; };
                41AF2D14212CD6AF00D033D5 /* RTCVideoDecoderH264.mm in Sources */ = {isa = PBXBuildFile; fileRef = 413A23F81FE1987C00373E99 /* RTCVideoDecoderH264.mm */; };
+               41BCE753214C81A800A748F1 /* VideoProcessingSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */; };
                41D6B45321273159008F9353 /* call_config.cc in Sources */ = {isa = PBXBuildFile; fileRef = 415F1FD72127313F00064CBF /* call_config.cc */; };
                41D6B45421273159008F9353 /* call_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 415F1FDA2127313F00064CBF /* call_config.h */; };
                41D6B45521273159008F9353 /* degraded_call.h in Headers */ = {isa = PBXBuildFile; fileRef = 415F1FD22127313E00064CBF /* degraded_call.h */; };
                                5C4B46E71E42AA97002651C8 /* internal.h in Headers */,
                                5C4B47411E42AAEA002651C8 /* internal.h in Headers */,
                                41A391811EFC447C00C4516A /* internal.h in Headers */,
+                               41BCE753214C81A800A748F1 /* VideoProcessingSoftLink.h in Headers */,
                                41A3917C1EFC447C00C4516A /* internal.h in Headers */,
                                41A391851EFC447C00C4516A /* internal.h in Headers */,
                                41EA53AE1EFC2C4D002FF04C /* md32_common.h in Headers */,
index 1d45d90..0f047ef 100644 (file)
@@ -1,3 +1,31 @@
+2018-09-17  Youenn Fablet  <youenn@apple.com>
+
+        Enable VCP for iOS and reenable it for MacOS
+        https://bugs.webkit.org/show_bug.cgi?id=189635
+        <rdar://problem/43621029>
+
+        Reviewed by Eric Carlson.
+
+        Covered by exsiting and modified tests.
+        Instead of using libwebrtc YUV frames for black frames, use CVPixelBuffer to make it efficient.
+        Add internal API to know whether VCP is enabled so as to make capture-webrtc test pass on all platforms.
+
+        * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
+        (WebCore::RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded):
+        * platform/mediastream/RealtimeOutgoingVideoSource.h:
+        * platform/mediastream/gstreamer/RealtimeOutgoingVideoSourceLibWebRTC.h:
+        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h:
+        * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
+        (WebCore::createBlackPixelBuffer):
+        (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
+        * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
+        (WebCore::RealtimeOutgoingVideoSourceCocoa::createBlackFrame):
+        * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::supportsVCPEncoder):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2018-09-17  Chris Dumez  <cdumez@apple.com>
 
         PSON: window.open() with 'noopener' should only process-swap cross-site, not cross-origin
index ad5f7e4..9daef79 100644 (file)
@@ -162,14 +162,12 @@ void RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded()
         auto height = m_height;
         if (m_shouldApplyRotation && (m_currentRotation == webrtc::kVideoRotation_0 || m_currentRotation == webrtc::kVideoRotation_90))
             std::swap(width, height);
-        auto frame = m_bufferPool.CreateBuffer(width, height);
-        ASSERT(frame);
-        if (!frame) {
+        m_blackFrame = createBlackFrame(width, height);
+        ASSERT(m_blackFrame);
+        if (!m_blackFrame) {
             RELEASE_LOG(WebRTC, "RealtimeOutgoingVideoSource::sendBlackFramesIfNeeded unable to send black frames");
             return;
         }
-        webrtc::I420Buffer::SetBlack(frame.get());
-        m_blackFrame = WTFMove(frame);
     }
     sendOneBlackFrame();
     m_blackFrameTimer.startRepeating(1_s);
index 8505fdc..4250599 100644 (file)
@@ -79,6 +79,8 @@ protected:
     bool m_shouldApplyRotation { false };
     webrtc::VideoRotation m_currentRotation { webrtc::kVideoRotation_0 };
 
+    virtual rtc::scoped_refptr<webrtc::VideoFrameBuffer> createBlackFrame(size_t width, size_t height) = 0;
+
 private:
     void sendBlackFramesIfNeeded();
     void sendOneBlackFrame();
index 6d36b59..1f01a25 100644 (file)
@@ -39,6 +39,8 @@ public:
 private:
     explicit RealtimeOutgoingVideoSourceLibWebRTC(Ref<MediaStreamTrackPrivate>&&);
 
+    rtc::scoped_refptr<webrtc::VideoFrameBuffer> createBlackFrame(size_t, size_t) final { return nullptr; }
+
     // MediaStreamTrackPrivate::Observer API
     void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) final;
 };
index de9892a..13bb02f 100644 (file)
@@ -57,6 +57,8 @@ private:
 #endif
 };
 
+RetainPtr<CVPixelBufferRef> createBlackPixelBuffer(size_t width, size_t height);
+
 } // namespace WebCore
 
 #endif // USE(LIBWEBRTC)
index 49cdbde..d86a59f 100644 (file)
@@ -64,7 +64,7 @@ RealtimeIncomingVideoSourceCocoa::RealtimeIncomingVideoSourceCocoa(rtc::scoped_r
 {
 }
 
-static inline CVPixelBufferRef createBlackFrame(int width, int height)
+RetainPtr<CVPixelBufferRef> createBlackPixelBuffer(size_t width, size_t height)
 {
     CVPixelBufferRef pixelBuffer = nullptr;
     auto status = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_420YpCbCr8Planar, nullptr, &pixelBuffer);
@@ -79,7 +79,7 @@ static inline CVPixelBufferRef createBlackFrame(int width, int height)
 
     status = CVPixelBufferUnlockBaseAddress(pixelBuffer, 0);
     ASSERT(!status);
-    return pixelBuffer;
+    return adoptCF(pixelBuffer);
 }
 
 CVPixelBufferRef RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame(const webrtc::VideoFrame& frame)
@@ -88,7 +88,7 @@ CVPixelBufferRef RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame(con
         if (!m_blackFrame || m_blackFrameWidth != frame.width() || m_blackFrameHeight != frame.height()) {
             m_blackFrameWidth = frame.width();
             m_blackFrameHeight = frame.height();
-            m_blackFrame = adoptCF(createBlackFrame(m_blackFrameWidth, m_blackFrameHeight));
+            m_blackFrame = createBlackPixelBuffer(m_blackFrameWidth, m_blackFrameHeight);
         }
         return m_blackFrame.get();
     }
index 795f22e..fddb5ea 100644 (file)
@@ -29,6 +29,7 @@
 #if USE(LIBWEBRTC)
 
 #include "Logging.h"
+#include "RealtimeIncomingVideoSourceCocoa.h"
 
 ALLOW_UNUSED_PARAMETERS_BEGIN
 
@@ -92,33 +93,6 @@ RealtimeOutgoingVideoSourceCocoa::RealtimeOutgoingVideoSourceCocoa(Ref<MediaStre
 {
 }
 
-static inline int ConvertToI420(webrtc::VideoType src_video_type,
-                  const uint8_t* src_frame,
-                  int crop_x,
-                  int crop_y,
-                  int src_width,
-                  int src_height,
-                  size_t sample_size,
-                  libyuv::RotationMode rotation,
-                  webrtc::I420Buffer* dst_buffer) {
-  int dst_width = dst_buffer->width();
-  int dst_height = dst_buffer->height();
-  // LibYuv expects pre-rotation values for dst.
-  // Stride values should correspond to the destination values.
-  if (rotation == libyuv::kRotate90 || rotation == libyuv::kRotate270) {
-    std::swap(dst_width, dst_height);
-  }
-  return libyuv::ConvertToI420(src_video_type,
-      src_frame, sample_size,
-      dst_buffer->MutableDataY(), dst_buffer->StrideY(),
-      dst_buffer->MutableDataU(), dst_buffer->StrideU(),
-      dst_buffer->MutableDataV(), dst_buffer->StrideV(),
-      crop_x, crop_y,
-      src_width, src_height,
-      dst_width, dst_height,
-      rotation);
-}
-
 void RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample& sample)
 {
     if (!m_sinks.size())
@@ -161,6 +135,11 @@ void RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated(MediaStreamTrackPriva
     sendFrame(webrtc::pixelBufferToFrame(convertedBuffer.get()));
 }
 
+rtc::scoped_refptr<webrtc::VideoFrameBuffer> RealtimeOutgoingVideoSourceCocoa::createBlackFrame(size_t  width, size_t  height)
+{
+    return webrtc::pixelBufferToFrame(createBlackPixelBuffer(width, height).get());
+}
+
 
 } // namespace WebCore
 
index fc3aacd..6cc5ace 100644 (file)
@@ -43,6 +43,8 @@ public:
 private:
     explicit RealtimeOutgoingVideoSourceCocoa(Ref<MediaStreamTrackPrivate>&&);
 
+    rtc::scoped_refptr<webrtc::VideoFrameBuffer> createBlackFrame(size_t width, size_t height) final;
+
     // MediaStreamTrackPrivate::Observer API
     void sampleBufferUpdated(MediaStreamTrackPrivate&, MediaSample&) final;
 
index ec2e733..2528b4b 100644 (file)
 #include "MockAuthenticatorCoordinator.h"
 #endif
 
+#if PLATFORM(MAC) && USE(LIBWEBRTC)
+#include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h>
+#endif
+
 using JSC::CallData;
 using JSC::CallType;
 using JSC::CodeBlock;
@@ -4724,4 +4728,13 @@ unsigned Internals::primaryScreenDisplayID()
 #endif
 }
 
+bool Internals::supportsVCPEncoder()
+{
+#if defined(ENABLE_VCP_ENCODER)
+    return ENABLE_VCP_ENCODER;
+#else
+    return false;
+#endif
+}
+
 } // namespace WebCore
index 9564d27..57bd245 100644 (file)
@@ -735,6 +735,8 @@ public:
     void notifyResourceLoadObserver();
 
     unsigned primaryScreenDisplayID();
+
+    bool supportsVCPEncoder();
         
 private:
     explicit Internals(Document&);
index 2184fd2..eb456cd 100644 (file)
@@ -670,4 +670,6 @@ enum CompositingPolicy {
     void notifyResourceLoadObserver();
 
     unsigned long primaryScreenDisplayID();
+
+    boolean supportsVCPEncoder();
 };