Title: [270256] trunk
Revision
270256
Author
[email protected]
Date
2020-11-30 11:36:55 -0800 (Mon, 30 Nov 2020)

Log Message

Introduce an experimental flag specific to VP9 profile 2
https://bugs.webkit.org/show_bug.cgi?id=219350

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Allow to enable profile 0 but not profile 2 for VP9 encoder and decoder.

* Source/webrtc/sdk/WebKit/WebKitDecoder.mm:
(webrtc::createWebKitDecoderFactory):
* Source/webrtc/sdk/WebKit/WebKitEncoder.mm:
(webrtc::createWebKitEncoderFactory):
* Source/webrtc/sdk/WebKit/WebKitUtilities.h:
* Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h:
* Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:
(-[RTCDefaultVideoDecoderFactory initWithH265:vp9Profile0:vp9Profile2:vp9VTB:]):
(-[RTCDefaultVideoDecoderFactory supportedCodecs]):
(-[RTCDefaultVideoDecoderFactory initWithH265:vp9:vp9VTB:]): Deleted.
* Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h:
* Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m:
(-[RTCDefaultVideoEncoderFactory initWithH265:vp9Profile0:vp9Profile2:lowLatencyH264:]):
(+[RTCDefaultVideoEncoderFactory supportedCodecs]):
(+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9Profile0:vp9Profile2:]):
(-[RTCDefaultVideoEncoderFactory supportedCodecs]):
(-[RTCDefaultVideoEncoderFactory initWithH265:vp9:lowLatencyH264:]): Deleted.
(+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9:]): Deleted.

Source/WebCore:

Introduce an experimental flag for VP9 profile 2.
Pass it to libwebrtc backend when creating codec factories.
Profile 2 support is only enabled if profile 0 support is also enabled.
Covered by updated test.

