Title: [231265] trunk/Source/ThirdParty/libwebrtc
Revision
231265
Author
[email protected]
Date
2018-05-02 14:38:04 -0700 (Wed, 02 May 2018)

Log Message

Disable VCP for iOS until it is fully working
https://bugs.webkit.org/show_bug.cgi?id=185201
<rdar://problem/39773857>

Reviewed by Eric Carlson.

Disable VCP for iOS unconditionally.
Add check to getkVTVideoEncoderSpecification_Usage to not set this property if not defined as it is optional soft linked.
Replace use of VTSessionSetProperty by CompressionSessionSetProperty as the latter is a macro
that works for both VT and VCP.

* Source/webrtc/sdk/WebKit/EncoderUtilities.h:
* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
(-[RTCVideoEncoderH264 configureCompressionSession]):
(-[RTCVideoEncoderH264 setEncoderBitrateBps:]):
(-[RTCVideoEncoderH264 frameWasEncoded:flags:sampleBuffer:codecSpecificInfo:width:height:renderTimeMs:timestamp:rotation:]):
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc:
* Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h:

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (231264 => 231265)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-05-02 21:17:58 UTC (rev 231264)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-05-02 21:38:04 UTC (rev 231265)
@@ -1,3 +1,26 @@
+2018-05-02  Youenn Fablet  <[email protected]>
+
+        Disable VCP for iOS until it is fully working
+        https://bugs.webkit.org/show_bug.cgi?id=185201
+        <rdar://problem/39773857>
+
+        Reviewed by Eric Carlson.
+
+        Disable VCP for iOS unconditionally.
+        Add check to getkVTVideoEncoderSpecification_Usage to not set this property if not defined as it is optional soft linked.
+        Replace use of VTSessionSetProperty by CompressionSessionSetProperty as the latter is a macro
+        that works for both VT and VCP.
+
+        * Source/webrtc/sdk/WebKit/EncoderUtilities.h:
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm:
+        (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+        (-[RTCVideoEncoderH264 configureCompressionSession]):
+        (-[RTCVideoEncoderH264 setEncoderBitrateBps:]):
+        (-[RTCVideoEncoderH264 frameWasEncoded:flags:sampleBuffer:codecSpecificInfo:width:height:renderTimeMs:timestamp:rotation:]):
+        * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc:
+        * Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h:
+
 2018-04-30  Youenn Fablet  <[email protected]>
 
         Mandate H264 hardware encoder for Mac in libwebrtc

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/EncoderUtilities.h (231264 => 231265)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/EncoderUtilities.h	2018-05-02 21:17:58 UTC (rev 231264)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/EncoderUtilities.h	2018-05-02 21:38:04 UTC (rev 231265)
@@ -40,7 +40,7 @@
 #else
 
 #define CompressionSessionRef VTCompressionSessionRef
-#define CompressionSessionSetProperty VTCompressionSessionSetProperty
+#define CompressionSessionSetProperty VTSessionSetProperty
 #define CompressionSessionGetPixelBufferPool VTCompressionSessionGetPixelBufferPool
 #define CompressionSessionEncodeFrame VTCompressionSessionEncodeFrame
 #define CompressionSessionCreate VTCompressionSessionCreate

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2018-05-02 21:17:58 UTC (rev 231264)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2018-05-02 21:38:04 UTC (rev 231265)
@@ -36,7 +36,7 @@
 #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 (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110300)
+#define ENABLE_VCP_ENCODER 0
 #elif (defined(TARGET_OS_MAC)  && TARGET_OS_MAC)
 #define ENABLE_VCP_ENCODER (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101304)
 #endif

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm (231264 => 231265)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm	2018-05-02 21:17:58 UTC (rev 231264)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm	2018-05-02 21:38:04 UTC (rev 231265)
@@ -612,8 +612,8 @@
   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.
-  CFTypeRef sessionKeys[] = {kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kVTCompressionPropertyKey_RealTime };
-  CFTypeRef sessionValues[] = {  useHardwareEncoder, useHardwareEncoder, kCFBooleanTrue };
+  CFTypeRef sessionKeys[] = { kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kVTCompressionPropertyKey_RealTime };
+  CFTypeRef sessionValues[] = { useHardwareEncoder, useHardwareEncoder, kCFBooleanTrue };
   encoderSpecs = CFDictionaryCreate(kCFAllocatorDefault, sessionKeys, sessionValues, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
 #endif
   OSStatus status =
@@ -738,7 +738,8 @@
   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_ProfileLevel, _profile);
   SetVTSessionProperty(_compressionSession, kVTCompressionPropertyKey_AllowFrameReordering, false);
 #if ENABLE_VCP_ENCODER
-  SetVTSessionProperty(_compressionSession, (__bridge CFStringRef)getkVTVideoEncoderSpecification_Usage(), 1);
+  if (auto key = getkVTVideoEncoderSpecification_Usage())
+      SetVTSessionProperty(_compressionSession, (__bridge CFStringRef)key, 1);
 #endif
   [self setEncoderBitrateBps:_targetBitrateBps];
   // TODO(tkchin): Look at entropy mode and colorspace matrices.
@@ -787,7 +788,7 @@
         CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &oneSecondValue);
     const void *nums[2] = {bytesPerSecond, oneSecond};
     CFArrayRef dataRateLimits = CFArrayCreate(nullptr, nums, 2, &kCFTypeArrayCallBacks);
-    OSStatus status = VTSessionSetProperty(
+    OSStatus status = CompressionSessionSetProperty(
         _compressionSession, kVTCompressionPropertyKey_DataRateLimits, dataRateLimits);
     if (bytesPerSecond) {
       CFRelease(bytesPerSecond);
@@ -816,7 +817,7 @@
               timestamp:(uint32_t)timestamp
                rotation:(RTCVideoRotation)rotation {
   if (status != noErr) {
-    RTC_LOG(LS_ERROR) << "H264 encode failed.";
+    RTC_LOG(LS_ERROR) << "H264 encode failed: " << status;
     return;
   }
   if (infoFlags & kVTEncodeInfo_FrameDropped) {

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc (231264 => 231265)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc	2018-05-02 21:17:58 UTC (rev 231264)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.cc	2018-05-02 21:38:04 UTC (rev 231265)
@@ -35,56 +35,56 @@
 }
 
 // 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);
-    RTC_LOG(LS_ERROR) << "VTSessionSetProperty failed to set: " << key_string
+    RTC_LOG(LS_ERROR) << "CompressionSessionSetProperty failed to set: " << key_string
                       << " to " << value << ": " << status;
   }
 }
 
 // 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);
-    RTC_LOG(LS_ERROR) << "VTSessionSetProperty failed to set: " << key_string
+    RTC_LOG(LS_ERROR) << "CompressionSessionSetProperty failed to set: " << key_string
                       << " to " << value << ": " << status;
   }
 }
 
 // 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
+    RTC_LOG(LS_ERROR) << "CompressionSessionSetProperty failed to set: " << key_string
                       << " to " << value << ": " << status;
   }
 }
 
 // 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);
-    RTC_LOG(LS_ERROR) << "VTSessionSetProperty failed to set: " << key_string
+    RTC_LOG(LS_ERROR) << "CompressionSessionSetProperty failed to set: " << key_string
                       << " to " << val_string << ": " << status;
   }
 }

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h (231264 => 231265)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h	2018-05-02 21:17:58 UTC (rev 231264)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/Framework/Classes/VideoToolbox/helpers.h	2018-05-02 21:38:04 UTC (rev 231265)
@@ -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 @@
 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);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to