Title: [259337] trunk/Source/ThirdParty/libwebrtc
Revision
259337
Author
you...@apple.com
Date
2020-04-01 00:54:05 -0700 (Wed, 01 Apr 2020)

Log Message

Use kVTVideoEncoderSpecification_RequiredLowLatency instead of kVTVideoEncoderList_EncoderID
https://bugs.webkit.org/show_bug.cgi?id=209800

Reviewed by Eric Carlson.

For recent OS versions, disable use of VCP.
Instead, use VTB compression session with kVTVideoEncoderSpecification_RequiredLowLatency set to true.
We keep MacOS code path checking frame size for public builds running on devices without hardware encoders.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
(isStandardFrameSize): Deleted.

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (259336 => 259337)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-04-01 03:19:45 UTC (rev 259336)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-04-01 07:54:05 UTC (rev 259337)
@@ -1,3 +1,20 @@
+2020-04-01  Youenn Fablet  <you...@apple.com>
+
+        Use kVTVideoEncoderSpecification_RequiredLowLatency instead of kVTVideoEncoderList_EncoderID
+        https://bugs.webkit.org/show_bug.cgi?id=209800
+
+        Reviewed by Eric Carlson.
+
+        For recent OS versions, disable use of VCP.
+        Instead, use VTB compression session with kVTVideoEncoderSpecification_RequiredLowLatency set to true.
+        We keep MacOS code path checking frame size for public builds running on devices without hardware encoders.
+
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
+        (-[RTCVideoEncoderH264 encode:codecSpecificInfo:frameTypes:]):
+        (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+        (isStandardFrameSize): Deleted.
+
 2020-03-27  youenn fablet  <you...@apple.com>
 
         Bump boringssl version to M82

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2020-04-01 03:19:45 UTC (rev 259336)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2020-04-01 07:54:05 UTC (rev 259337)
@@ -37,11 +37,13 @@
 #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_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
+#define ENABLE_VCP_ENCODER __IPHONE_OS_VERSION_MIN_REQUIRED < 140000
+#define ENABLE_VCP_VTB_ENCODER __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 && __IPHONE_OS_VERSION_MIN_REQUIRED < 140000
+#define HAVE_VTB_REQUIREDLOWLATENCY __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000
 #elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
-#define ENABLE_VCP_ENCODER 1
-#define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
+#define ENABLE_VCP_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED < 101600
+#define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 && __MAC_OS_X_VERSION_MIN_REQUIRED < 101600
+#define HAVE_VTB_REQUIREDLOWLATENCY __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600
 #endif
 
 #endif
@@ -52,6 +54,9 @@
 #if !defined(ENABLE_VCP_VTB_ENCODER)
 #define ENABLE_VCP_VTB_ENCODER 0
 #endif
+#if !defined(HAVE_VTB_REQUIREDLOWLATENCY)
+#define HAVE_VTB_REQUIREDLOWLATENCY 0
+#endif
 
 #if !defined(ALWAYS_INLINE)
 #define ALWAYS_INLINE inline

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2020-04-01 03:19:45 UTC (rev 259336)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2020-04-01 07:54:05 UTC (rev 259337)
@@ -48,7 +48,7 @@
 VT_EXPORT const CFStringRef kVTVideoEncoderSpecification_Usage;
 VT_EXPORT const CFStringRef kVTCompressionPropertyKey_Usage;
 
-#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && !ENABLE_VCP_ENCODER
+#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) && !HAVE_VTB_REQUIREDLOWLATENCY
 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.
@@ -561,7 +561,7 @@
                                                     nullptr);
   } else {
 #if ENABLE_VCP_ENCODER
-  status = webrtc::VCPCompressionSessionEncodeFrame(_vcpCompressionSession,
+    status = webrtc::VCPCompressionSessionEncodeFrame(_vcpCompressionSession,
                                                     pixelBuffer,
                                                     presentationTimeStamp,
                                                     kCMTimeInvalid,
@@ -715,12 +715,12 @@
     auto usage = CFNumberCreate(nullptr, kCFNumberIntType, &usageValue);
     CFDictionarySetValue(encoderSpecs, kVTCompressionPropertyKey_Usage, usage);
     CFRelease(usage);
-  }
-#endif
 #if ENABLE_VCP_VTB_ENCODER
-  if (_useVCP) {
     CFDictionarySetValue(encoderSpecs, kVTVideoEncoderList_EncoderID, CFSTR("com.apple.videotoolbox.videoencoder.h264.rtvc"));
+#endif
   }
+#elif HAVE_VTB_REQUIREDLOWLATENCY
+  CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
 #endif
 
   OSStatus status =
@@ -768,7 +768,7 @@
                                nullptr,
                                &_vcpCompressionSession);
   }
-#else
+#elif !HAVE_VTB_REQUIREDLOWLATENCY
   if (status != noErr) {
     if (encoderSpecs) {
         CFRelease(encoderSpecs);
@@ -831,7 +831,7 @@
                                  nullptr,
                                  &_vtCompressionSession);
   }
-#endif // ENABLE_VCP_ENCODER
+#endif // !HAVE_VTB_REQUIREDLOWLATENCY
 #endif // defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
   if (sourceAttributes) {
     CFRelease(sourceAttributes);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to