Title: [263931] trunk/Source
Revision
263931
Author
[email protected]
Date
2020-07-04 02:18:47 -0700 (Sat, 04 Jul 2020)

Log Message

Enable VTB required low latency code path
https://bugs.webkit.org/show_bug.cgi?id=210609
<rdar://problem/61890332>

Reviewed by Darin Adler.

Source/ThirdParty/libwebrtc:

Enable low latency mode for latest MacOS and iOS versions.
Add a boolean controlling whether to opt in that code path.
Export the setter to that boolean so that it can be controlled by a WebCore runtime flag.

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:
* Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
* Source/webrtc/sdk/WebKit/WebKitEncoder.mm:
(webrtc::setH264LowLatencyEncoderEnabled):
(webrtc::isH264LowLatencyEncoderEnabled):
* Source/webrtc/sdk/WebKit/WebKitUtilities.h:
* Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
(-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):

Source/WebCore:

Add new runtime flag for the low latency code path.
Call webrtc newly introduced setter whenever creating a new encoder factory.
Manually tested.

* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCH264LowLatencyEncoderEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCH264LowLatencyEncoderEnabled):
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
(WebCore::LibWebRTCProviderCocoa::createEncoderFactory):

Source/WebKit:

Add a runtime flag to enable/disable the low latency code path.

* Shared/WebPreferences.yaml:

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (263930 => 263931)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-07-04 09:18:47 UTC (rev 263931)
@@ -1,3 +1,26 @@
+2020-07-04  Youenn Fablet  <[email protected]>
+
+        Enable VTB required low latency code path
+        https://bugs.webkit.org/show_bug.cgi?id=210609
+        <rdar://problem/61890332>
+
+        Reviewed by Darin Adler.
+
+        Enable low latency mode for latest MacOS and iOS versions.
+        Add a boolean controlling whether to opt in that code path.
+        Export the setter to that boolean so that it can be controlled by a WebCore runtime flag.
+
+        * Configurations/libwebrtc.iOS.exp:
+        * Configurations/libwebrtc.iOSsim.exp:
+        * Configurations/libwebrtc.mac.exp:
+        * Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h:
+        * Source/webrtc/sdk/WebKit/WebKitEncoder.mm:
+        (webrtc::setH264LowLatencyEncoderEnabled):
+        (webrtc::isH264LowLatencyEncoderEnabled):
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
+        * Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm:
+        (-[RTCVideoEncoderH264 resetCompressionSessionWithPixelFormat:]):
+
 2020-07-03  Youenn Fablet  <[email protected]>
 
         Allow registering VP9 as a VT decoder

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (263930 => 263931)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2020-07-04 09:18:47 UTC (rev 263931)
@@ -107,6 +107,7 @@
 __ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
 __ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
 __ZN6webrtc29setH264HardwareEncoderAllowedEb
+__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
 __ZN6webrtc24registerWebKitVP9DecoderEv
 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
 __ZN6webrtc18pixelBufferToFrameEP10__CVBuffer

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (263930 => 263931)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2020-07-04 09:18:47 UTC (rev 263931)
@@ -107,6 +107,7 @@
 __ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
 __ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
 __ZN6webrtc29setH264HardwareEncoderAllowedEb
+__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
 __ZN6webrtc24registerWebKitVP9DecoderEv
 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
 __ZN6webrtc18pixelBufferToFrameEP10__CVBuffer

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (263930 => 263931)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2020-07-04 09:18:47 UTC (rev 263931)
@@ -107,6 +107,7 @@
 __ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
 __ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
 __ZN6webrtc29setH264HardwareEncoderAllowedEb
+__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
 __ZN6webrtc24registerWebKitVP9DecoderEv
 __ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
 __ZN6webrtc18pixelBufferToFrameEP10__CVBuffer

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VideoProcessingSoftLink.h	2020-07-04 09:18:47 UTC (rev 263931)
@@ -39,9 +39,11 @@
 #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
 #elif (defined(TARGET_OS_MAC) && TARGET_OS_MAC)
 #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

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitEncoder.mm (263930 => 263931)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitEncoder.mm	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitEncoder.mm	2020-07-04 09:18:47 UTC (rev 263931)
@@ -119,6 +119,17 @@
     return h264HardwareEncoderAllowed;
 }
 
+static bool h264LowLatencyEncoderEnabled = false;
+void setH264LowLatencyEncoderEnabled(bool enabled)
+{
+    h264LowLatencyEncoderEnabled = enabled;
+}
+
+bool isH264LowLatencyEncoderEnabled()
+{
+    return h264LowLatencyEncoderEnabled;
+}
+
 std::unique_ptr<VideoEncoder> VideoEncoderFactoryWithSimulcast::CreateVideoEncoder(const SdpVideoFormat& format)
 {
     return std::make_unique<EncoderSimulcastProxy>(m_internalEncoderFactory.get(), format);

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h (263930 => 263931)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2020-07-04 09:18:47 UTC (rev 263931)
@@ -51,6 +51,9 @@
 void setH264HardwareEncoderAllowed(bool);
 bool isH264HardwareEncoderAllowed();
 
+void setH264LowLatencyEncoderEnabled(bool);
+bool isH264LowLatencyEncoderEnabled();
+
 CVPixelBufferRef pixelBufferFromFrame(const VideoFrame&, const std::function<CVPixelBufferRef(size_t, size_t)>&);
 rtc::scoped_refptr<webrtc::VideoFrameBuffer> pixelBufferToFrame(CVPixelBufferRef);
 

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoEncoderH264.mm	2020-07-04 09:18:47 UTC (rev 263931)
@@ -45,6 +45,7 @@
 #import <dlfcn.h>
 #import <objc/runtime.h>
 
+VT_EXPORT const CFStringRef kVTVideoEncoderSpecification_RequiredLowLatency;
 VT_EXPORT const CFStringRef kVTVideoEncoderSpecification_Usage;
 VT_EXPORT const CFStringRef kVTCompressionPropertyKey_Usage;
 
@@ -699,7 +700,8 @@
 #endif
   }
 #elif HAVE_VTB_REQUIREDLOWLATENCY