* page/Page.cpp:
(WebCore::m_shouldRelaxThirdPartyCookieBlocking):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::webRTCVP9Profile0CodecEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCVP9Profile0CodecEnabled):
(WebCore::RuntimeEnabledFeatures::webRTCVP9Profile2CodecEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCVP9Profile2CodecEnabled):
(WebCore::RuntimeEnabledFeatures::webRTCVP9CodecEnabled const): Deleted.
(WebCore::RuntimeEnabledFeatures::setWebRTCVP9CodecEnabled): Deleted.
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:
(WebCore::LibWebRTCProvider::setVP9Support):
* platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
(WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
(WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
* testing/Internals.cpp:
(WebCore::Internals::setWebRTCVP9Support):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

* webrtc/vp9-expected.txt:
* webrtc/vp9-vtb.html:
* webrtc/vp9.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (270255 => 270256)


--- trunk/LayoutTests/ChangeLog	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/LayoutTests/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1,5 +1,16 @@
 2020-11-30  Youenn Fablet  <[email protected]>
 
+        Introduce an experimental flag specific to VP9 profile 2
+        https://bugs.webkit.org/show_bug.cgi?id=219350
+
+        Reviewed by Eric Carlson.
+
+        * webrtc/vp9-expected.txt:
+        * webrtc/vp9-vtb.html:
+        * webrtc/vp9.html:
+
+2020-11-30  Youenn Fablet  <[email protected]>
+
         Missing WebRTC Metrics in iOS 14 Beta 5
         https://bugs.webkit.org/show_bug.cgi?id=215678
         <rdar://problem/67625414>

Modified: trunk/LayoutTests/webrtc/vp9-expected.txt (270255 => 270256)


--- trunk/LayoutTests/webrtc/vp9-expected.txt	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/LayoutTests/webrtc/vp9-expected.txt	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1,6 +1,7 @@
 
 
-PASS VP9 in getCapabilities
+PASS VP9 in sender getCapabilities
+PASS VP9 in receiver getCapabilities
 PASS Verify VP9 activation
 PASS Setting video exchange
 PASS Ensuring connection state is connected

Modified: trunk/LayoutTests/webrtc/vp9-vtb.html (270255 => 270256)


--- trunk/LayoutTests/webrtc/vp9-vtb.html	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/LayoutTests/webrtc/vp9-vtb.html	2020-11-30 19:36:55 UTC (rev 270256)
@@ -16,7 +16,7 @@
 let hasVP9;
 test(() => {
     if (window.internals) {
-        window.internals.setWebRTCVP9Support(true);
+        window.internals.setWebRTCVP9Support(true, true);
         window.internals.setWebRTCVP9VTBSupport(true);
     }
 

Modified: trunk/LayoutTests/webrtc/vp9.html (270255 => 270256)


--- trunk/LayoutTests/webrtc/vp9.html	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/LayoutTests/webrtc/vp9.html	2020-11-30 19:36:55 UTC (rev 270256)
@@ -13,23 +13,59 @@
         <canvas id="canvas3" width="320" height="240"></canvas>
         <script src =""
         <script>
-let hasVP9;
+let hasVP9 = false;
 test(() => {
     if (window.internals)
-        window.internals.setWebRTCVP9Support(false);
+        window.internals.setWebRTCVP9Support(false, false);
 
     let codecs = RTCRtpSender.getCapabilities("video").codecs;
-    hasVP9 = codecs.some((codec) => { return codec.mimeType == "video/VP9"; });
-    assert_false(hasVP9);
+    vp9Codecs = codecs.filter(codec => codec.mimeType === "video/VP9");
+    assert_equals(vp9Codecs.length, 0, "no vp9 codec");
 
     if (window.internals)
-        window.internals.setWebRTCVP9Support(true);
+        window.internals.setWebRTCVP9Support(true, false);
 
     codecs = RTCRtpSender.getCapabilities("video").codecs;
-    hasVP9 = codecs.some((codec) => { return codec.mimeType == "video/VP9"; });
-    assert_true(hasVP9);
-}, "VP9 in getCapabilities");
+    vp9Codecs = codecs.filter(codec => codec.mimeType === "video/VP9");
+    assert_equals(vp9Codecs.length, 1, "One vp9 codec");
+    assert_equals(vp9Codecs[0].sdpFmtpLine, "profile-id=0", "profile 0");
 
+    if (window.internals)
+        window.internals.setWebRTCVP9Support(true, true);
+
+    codecs = RTCRtpSender.getCapabilities("video").codecs;
+    vp9Codecs = codecs.filter(codec => codec.mimeType === "video/VP9");
+    assert_equals(vp9Codecs[0].sdpFmtpLine, "profile-id=0", "first codec");
+    assert_equals(vp9Codecs[1].sdpFmtpLine, "profile-id=2", "second codec");
+
+    hasVP9 = true;
+}, "VP9 in sender getCapabilities");
+
+test(() => {
+    if (window.internals)
+        window.internals.setWebRTCVP9Support(false, false);
+
+    let codecs = RTCRtpReceiver.getCapabilities("video").codecs;
+    vp9Codecs = codecs.filter(codec => codec.mimeType === "video/VP9");
+    assert_equals(vp9Codecs.length, 0, "no vp9 codec");
+
+    if (window.internals)
+        window.internals.setWebRTCVP9Support(true, false);
+
+    codecs = RTCRtpReceiver.getCapabilities("video").codecs;
+    vp9Codecs = codecs.filter(codec => codec.mimeType === "video/VP9");
+    assert_equals(vp9Codecs.length, 1, "One vp9 codec");
+    assert_equals(vp9Codecs[0].sdpFmtpLine, "profile-id=0", "profile 0");
+
+    if (window.internals)
+        window.internals.setWebRTCVP9Support(true, true);
+
+    codecs = RTCRtpReceiver.getCapabilities("video").codecs;
+    vp9Codecs = codecs.filter(codec => codec.mimeType === "video/VP9");
+    assert_equals(vp9Codecs[0].sdpFmtpLine, "profile-id=0", "first codec");
+    assert_equals(vp9Codecs[1].sdpFmtpLine, "profile-id=2", "second codec");
+}, "VP9 in receiver getCapabilities");
+
 if (hasVP9) {
     promise_test(async (test) => {
         const pc = new RTCPeerConnection();

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (270255 => 270256)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1,3 +1,31 @@
+2020-11-30  Youenn Fablet  <[email protected]>
+
+        Introduce an experimental flag specific to VP9 profile 2
+        https://bugs.webkit.org/show_bug.cgi?id=219350
+
+        Reviewed by Eric Carlson.
+
+        Allow to enable profile 0 but not profile 2 for VP9 encoder and decoder.
+
+        * Source/webrtc/sdk/WebKit/WebKitDecoder.mm:
+        (webrtc::createWebKitDecoderFactory):
+        * Source/webrtc/sdk/WebKit/WebKitEncoder.mm:
+        (webrtc::createWebKitEncoderFactory):
+        * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
+        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h:
+        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:
+        (-[RTCDefaultVideoDecoderFactory initWithH265:vp9Profile0:vp9Profile2:vp9VTB:]):
+        (-[RTCDefaultVideoDecoderFactory supportedCodecs]):
+        (-[RTCDefaultVideoDecoderFactory initWithH265:vp9:vp9VTB:]): Deleted.
+        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h:
+        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m:
+        (-[RTCDefaultVideoEncoderFactory initWithH265:vp9Profile0:vp9Profile2:lowLatencyH264:]):
+        (+[RTCDefaultVideoEncoderFactory supportedCodecs]):
+        (+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9Profile0:vp9Profile2:]):
+        (-[RTCDefaultVideoEncoderFactory supportedCodecs]):
+        (-[RTCDefaultVideoEncoderFactory initWithH265:vp9:lowLatencyH264:]): Deleted.
+        (+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9:]): Deleted.
+
 2020-11-27  Youenn Fablet  <[email protected]>
 
         RTCVideoEncoderH264 does not need to support case without ENABLE_VCP_ENCODER and without HAVE_VTB_REQUIREDLOWLATENCY

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm (270255 => 270256)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm	2020-11-30 19:36:55 UTC (rev 270256)
@@ -225,7 +225,7 @@
 
 std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265 supportsH265, WebKitVP9 supportsVP9, WebKitVP9VTB supportsVP9VTB)
 {
-    auto internalFactory = ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9: supportsVP9 == WebKitVP9::On vp9VTB: supportsVP9VTB == WebKitVP9VTB::On]);
+    auto internalFactory = ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9Profile0:supportsVP9 > WebKitVP9::Off vp9Profile2:supportsVP9 == WebKitVP9::Profile0And2 vp9VTB: supportsVP9VTB == WebKitVP9VTB::On]);
     if (videoDecoderCallbacks().createCallback)
         return std::make_unique<RemoteVideoDecoderFactory>(std::move(internalFactory));
     return internalFactory;

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitEncoder.mm	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitEncoder.mm	2020-11-30 19:36:55 UTC (rev 270256)
@@ -220,7 +220,7 @@
     });
 #endif
 
