Title: [243811] trunk/Source
Revision
243811
Author
[email protected]
Date
2019-04-03 10:37:55 -0700 (Wed, 03 Apr 2019)

Log Message

Adopt new VCP SPI
https://bugs.webkit.org/show_bug.cgi?id=193357
<rdar://problem/43656651>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

       Enable VCP through VTB API with specific encoder id.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp:
* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
(webrtc::setApplicationStatus):
* Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
(-[RTCSingleVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):

Source/WebCore:

Covered by existing tests.

* testing/Internals.cpp:
(WebCore::Internals::supportsVCPEncoder):

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (243810 => 243811)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2019-04-03 17:37:55 UTC (rev 243811)
@@ -1,3 +1,20 @@
+2019-04-03  Youenn Fablet  <[email protected]>
+
+        Adopt new VCP SPI
+        https://bugs.webkit.org/show_bug.cgi?id=193357
+        <rdar://problem/43656651>
+
+        Reviewed by Eric Carlson.
+
+       Enable VCP through VTB API with specific encoder id.
+
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp:
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
+        (webrtc::setApplicationStatus):
+        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
+        (-[RTCSingleVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+
 2019-04-02  Thibault Saunier  <[email protected]>
 
         [GSteamer][WebRTC] Fix building libwebrtc on ARM

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp (243810 => 243811)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.cpp	2019-04-03 17:37:55 UTC (rev 243811)
@@ -25,7 +25,7 @@
 
 #include "VideoProcessingSoftLink.h"
 
-#if ENABLE_VCP_ENCODER
+#if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
 
 #include "rtc_base/logging.h"
 #import <dlfcn.h>
@@ -67,12 +67,16 @@
 }
 
 SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(webrtc, VideoProcessing)
+SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
 
+#endif
+
+#if ENABLE_VCP_ENCODER
+
 SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionSetProperty, OSStatus, (VCPCompressionSessionRef session, CFStringRef key, CFTypeRef value), (session, key, value))
 SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionGetPixelBufferPool, CVPixelBufferPoolRef, (VCPCompressionSessionRef session), (session))
 SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionEncodeFrame, OSStatus, (VCPCompressionSessionRef session, CVImageBufferRef buffer, CMTime timestamp, CMTime time, CFDictionaryRef dictionary, void* data, VTEncodeInfoFlags* flags), (session, buffer, timestamp, time, dictionary, data, flags))
 SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionCreate, OSStatus, (CFAllocatorRef allocator1, int32_t value1 , int32_t value2, CMVideoCodecType type, CFDictionaryRef dictionary1, CFDictionaryRef dictionary2, CFAllocatorRef allocator3, VTCompressionOutputCallback callback, void* data, VCPCompressionSessionRef* session), (allocator1, value1, value2, type, dictionary1, dictionary2, allocator3, callback, data, session))
 SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VCPCompressionSessionInvalidate, void, (VCPCompressionSessionRef session), (session))
-SOFT_LINK_FUNCTION_FOR_SOURCE(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
 
 #endif // ENABLE_VCP_ENCODER

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h (243810 => 243811)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2019-04-03 17:37:55 UTC (rev 243811)
@@ -35,10 +35,13 @@
 
 #if (defined(TARGET_IPHONE_SIMULATOR)  && TARGET_IPHONE_SIMULATOR)
 #define ENABLE_VCP_ENCODER 0
+#define ENABLE_VCP_VTB_ENCODER 0
 #elif (defined(TARGET_OS_IPHONE)  && TARGET_OS_IPHONE)
-#define ENABLE_VCP_ENCODER 1
+#define ENABLE_VCP_ENCODER __MAC_OS_X_VERSION_MAX_ALLOWED < 101500
+#define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
 #elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
-#define ENABLE_VCP_ENCODER (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)
+#define ENABLE_VCP_ENCODER (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101500)
+#define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
 #endif
 
 #endif
@@ -46,6 +49,9 @@
 #if !defined(ENABLE_VCP_ENCODER)
 #define ENABLE_VCP_ENCODER 0
 #endif
+#if !defined(ENABLE_VCP_VTB_ENCODER)
+#define ENABLE_VCP_VTB_ENCODER 0
+#endif
 
 #if !defined(ALWAYS_INLINE)
 #define ALWAYS_INLINE inline
@@ -111,12 +117,19 @@
         return pointer##name; \
     }
 
-#if ENABLE_VCP_ENCODER
+#if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
 
 #include <VideoProcessing/VideoProcessing.h>
 
 SOFT_LINK_FRAMEWORK_FOR_HEADER(webrtc, VideoProcessing)
 
+SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
+#define VPModuleInitialize softLink_VideoProcessing_VPModuleInitialize
+
+#endif
+
+#if ENABLE_VCP_ENCODER
+
 SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionSetProperty, OSStatus, (VCPCompressionSessionRef session, CFStringRef key, CFTypeRef value), (session, key, value))
 #define VCPCompressionSessionSetProperty softLink_VideoProcessing_VCPCompressionSessionSetProperty
 