-  CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
+  if (webrtc::isH264LowLatencyEncoderEnabled())
+    CFDictionarySetValue(encoderSpecs, kVTVideoEncoderSpecification_RequiredLowLatency, kCFBooleanTrue);
 #endif
 
   OSStatus status =

Modified: trunk/Source/WebCore/ChangeLog (263930 => 263931)


--- trunk/Source/WebCore/ChangeLog	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/WebCore/ChangeLog	2020-07-04 09:18:47 UTC (rev 263931)
@@ -1,3 +1,21 @@
+2020-07-04  Youenn Fablet  <[email protected]>
+
+        Enable VTB required low latency code path
+        https://bugs.webkit.org/show_bug.cgi?id=210609
+        <rdar://problem/61890332>
+
+        Reviewed by Darin Adler.
+
+        Add new runtime flag for the low latency code path.
+        Call webrtc newly introduced setter whenever creating a new encoder factory.
+        Manually tested.
+
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::webRTCH264LowLatencyEncoderEnabled const):
+        (WebCore::RuntimeEnabledFeatures::setWebRTCH264LowLatencyEncoderEnabled):
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
+        (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
+
 2020-07-03  Youenn Fablet  <[email protected]>
 
         MediaRecorder should support peer connection remote video tracks

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (263930 => 263931)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-07-04 09:18:47 UTC (rev 263931)
@@ -243,6 +243,8 @@
     void setWebRTCH265CodecEnabled(bool isEnabled) { m_isWebRTCH265CodecEnabled = isEnabled; }
     bool webRTCVP9CodecEnabled() const { return m_isWebRTCVP9CodecEnabled; }
     void setWebRTCVP9CodecEnabled(bool isEnabled) { m_isWebRTCVP9CodecEnabled = isEnabled; }
+    bool webRTCH264LowLatencyEncoderEnabled() const { return m_isWebRTCH264LowLatencyEncoderEnabled; }
+    void setWebRTCH264LowLatencyEncoderEnabled(bool isEnabled) { m_isWebRTCH264LowLatencyEncoderEnabled = isEnabled; }
     bool peerConnectionEnabled() const { return m_isPeerConnectionEnabled; }
     void setPeerConnectionEnabled(bool isEnabled) { m_isPeerConnectionEnabled = isEnabled; }
     bool webRTCMDNSICECandidatesEnabled() const { return m_isWebRTCMDNSICECandidatesEnabled; }
@@ -513,6 +515,7 @@
     bool m_isWebRTCPlatformCodecsInGPUProcessEnabled { false };
     bool m_isWebRTCH265CodecEnabled { false };
     bool m_isWebRTCVP9CodecEnabled { false };
+    bool m_isWebRTCH264LowLatencyEncoderEnabled { false };
 #endif
 
 #if ENABLE(LEGACY_CSS_VENDOR_PREFIXES)

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp (263930 => 263931)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp	2020-07-04 09:18:47 UTC (rev 263931)
@@ -28,6 +28,8 @@
 
 #if USE(LIBWEBRTC)
 
+#include "RuntimeEnabledFeatures.h"
+
 ALLOW_UNUSED_PARAMETERS_BEGIN
 #include <webrtc/sdk/WebKit/WebKitUtilities.h>
 ALLOW_UNUSED_PARAMETERS_END
@@ -64,6 +66,7 @@
 {
     ASSERT(isMainThread());
 
+    webrtc::setH264LowLatencyEncoderEnabled(RuntimeEnabledFeatures::sharedFeatures().webRTCH264LowLatencyEncoderEnabled());
     return webrtc::createWebKitEncoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off);
 }
 

Modified: trunk/Source/WebKit/ChangeLog (263930 => 263931)


--- trunk/Source/WebKit/ChangeLog	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/WebKit/ChangeLog	2020-07-04 09:18:47 UTC (rev 263931)
@@ -1,3 +1,15 @@
+2020-07-04  Youenn Fablet  <[email protected]>
+
+        Enable VTB required low latency code path
+        https://bugs.webkit.org/show_bug.cgi?id=210609
+        <rdar://problem/61890332>
+
+        Reviewed by Darin Adler.
+
+        Add a runtime flag to enable/disable the low latency code path.
+
+        * Shared/WebPreferences.yaml:
+
 2020-07-03  Youenn Fablet  <[email protected]>
 
         MediaRecorder should support peer connection remote video tracks

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (263930 => 263931)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2020-07-04 06:42:10 UTC (rev 263930)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2020-07-04 09:18:47 UTC (rev 263931)
@@ -597,6 +597,15 @@
   webcoreBinding: RuntimeEnabledFeatures
   condition: ENABLE(MEDIA_STREAM)
 
+WebRTCH264LowLatencyEncoderEnabled:
+  type: bool
+  defaultValue: false
+  webcoreBinding: RuntimeEnabledFeatures
+  condition: ENABLE(WEB_RTC)
+  humanReadableName: "WebRTC H264 LowLatency encoder"
+  humanReadableDescription: "Enable H264 LowLatency encoder"
+  category: experimental
+
 WebRTCH265CodecEnabled:
   type: bool
   defaultValue: false
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to