-    auto internalFactory = ObjCToNativeVideoEncoderFactory([[RTCDefaultVideoEncoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9:supportsVP9 == WebKitVP9::On lowLatencyH264:useH264LowLatency == WebKitH264LowLatency::On]);
+    auto internalFactory = ObjCToNativeVideoEncoderFactory([[RTCDefaultVideoEncoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9Profile0:supportsVP9 > WebKitVP9::Off vp9Profile2:supportsVP9 == WebKitVP9::Profile0And2 lowLatencyH264:useH264LowLatency == WebKitH264LowLatency::On]);
 
     if (videoEncoderCallbacks().createCallback)
         internalFactory = std::make_unique<RemoteVideoEncoderFactory>(std::move(internalFactory));

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


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h	2020-11-30 19:36:55 UTC (rev 270256)
@@ -36,7 +36,7 @@
 class VideoFrame;
 
 enum class WebKitH265 { Off, On };
-enum class WebKitVP9 { Off, On };
+enum class WebKitVP9 { Off, Profile0, Profile0And2 };
 enum class WebKitVP9VTB { Off, On };
 enum class WebKitH264LowLatency { Off, On };
 

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h (270255 => 270256)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h	2020-11-30 19:36:55 UTC (rev 270256)
@@ -21,7 +21,7 @@
 RTC_OBJC_EXPORT
 __attribute__((objc_runtime_name("WK_RTCDefaultVideoDecoderFactory")))
 @interface RTCDefaultVideoDecoderFactory : NSObject <RTCVideoDecoderFactory>
-- (id)initWithH265:(bool)supportH265 vp9:(bool)supportsVP9 vp9VTB:(bool)supportsVP9VTB;
+- (id)initWithH265:(bool)supportH265 vp9Profile0:(bool)supportsVP9Profile0 vp9Profile2:(bool)supportsVP9Profile2 vp9VTB:(bool)supportsVP9VTB;
 @end
 
 NS_ASSUME_NONNULL_END

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m (270255 => 270256)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m	2020-11-30 19:36:55 UTC (rev 270256)
@@ -28,18 +28,20 @@
 
 @implementation RTCDefaultVideoDecoderFactory {
   bool _supportsH265;
-  bool _supportsVP9;
+  bool _supportsVP9Profile0;
+  bool _supportsVP9Profile2;
   bool _supportsVP9VTB;
 }
 
-- (id)initWithH265:(bool)supportsH265 vp9:(bool)supportsVP9 vp9VTB:(bool)supportsVP9VTB
+- (id)initWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9Profile2:(bool)supportsVP9Profile2 vp9VTB:(bool)supportsVP9VTB
 {
   self = [super init];
   if (self) {
       _supportsH265 = supportsH265;
-      _supportsVP9 = supportsVP9;
+      _supportsVP9Profile0 = supportsVP9Profile0;
+      _supportsVP9Profile2 = supportsVP9Profile2;
       // Use kCMVideoCodecType_VP9 once added to CMFormatDescription.h
-      _supportsVP9VTB = supportsVP9 && (supportsVP9VTB || VTIsHardwareDecodeSupported('vp09'));
+      _supportsVP9VTB = (supportsVP9Profile0 || supportsVP9Profile2) && (supportsVP9VTB || VTIsHardwareDecodeSupported('vp09'));
 ;
   }
   return self;
@@ -80,11 +82,12 @@
   [codecs addObject:vp8Info];
 
 #if defined(RTC_ENABLE_VP9)
-  if (_supportsVP9) {
+  if (_supportsVP9Profile0) {
     [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
       @"profile-id" : @"0",
     }]];
-
+  }
+  if (_supportsVP9Profile2) {
     [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
       @"profile-id" : @"2",
     }]];

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h (270255 => 270256)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h	2020-11-30 19:36:55 UTC (rev 270256)
@@ -22,9 +22,9 @@
 __attribute__((objc_runtime_name("WK_RTCDefaultVideoEncoderFactory")))
 @interface RTCDefaultVideoEncoderFactory : NSObject <RTCVideoEncoderFactory>
 
-- (id)initWithH265:(bool)supportH265 vp9:(bool)supportsVP9 lowLatencyH264:(bool)useLowLatencyH264;
+- (id)initWithH265:(bool)supportH265 vp9Profile0:(bool)supportsVP9Profile0 vp9Profile2:(bool)supportsVP9Profile2 lowLatencyH264:(bool)useLowLatencyH264;
 + (NSArray<RTCVideoCodecInfo *> *)supportedCodecs;
-+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecsWithH265:(bool)supportsH265 vp9:(bool)supportsVP9;
++ (NSArray<RTCVideoCodecInfo *> *)supportedCodecsWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9Profile2:(bool)supportsVP9Profile2;
 
 @end
 

Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m (270255 => 270256)


--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m	2020-11-30 19:36:55 UTC (rev 270256)
@@ -25,26 +25,28 @@
 
 @implementation RTCDefaultVideoEncoderFactory {
   bool _supportsH265;
-  bool _supportsVP9;
+  bool _supportsVP9Profile0;
+  bool _supportsVP9Profile2;
   bool _useLowLatencyH264;
 }
 
-- (id)initWithH265:(bool)supportsH265 vp9:(bool)supportsVP9 lowLatencyH264:(bool)useLowLatencyH264
+- (id)initWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9Profile2:(bool)supportsVP9Profile2 lowLatencyH264:(bool)useLowLatencyH264
 {
   self = [super init];
   if (self) {
-      _supportsH265 = supportsH265;
-      _supportsVP9 = supportsVP9;
-      _useLowLatencyH264 = useLowLatencyH264;
+    _supportsH265 = supportsH265;
+    _supportsVP9Profile0 = supportsVP9Profile0;
+    _supportsVP9Profile2 = supportsVP9Profile2;
+    _useLowLatencyH264 = useLowLatencyH264;
   }
   return self;
 }
 
 + (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
-    return [self supportedCodecsWithH265:true vp9:true];
+    return [self supportedCodecsWithH265:true vp9Profile0:true vp9Profile2:true];
 }
 
-+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecsWithH265:(bool)supportsH265 vp9:(bool)supportsVP9 {
++ (NSArray<RTCVideoCodecInfo *> *)supportedCodecsWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9Profile2:(bool)supportsVP9Profile2 {
 
    NSMutableArray<RTCVideoCodecInfo *> *codecs = [[NSMutableArray alloc] initWithCapacity:8];
 
@@ -80,11 +82,12 @@
   [codecs addObject:vp8Info];
 
 #if defined(RTC_ENABLE_VP9)
-  if (supportsVP9) {
+  if (supportsVP9Profile0) {
     [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
       @"profile-id" : @"0",
     }]];
-
+  }
+  if (supportsVP9Profile2) {
     [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name parameters: @{
       @"profile-id" : @"2",
     }]];
@@ -117,7 +120,7 @@
 }
 
 - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
-  return [[self class] supportedCodecsWithH265:_supportsH265 vp9: _supportsVP9];
+  return [[self class] supportedCodecsWithH265:_supportsH265 vp9Profile0:_supportsVP9Profile0 vp9Profile2: _supportsVP9Profile2];
 }
 
 @end