@@ -132,9 +145,6 @@
 SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VCPCompressionSessionInvalidate, void, (VCPCompressionSessionRef session), (session))
 #define VCPCompressionSessionInvalidate softLink_VideoProcessing_VCPCompressionSessionInvalidate
 
-SOFT_LINK_FUNCTION_FOR_HEADER(webrtc, VideoProcessing, VPModuleInitialize, void, (), ())
-#define VPModuleInitialize softLink_VideoProcessing_VPModuleInitialize
-
 #endif // ENABLE_VCP_ENCODER
 
 #endif // __APPLE__

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm	2019-04-03 17:37:55 UTC (rev 243811)
@@ -105,7 +105,7 @@
 
 std::unique_ptr<webrtc::VideoEncoderFactory> createWebKitEncoderFactory(WebKitCodecSupport codecSupport)
 {
-#if ENABLE_VCP_ENCODER
+#if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
     static std::once_flag onceFlag;
     std::call_once(onceFlag, [] {
         webrtc::VPModuleInitialize();

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm (243810 => 243811)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2019-04-03 17:37:55 UTC (rev 243811)
@@ -40,7 +40,7 @@
 VT_EXPORT const CFStringRef kVTVideoEncoderSpecification_Usage;
 VT_EXPORT const CFStringRef kVTCompressionPropertyKey_Usage;
 
-#if !ENABLE_VCP_ENCODER && !defined(WEBRTC_IOS)
+#if !ENABLE_VCP_ENCODER && !defined(WEBRTC_IOS) && !ENABLE_VCP_VTB_ENCODER
 static inline bool isStandardFrameSize(int32_t width, int32_t height)
 {
     // FIXME: Envision relaxing this rule, something like width and height dividable by 4 or 8 should be good enough.
@@ -608,7 +608,7 @@
     CFRelease(pixelFormat);
     pixelFormat = nullptr;
   }
-  CFMutableDictionaryRef encoderSpecs = CFDictionaryCreateMutable(nullptr, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+  CFMutableDictionaryRef encoderSpecs = CFDictionaryCreateMutable(nullptr, 5, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
 #if !defined(WEBRTC_IOS)
   auto useHardwareEncoder = webrtc::isH264HardwareEncoderAllowed() ? kCFBooleanTrue : kCFBooleanFalse;
   // Currently hw accl is supported above 360p on mac, below 360p
@@ -618,12 +618,15 @@
 #endif
   CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_RealTime, kCFBooleanTrue);
 
-#if ENABLE_VCP_ENCODER
+#if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
   int usageValue = 1;
   auto usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
   CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_Usage, usage);
   CFRelease(usage);
 #endif
+#if ENABLE_VCP_VTB_ENCODER
+    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderList_EncoderID, CFSTR("com.apple.videotoolbox.videoencoder.h264.rtvc"));
+#endif
   OSStatus status =
       CompressionSessionCreate(nullptr,  // use default allocator
                                  _width,
@@ -663,7 +666,7 @@
   } else {
     RTC_LOG(LS_INFO) << "Compression session created with hw accl disabled";
 
-#if !ENABLE_VCP_ENCODER && !defined(WEBRTC_IOS)
+#if !ENABLE_VCP_ENCODER && !ENABLE_VCP_VTB_ENCODER && !defined(WEBRTC_IOS)
     if (!isStandardFrameSize(_width, _height)) {
       _disableEncoding = true;
       RTC_LOG(LS_ERROR) << "Using H264 software encoder with non standard size is not supported";

Modified: trunk/Source/WebCore/ChangeLog (243810 => 243811)


--- trunk/Source/WebCore/ChangeLog	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/WebCore/ChangeLog	2019-04-03 17:37:55 UTC (rev 243811)
@@ -1,3 +1,16 @@
+2019-04-03  Youenn Fablet  <[email protected]>
+
+        Adopt new VCP SPI
+        https://bugs.webkit.org/show_bug.cgi?id=193357
+        <rdar://problem/43656651>
+
+        Reviewed by Eric Carlson.
+
+        Covered by existing tests.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::supportsVCPEncoder):
+
 2019-04-03  Chris Dumez  <[email protected]>
 
         Remove legacy webkitRequestAnimationFrame time quirk

Modified: trunk/Source/WebCore/testing/Internals.cpp (243810 => 243811)


--- trunk/Source/WebCore/testing/Internals.cpp	2019-04-03 17:27:20 UTC (rev 243810)
+++ trunk/Source/WebCore/testing/Internals.cpp	2019-04-03 17:37:55 UTC (rev 243811)
@@ -4933,7 +4933,7 @@
 bool Internals::supportsVCPEncoder()
 {
 #if defined(ENABLE_VCP_ENCODER)
-    return ENABLE_VCP_ENCODER;
+    return ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER;
 #else
     return false;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to