Title: [277785] trunk/Source/ThirdParty/libwebrtc
Revision
277785
Author
[email protected]
Date
2021-05-20 08:49:23 -0700 (Thu, 20 May 2021)

Log Message

Enable VCP for H264 baseline
https://bugs.webkit.org/show_bug.cgi?id=224043

Reviewed by Eric Carlson.

Enable VCP for baseline past BigSur/iOS14.
Add macros and introduce _useBaseline in addition to _useVCP for that purpose.

* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 initWithCodecInfo:]):
(-[RTCVideoEncoderH264 configureCompressionSession]):

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (277784 => 277785)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2021-05-20 15:41:41 UTC (rev 277784)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2021-05-20 15:49:23 UTC (rev 277785)
@@ -1,3 +1,18 @@
+2021-05-20  Youenn Fablet  <[email protected]>
+
+        Enable VCP for H264 baseline
+        https://bugs.webkit.org/show_bug.cgi?id=224043
+
+        Reviewed by Eric Carlson.
+
+        Enable VCP for baseline past BigSur/iOS14.
+        Add macros and introduce _useBaseline in addition to _useVCP for that purpose.
+
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
+        (-[RTCVideoEncoderH264 initWithCodecInfo:]):
+        (-[RTCVideoEncoderH264 configureCompressionSession]):
+
 2021-05-11  Youenn Fablet  <[email protected]>
 
         Improve usrsctp restart handling

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2021-05-20 15:41:41 UTC (rev 277784)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2021-05-20 15:49:23 UTC (rev 277785)
@@ -34,14 +34,17 @@
 #if (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
 #define ENABLE_VCP_ENCODER 0
 #define ENABLE_VCP_VTB_ENCODER 0
+#define ENABLE_VCP_FOR_H264_BASELINE 0
 #elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
 #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
+#define ENABLE_VCP_FOR_H264_BASELINE __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000
 #elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
 #define ENABLE_VCP_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED < 110000
 #define ENABLE_VCP_VTB_ENCODER __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 && __MAC_OS_X_VERSION_MIN_REQUIRED < 110000
 #define HAVE_VTB_REQUIREDLOWLATENCY __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
+#define ENABLE_VCP_FOR_H264_BASELINE __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
 #endif
 
 #if !defined(ENABLE_VCP_ENCODER)
@@ -53,6 +56,9 @@
 #if !defined(HAVE_VTB_REQUIREDLOWLATENCY)
 #define HAVE_VTB_REQUIREDLOWLATENCY 0
 #endif
+#if !defined(ENABLE_VCP_FOR_H264_BASELINE)
+#define ENABLE_VCP_FOR_H264_BASELINE 0
+#endif
 
 #if !defined(ALWAYS_INLINE)
 #define ALWAYS_INLINE inline

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2021-05-20 15:41:41 UTC (rev 277784)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2021-05-20 15:49:23 UTC (rev 277785)
@@ -338,6 +338,7 @@
   int32_t _width;
   int32_t _height;
   bool _useVCP;
+  bool _useBaseline;
   VTCompressionSessionRef _vtCompressionSession;
   VCPCompressionSessionRef _vcpCompressionSession;
   CVPixelBufferPoolRef _pixelBufferPool;
@@ -364,12 +365,12 @@
     _packetizationMode = RTCH264PacketizationModeNonInterleaved;
     _profile_level_id =
         webrtc::H264::ParseSdpProfileLevelId([codecInfo nativeSdpVideoFormat].parameters);
-    if (_profile_level_id) {
-      auto profile = ""
-      _useVCP = [(__bridge NSString *)profile containsString: @"High"];
-    } else {
-      _useVCP = false;
-    }
+    _useBaseline = !_profile_level_id || ![(__bridge NSString *)ExtractProfile(*_profile_level_id) containsString: @"High"];
+#if ENABLE_VCP_FOR_H264_BASELINE
+    _useVCP = true;
+#else
+    _useVCP = !_useBaseline;
+#endif
     RTC_DCHECK(_profile_level_id);
     RTC_LOG(LS_INFO) << "Using profile " << CFStringToString(ExtractProfile(*_profile_level_id));
     RTC_CHECK([codecInfo.name isEqualToString:kRTCVideoCodecH264Name]);
@@ -783,7 +784,12 @@
 - (void)configureCompressionSession {
   RTC_DCHECK([self hasCompressionSession]);
   SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_RealTime, true);
-  SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_ProfileLevel, ExtractProfile(*_profile_level_id));
+#if ENABLE_VCP_FOR_H264_BASELINE
+  if (_useBaseline && _useVCP)
+    SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_ProfileLevel, kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel);
+  else
+#endif
+    SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_ProfileLevel, ExtractProfile(*_profile_level_id));
   SetVTSessionProperty(_vtCompressionSession, _vcpCompressionSession, kVTCompressionPropertyKey_AllowFrameReordering, false);
 #if ENABLE_VCP_ENCODER
   if (_useVCP) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to