Modified: trunk/Source/WTF/ChangeLog (270255 => 270256)


--- trunk/Source/WTF/ChangeLog	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WTF/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1,3 +1,12 @@
+2020-11-30  Youenn Fablet  <[email protected]>
+
+        Introduce an experimental flag specific to VP9 profile 2
+        https://bugs.webkit.org/show_bug.cgi?id=219350
+
+        Reviewed by Eric Carlson.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
 2020-11-28  Per Arne Vollan  <[email protected]>
 
         [macOS] Set application information in the Networking process on behalf of the WebContent process

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (270255 => 270256)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1037,11 +1037,10 @@
     WebKit:
       default: WebKit::defaultWebRTCCodecsInGPUProcess()
 
-# FIXME: Is this implemented for WebKitLegacy? If not, this should be excluded from WebKitLegacy entirely.
-WebRTCVP9CodecEnabled:
+WebRTCVP9Profile0CodecEnabled:
   type: bool
-  humanReadableName: "WebRTC VP9 codec"
-  humanReadableDescription: "Enable WebRTC VP9 codec"
+  humanReadableName: "WebRTC VP9 profile 0 codec"
+  humanReadableDescription: "Enable WebRTC VP9 profile 0 codec"
   webcoreBinding: RuntimeEnabledFeatures
   condition: ENABLE(WEB_RTC)
   defaultValue:
@@ -1050,6 +1049,18 @@
     WebKit:
       default: false
 
+WebRTCVP9Profile2CodecEnabled:
+  type: bool
+  humanReadableName: "WebRTC VP9 profile 2 codec"
+  humanReadableDescription: "Enable WebRTC VP9 profile 2 codec"
+  webcoreBinding: RuntimeEnabledFeatures
+  condition: ENABLE(WEB_RTC)
+  defaultValue:
+    WebKitLegacy:
+      default: false
+    WebKit:
+      default: false
+
 WebSQLDisabled:
   type: bool
   humanReadableName: "Disable WebSQL"

Modified: trunk/Source/WebCore/ChangeLog (270255 => 270256)


--- trunk/Source/WebCore/ChangeLog	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1,5 +1,36 @@
 2020-11-30  Youenn Fablet  <[email protected]>
 
+        Introduce an experimental flag specific to VP9 profile 2
+        https://bugs.webkit.org/show_bug.cgi?id=219350
+
+        Reviewed by Eric Carlson.
+
+        Introduce an experimental flag for VP9 profile 2.
+        Pass it to libwebrtc backend when creating codec factories.
+        Profile 2 support is only enabled if profile 0 support is also enabled.
+        Covered by updated test.
+
+        * page/Page.cpp:
+        (WebCore::m_shouldRelaxThirdPartyCookieBlocking):
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::webRTCVP9Profile0CodecEnabled const):
+        (WebCore::RuntimeEnabledFeatures::setWebRTCVP9Profile0CodecEnabled):
+        (WebCore::RuntimeEnabledFeatures::webRTCVP9Profile2CodecEnabled const):
+        (WebCore::RuntimeEnabledFeatures::setWebRTCVP9Profile2CodecEnabled):
+        (WebCore::RuntimeEnabledFeatures::webRTCVP9CodecEnabled const): Deleted.
+        (WebCore::RuntimeEnabledFeatures::setWebRTCVP9CodecEnabled): Deleted.
+        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+        (WebCore::LibWebRTCProvider::setVP9Support):
+        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
+        (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
+        (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
+        * testing/Internals.cpp:
+        (WebCore::Internals::setWebRTCVP9Support):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
+2020-11-30  Youenn Fablet  <[email protected]>
+
         Missing WebRTC Metrics in iOS 14 Beta 5
         https://bugs.webkit.org/show_bug.cgi?id=215678
         <rdar://problem/67625414>

Modified: trunk/Source/WebCore/page/Page.cpp (270255 => 270256)


--- trunk/Source/WebCore/page/Page.cpp	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/page/Page.cpp	2020-11-30 19:36:55 UTC (rev 270256)
@@ -339,7 +339,7 @@
 
 #if USE(LIBWEBRTC)
     m_libWebRTCProvider->setH265Support(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
-    m_libWebRTCProvider->setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9CodecEnabled());
+    m_libWebRTCProvider->setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9Profile0CodecEnabled(), RuntimeEnabledFeatures::sharedFeatures().webRTCVP9Profile2CodecEnabled());
 #endif
 
     if (!pageConfiguration.userScriptsShouldWaitUntilNotification)

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (270255 => 270256)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-11-30 19:36:55 UTC (rev 270256)
@@ -151,8 +151,10 @@
     void setWebRTCDTMFEnabled(bool isEnabled) { m_isWebRTCDTMFEnabled = isEnabled; }
     bool webRTCH265CodecEnabled() const { return m_isWebRTCH265CodecEnabled; }
     void setWebRTCH265CodecEnabled(bool isEnabled) { m_isWebRTCH265CodecEnabled = isEnabled; }
-    bool webRTCVP9CodecEnabled() const { return m_isWebRTCVP9CodecEnabled; }
-    void setWebRTCVP9CodecEnabled(bool isEnabled) { m_isWebRTCVP9CodecEnabled = isEnabled; }
+    bool webRTCVP9Profile0CodecEnabled() const { return m_isWebRTCVP9Profile0CodecEnabled; }
+    void setWebRTCVP9Profile0CodecEnabled(bool isEnabled) { m_isWebRTCVP9Profile0CodecEnabled = isEnabled; }
+    bool webRTCVP9Profile2CodecEnabled() const { return m_isWebRTCVP9Profile2CodecEnabled; }
+    void setWebRTCVP9Profile2CodecEnabled(bool isEnabled) { m_isWebRTCVP9Profile2CodecEnabled = isEnabled; }
     bool webRTCH264LowLatencyEncoderEnabled() const { return m_isWebRTCH264LowLatencyEncoderEnabled; }
     void setWebRTCH264LowLatencyEncoderEnabled(bool isEnabled) { m_isWebRTCH264LowLatencyEncoderEnabled = isEnabled; }
     bool peerConnectionEnabled() const { return m_isPeerConnectionEnabled; }
@@ -312,7 +314,8 @@
     bool m_isWebRTCMDNSICECandidatesEnabled { false };
     bool m_isWebRTCPlatformCodecsInGPUProcessEnabled { false };
     bool m_isWebRTCH265CodecEnabled { false };
-    bool m_isWebRTCVP9CodecEnabled { false };
+    bool m_isWebRTCVP9Profile0CodecEnabled { false };
+    bool m_isWebRTCVP9Profile2CodecEnabled { false };
     bool m_isWebRTCH264LowLatencyEncoderEnabled { false };
 #endif
 

Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (270255 => 270256)


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h	2020-11-30 19:36:55 UTC (rev 270256)
@@ -107,10 +107,11 @@
     void enableEnumeratingAllNetworkInterfaces();
 
     void setH265Support(bool value) { m_supportsH265 = value; }
-    void setVP9Support(bool value) { m_supportsVP9 = value; }
+    void setVP9Support(bool supportsVP9Profile0, bool supportsVP9Profile2);
     void setVP9VTBSupport(bool value) { m_supportsVP9VTB = value; }
     bool isSupportingH265() const { return m_supportsH265; }
-    bool isSupportingVP9() const { return m_supportsVP9; }
+    bool isSupportingVP9Profile0() const { return m_supportsVP9Profile0; }
+    bool isSupportingVP9Profile2() const { return m_supportsVP9Profile2; }
     bool isSupportingVP9VTB() const { return m_supportsVP9VTB; }
     virtual void disableNonLocalhostConnections() { m_disableNonLocalhostConnections = true; }
 
@@ -154,7 +155,8 @@
     rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> m_factory;
     bool m_disableNonLocalhostConnections { false };
     bool m_supportsH265 { false };
-    bool m_supportsVP9 { false };
+    bool m_supportsVP9Profile0 { false };
+    bool m_supportsVP9Profile2 { false };
     bool m_supportsVP9VTB { false };
     bool m_enableLogging { true };
     bool m_useDTLS10 { false };
@@ -161,6 +163,14 @@
 #endif
 };
 
+#if USE(LIBWEBRTC)
+inline void LibWebRTCProvider::setVP9Support(bool supportsVP9Profile0, bool supportsVP9Profile2)
+{
+    m_supportsVP9Profile0 = supportsVP9Profile0;
+    m_supportsVP9Profile2 = supportsVP9Profile2;
+}
+#endif
+
 } // namespace WebCore
 
 namespace WTF {

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


--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp	2020-11-30 19:36:55 UTC (rev 270256)
@@ -64,7 +64,8 @@
     if (!webRTCAvailable())
         return nullptr;
 
-    return webrtc::createWebKitDecoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off, isSupportingVP9VTB() ? webrtc::WebKitVP9VTB::On : webrtc::WebKitVP9VTB::Off);
+    auto vp9Support = isSupportingVP9Profile2() ? webrtc::WebKitVP9::Profile0And2 : isSupportingVP9Profile0() ? webrtc::WebKitVP9::Profile0 : webrtc::WebKitVP9::Off;
+    return webrtc::createWebKitDecoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, vp9Support, isSupportingVP9VTB() ? webrtc::WebKitVP9VTB::On : webrtc::WebKitVP9VTB::Off);
 }
 
 std::unique_ptr<webrtc::VideoEncoderFactory> LibWebRTCProviderCocoa::createEncoderFactory()
@@ -74,7 +75,8 @@
     if (!webRTCAvailable())
         return nullptr;
 
-    return webrtc::createWebKitEncoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off, RuntimeEnabledFeatures::sharedFeatures().webRTCH264LowLatencyEncoderEnabled() ? webrtc::WebKitH264LowLatency::On : webrtc::WebKitH264LowLatency::Off);
+    auto vp9Support = isSupportingVP9Profile2() ? webrtc::WebKitVP9::Profile0And2 : isSupportingVP9Profile0() ? webrtc::WebKitVP9::Profile0 : webrtc::WebKitVP9::Off;
+    return webrtc::createWebKitEncoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, vp9Support, RuntimeEnabledFeatures::sharedFeatures().webRTCH264LowLatencyEncoderEnabled() ? webrtc::WebKitH264LowLatency::On : webrtc::WebKitH264LowLatency::Off);
 }
 
 void LibWebRTCProviderCocoa::setActive(bool value)

Modified: trunk/Source/WebCore/testing/Internals.cpp (270255 => 270256)


--- trunk/Source/WebCore/testing/Internals.cpp	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/testing/Internals.cpp	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1556,11 +1556,11 @@
 #endif
 }
 
-void Internals::setWebRTCVP9Support(bool value)
+void Internals::setWebRTCVP9Support(bool supportVP9Profile0, bool supportVP9Profile2)
 {
 #if USE(LIBWEBRTC)
     if (auto* page = contextDocument()->page()) {
-        page->libWebRTCProvider().setVP9Support(value);
+        page->libWebRTCProvider().setVP9Support(supportVP9Profile0, supportVP9Profile2);
         page->libWebRTCProvider().clearFactory();
     }
 #endif

Modified: trunk/Source/WebCore/testing/Internals.h (270255 => 270256)


--- trunk/Source/WebCore/testing/Internals.h	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/testing/Internals.h	2020-11-30 19:36:55 UTC (rev 270256)
@@ -607,7 +607,7 @@
     void clearPeerConnectionFactory();
     void applyRotationForOutgoingVideoSources(RTCPeerConnection&);
     void setWebRTCH265Support(bool);
-    void setWebRTCVP9Support(bool);
+    void setWebRTCVP9Support(bool supportVP9Profile0, bool supportVP9Profile2);
     void setWebRTCVP9VTBSupport(bool);
     uint64_t sframeCounter(const RTCRtpSFrameTransform&);
     void setEnableWebRTCEncryption(bool);

Modified: trunk/Source/WebCore/testing/Internals.idl (270255 => 270256)


--- trunk/Source/WebCore/testing/Internals.idl	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebCore/testing/Internals.idl	2020-11-30 19:36:55 UTC (rev 270256)
@@ -800,7 +800,7 @@
     [Conditional=WEB_RTC] undefined setH264HardwareEncoderAllowed(boolean allowed);
     [Conditional=WEB_RTC] undefined applyRotationForOutgoingVideoSources(RTCPeerConnection connection);
     [Conditional=WEB_RTC] undefined setWebRTCH265Support(boolean allowed);
-    [Conditional=WEB_RTC] undefined setWebRTCVP9Support(boolean allowed);
+    [Conditional=WEB_RTC] undefined setWebRTCVP9Support(boolean supportVP9Profile0, boolean supportVP9Profile2);
     [Conditional=WEB_RTC] undefined setWebRTCVP9VTBSupport(boolean allowed);
     [Conditional=WEB_RTC] unsigned long long sframeCounter(RTCRtpSFrameTransform transform);
 

Modified: trunk/Source/WebKit/ChangeLog (270255 => 270256)


--- trunk/Source/WebKit/ChangeLog	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebKit/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
@@ -1,3 +1,13 @@
+2020-11-30  Youenn Fablet  <[email protected]>
+
+        Introduce an experimental flag specific to VP9 profile 2
+        https://bugs.webkit.org/show_bug.cgi?id=219350
+
+        Reviewed by Eric Carlson.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2020-11-30  Antti Koivisto  <[email protected]>
 
         Remove throttling code from NetworkLoad

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (270255 => 270256)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-11-30 19:29:20 UTC (rev 270255)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-11-30 19:36:55 UTC (rev 270256)
@@ -3782,7 +3782,7 @@
 
 #if USE(LIBWEBRTC)
     m_page->libWebRTCProvider().setH265Support(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
-    m_page->libWebRTCProvider().setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9CodecEnabled());
+    m_page->libWebRTCProvider().setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9Profile0CodecEnabled(), RuntimeEnabledFeatures::sharedFeatures().webRTCVP9Profile2CodecEnabled());
     LibWebRTCProvider::setH264HardwareEncoderAllowed(store.getBoolValueForKey(WebPreferencesKey::webRTCH264HardwareEncoderEnabledKey()));
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to