Changeset 263734 in webkit


Ignore:
Timestamp:
Jun 30, 2020 12:19:59 AM (4 years ago)
Author:
youenn@apple.com
Message:

Add VP9 WebRTC codec runtime flag
https://bugs.webkit.org/show_bug.cgi?id=213724

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Update WebKit binding code to switch on/off VP9 encoder/decoder.
We still use vp9_noop for now, so encoder/decoder is not functional.

  • Configurations/libwebrtc.iOS.exp:
  • Configurations/libwebrtc.iOSsim.exp:
  • Configurations/libwebrtc.mac.exp:
  • Configurations/libwebrtc.xcconfig:
  • Configurations/libwebrtcpcrtc.xcconfig:
  • Source/webrtc/modules/video_coding/codecs/vp9/vp9_noop.cc:
  • Source/webrtc/sdk/WebKit/WebKitDecoder.mm:

(webrtc::createWebKitDecoderFactory):

  • Source/webrtc/sdk/WebKit/WebKitEncoder.mm:

(webrtc::createWebKitEncoderFactory):
(webrtc::setH264HardwareEncoderAllowed):
(webrtc::isH264HardwareEncoderAllowed):

  • Source/webrtc/sdk/WebKit/WebKitUtilities.h:
  • Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
  • Source/webrtc/sdk/objc/api/video_codec/RTCVideoDecoderVP9.h:
  • Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h:
  • Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h:
  • Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:

(-[RTCDefaultVideoDecoderFactory initWithH265:vp9:]):
(-[RTCDefaultVideoDecoderFactory supportedCodecs]):

  • Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h:
  • Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m:

(-[RTCDefaultVideoEncoderFactory initWithH265:vp9:]):
(-[RTCDefaultVideoEncoderFactory supportedCodecs]):

  • libwebrtc.xcodeproj/project.pbxproj:

Source/WebCore:

Add binding code to switch on/off VP9 in WebRTC factories based on runtime flag.

Test: webrtc/vp9.html

  • page/Page.cpp:

(WebCore::m_shouldRelaxThirdPartyCookieBlocking):

  • page/RuntimeEnabledFeatures.h:

(WebCore::RuntimeEnabledFeatures::webRTCVP9CodecEnabled const):
(WebCore::RuntimeEnabledFeatures::setWebRTCVP9CodecEnabled):

  • platform/mediastream/libwebrtc/LibWebRTCProvider.h:
  • platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:

(WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
(WebCore::LibWebRTCProviderCocoa::createEncoderFactory):

  • testing/Internals.cpp:

(WebCore::Internals::setWebRTCH265Support):
(WebCore::Internals::setWebRTCVP9Support):

  • testing/Internals.h:
  • testing/Internals.idl:

Source/WebKit:

  • Shared/WebPreferences.yaml:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

LayoutTests:

  • webrtc/h265.html:
  • webrtc/vp9-expected.txt: Added.
  • webrtc/vp9.html: Added.
Location:
trunk
Files:
2 added
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r263733 r263734  
     12020-06-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Add VP9 WebRTC codec runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=213724
     5
     6        Reviewed by Eric Carlson.
     7
     8        * webrtc/h265.html:
     9        * webrtc/vp9-expected.txt: Added.
     10        * webrtc/vp9.html: Added.
     11
    1122020-06-30  Diego Pino Garcia  <dpino@igalia.com>
    213
  • trunk/LayoutTests/webrtc/h265.html

    r259452 r263734  
    1919test(() => {
    2020    if (window.internals)
    21         window.internals.clearPeerConnectionFactory();
     21        window.internals.setWebRTCH265Support(false);
    2222
    23     const codecs = RTCRtpSender.getCapabilities("video").codecs;
     23    let codecs = RTCRtpSender.getCapabilities("video").codecs;
     24    hasH265 = codecs.some((codec) => { return codec.mimeType == "video/H265"; });
     25    assert_false(hasH265);
     26
     27    if (window.internals)
     28        window.internals.setWebRTCH265Support(true);
     29
     30    codecs = RTCRtpSender.getCapabilities("video").codecs;
    2431    hasH265 = codecs.some((codec) => { return codec.mimeType == "video/H265"; });
    2532    assert_true(hasH265);
  • trunk/Source/ThirdParty/libwebrtc/ChangeLog

    r263453 r263734  
     12020-06-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Add VP9 WebRTC codec runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=213724
     5
     6        Reviewed by Eric Carlson.
     7
     8        Update WebKit binding code to switch on/off VP9 encoder/decoder.
     9        We still use vp9_noop for now, so encoder/decoder is not functional.
     10
     11        * Configurations/libwebrtc.iOS.exp:
     12        * Configurations/libwebrtc.iOSsim.exp:
     13        * Configurations/libwebrtc.mac.exp:
     14        * Configurations/libwebrtc.xcconfig:
     15        * Configurations/libwebrtcpcrtc.xcconfig:
     16        * Source/webrtc/modules/video_coding/codecs/vp9/vp9_noop.cc:
     17        * Source/webrtc/sdk/WebKit/WebKitDecoder.mm:
     18        (webrtc::createWebKitDecoderFactory):
     19        * Source/webrtc/sdk/WebKit/WebKitEncoder.mm:
     20        (webrtc::createWebKitEncoderFactory):
     21        (webrtc::setH264HardwareEncoderAllowed):
     22        (webrtc::isH264HardwareEncoderAllowed):
     23        * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
     24        * Source/webrtc/sdk/WebKit/WebKitUtilities.mm:
     25        * Source/webrtc/sdk/objc/api/video_codec/RTCVideoDecoderVP9.h:
     26        * Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h:
     27        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h:
     28        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:
     29        (-[RTCDefaultVideoDecoderFactory initWithH265:vp9:]):
     30        (-[RTCDefaultVideoDecoderFactory supportedCodecs]):
     31        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h:
     32        * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m:
     33        (-[RTCDefaultVideoEncoderFactory initWithH265:vp9:]):
     34        (-[RTCDefaultVideoEncoderFactory supportedCodecs]):
     35        * libwebrtc.xcodeproj/project.pbxproj:
     36
    1372020-06-24  Youenn Fablet  <youenn@apple.com>
    238
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp

    r262726 r263734  
    105105__ZNK6webrtc21IceCandidateInterface10server_urlEv
    106106__ZN6webrtc20setApplicationStatusEb
    107 __ZN6webrtc26createWebKitDecoderFactoryENS_18WebKitCodecSupportE
    108 __ZN6webrtc26createWebKitEncoderFactoryENS_18WebKitCodecSupportE
     107__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
     108__ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
    109109__ZN6webrtc29setH264HardwareEncoderAllowedEb
    110110__ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp

    r262726 r263734  
    105105__ZNK6webrtc21IceCandidateInterface10server_urlEv
    106106__ZN6webrtc20setApplicationStatusEb
    107 __ZN6webrtc26createWebKitDecoderFactoryENS_18WebKitCodecSupportE
    108 __ZN6webrtc26createWebKitEncoderFactoryENS_18WebKitCodecSupportE
     107__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
     108__ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
    109109__ZN6webrtc29setH264HardwareEncoderAllowedEb
    110110__ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp

    r262726 r263734  
    105105__ZNK6webrtc21IceCandidateInterface10server_urlEv
    106106__ZN6webrtc20setApplicationStatusEb
    107 __ZN6webrtc26createWebKitDecoderFactoryENS_18WebKitCodecSupportE
    108 __ZN6webrtc26createWebKitEncoderFactoryENS_18WebKitCodecSupportE
     107__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
     108__ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
    109109__ZN6webrtc29setH264HardwareEncoderAllowedEb
    110110__ZN6webrtc20pixelBufferFromFrameERKNS_10VideoFrameERKNSt3__18functionIFP10__CVBuffermmEEE
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig

    r263375 r263734  
    2727
    2828// FIXME: Set WEBRTC_USE_BUILTIN_ISAC_FIX and WEBRTC_USE_BUILTIN_ISAC_FLOAT for iOS and Mac
    29 GCC_PREPROCESSOR_DEFINITIONS = GTEST_RELATIVE_PATH WEBRTC_OPUS_SUPPORT_120MS_PTIME=0 WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_NETINET_IN_H HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE  HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722 WEBRTC_OPUS_VARIABLE_COMPLEXITY=0 WEBRTC_USE_BUILTIN_ISAC_FIX=1 WEBRTC_USE_BUILTIN_ISAC_FLOAT=0 USE_BUILTIN_SW_CODECS WEBRTC_WEBKIT_BUILD $(inherited);
     29GCC_PREPROCESSOR_DEFINITIONS = GTEST_RELATIVE_PATH WEBRTC_OPUS_SUPPORT_120MS_PTIME=0 WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_NETINET_IN_H HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE  HAVE_SCTP WEBRTC_CODEC_G711 WEBRTC_CODEC_G722 WEBRTC_OPUS_VARIABLE_COMPLEXITY=0 WEBRTC_USE_BUILTIN_ISAC_FIX=1 WEBRTC_USE_BUILTIN_ISAC_FLOAT=0 USE_BUILTIN_SW_CODECS WEBRTC_WEBKIT_BUILD RTC_ENABLE_VP9 $(inherited);
    3030
    3131GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*] = $(inherited) WEBRTC_USE_VTB_HARDWARE_ENCODER;
  • trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtcpcrtc.xcconfig

    r252472 r263734  
    1313USE_HEADERMAP = NO;
    1414
    15 GCC_PREPROCESSOR_DEFINITIONS = WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE HAVE_NETINET_IN_H HAVE_SCTP $(inherited);
     15GCC_PREPROCESSOR_DEFINITIONS = WEBRTC_POSIX WEBRTC_MAC SSL_USE_OPENSSL FEATURE_ENABLE_SSL HAVE_SRTP HAVE_OPENSSL_SSL_H SCTP_PROCESS_LEVEL_LOCKS SCTP_SIMPLE_ALLOCATOR SCTP_USE_OPENSSL_SHA1 __Userspace__ HAVE_SA_LEN HAVE_SCONN_LEN __APPLE_USE_RFC_2292 __Userspace_os_Darwin NON_WINDOWS_DEFINE HAVE_WEBRTC_VIDEO HAVE_WEBRTC_VOICE WEBRTC_INTELLIGIBILITY_ENHANCER=0 WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_NS_FLOAT WEBRTC_USE_BUILTIN_ILBC WEBRTC_CODEC_ILBC WEBRTC_USE_BUILTIN_OPUS WEBRTC_CODEC_OPUS WEBRTC_CODEC_ISAC WEBRTC_CODEC_RED HAVE_STDINT_H HAVE_STDLIB_H HAVE_UINT64_T OPENSSL HAVE_CONFIG_H WEBRTC_WEBKIT_BUILD HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE HAVE_NETINET_IN_H HAVE_SCTP RTC_ENABLE_VP9 $(inherited);
    1616
    1717GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*] = $(inherited);
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/modules/video_coding/codecs/vp9/vp9_noop.cc

    r252472 r263734  
    1010 */
    1111
    12 #if defined(RTC_ENABLE_VP9)
    13 #error
    14 #endif  // !defined(RTC_ENABLE_VP9)
     12// FIXME: Use libvpx to support VP9 encoder and decoder.
    1513
    1614#include "modules/video_coding/codecs/vp9/include/vp9.h"
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm

    r259568 r263734  
    168168}
    169169
    170 std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitCodecSupport codecSupport)
    171 {
    172     auto internalFactory = ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] initWithH265: codecSupport == WebKitCodecSupport::H264VP8AndH265]);
     170std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265 supportsH265, WebKitVP9 supportsVP9)
     171{
     172    auto internalFactory = ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9: supportsVP9 == WebKitVP9::On]);
    173173    if (videoDecoderCallbacks().createCallback)
    174174        return std::make_unique<RemoteVideoDecoderFactory>(std::move(internalFactory));
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitEncoder.mm

    r259568 r263734  
    3434#include "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h"
    3535#include "sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h"
     36#include "sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h"
    3637#include "sdk/objc/components/video_codec/RTCVideoEncoderH264.h"
    3738#include "sdk/objc/components/video_codec/RTCVideoEncoderH265.h"
    3839#include "sdk/objc/native/src/objc_frame_buffer.h"
    39 
     40#include "sdk/objc/native/api/video_encoder_factory.h"
    4041
    4142@interface WK_RTCLocalVideoH264H265Encoder : NSObject
     
    9495@end
    9596namespace webrtc {
     97
     98std::unique_ptr<webrtc::VideoEncoderFactory> createWebKitEncoderFactory(WebKitH265 supportsH265, WebKitVP9 supportsVP9)
     99{
     100#if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
     101    static std::once_flag onceFlag;
     102    std::call_once(onceFlag, [] {
     103        webrtc::VPModuleInitialize();
     104    });
     105#endif
     106
     107    auto internalFactory = ObjCToNativeVideoEncoderFactory([[RTCDefaultVideoEncoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9:supportsVP9 == WebKitVP9::On]);
     108    return std::make_unique<VideoEncoderFactoryWithSimulcast>(std::move(internalFactory));
     109}
     110
     111static bool h264HardwareEncoderAllowed = true;
     112void setH264HardwareEncoderAllowed(bool allowed)
     113{
     114    h264HardwareEncoderAllowed = allowed;
     115}
     116
     117bool isH264HardwareEncoderAllowed()
     118{
     119    return h264HardwareEncoderAllowed;
     120}
    96121
    97122std::unique_ptr<VideoEncoder> VideoEncoderFactoryWithSimulcast::CreateVideoEncoder(const SdpVideoFormat& format)
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h

    r261651 r263734  
    4040class VideoFrame;
    4141
    42 enum class WebKitCodecSupport { H264VP8AndH265, H264AndVP8 };
     42enum class WebKitH265 { Off, On };
     43enum class WebKitVP9 { Off, On };
    4344
    44 std::unique_ptr<webrtc::VideoEncoderFactory> createWebKitEncoderFactory(WebKitCodecSupport);
    45 std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitCodecSupport);
     45std::unique_ptr<webrtc::VideoEncoderFactory> createWebKitEncoderFactory(WebKitH265, WebKitVP9);
     46std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265, WebKitVP9);
    4647
    4748void setApplicationStatus(bool isActive);
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.mm

    r259568 r263734  
    2626#include "WebKitUtilities.h"
    2727
    28 //#include "Common/RTCUIApplicationStatusObserver.h"
    29 #import "WebRTC/RTCVideoCodecH264.h"
     28#include "native/src/objc_frame_buffer.h"
     29#include "third_party/libyuv/include/libyuv/convert_from.h"
     30#include "Framework/Headers/WebRTC/RTCVideoFrameBuffer.h"
    3031
    31 #include "api/video/video_frame.h"
    32 #include "helpers/scoped_cftyperef.h"
    33 #include "native/src/objc_frame_buffer.h"
    34 #include "rtc_base/time_utils.h"
    35 #include "sdk/objc/components/video_codec/nalu_rewriter.h"
    36 #include "third_party/libyuv/include/libyuv/convert_from.h"
    37 #include "webrtc/rtc_base/checks.h"
    38 #include "Framework/Headers/WebRTC/RTCVideoCodecFactory.h"
    39 #include "Framework/Headers/WebRTC/RTCVideoFrame.h"
    40 #include "Framework/Headers/WebRTC/RTCVideoFrameBuffer.h"
    41 #include "Framework/Native/api/video_decoder_factory.h"
    42 #include "Framework/Native/api/video_encoder_factory.h"
    43 #include "VideoProcessingSoftLink.h"
    44 #include "WebKitEncoder.h"
    45 
    46 #include <mutex>
    47 
    48 /*
    49 #if !defined(WEBRTC_IOS)
    50 __attribute__((objc_runtime_name("WK_RTCUIApplicationStatusObserver")))
    51 @interface RTCUIApplicationStatusObserver : NSObject
    52 
    53 + (instancetype)sharedInstance;
    54 + (void)prepareForUse;
    55 
    56 - (BOOL)isApplicationActive;
    57 
    58 @end
    59 #endif
    60 
    61 @implementation RTCUIApplicationStatusObserver {
    62     BOOL _isActive;
    63 }
    64 
    65 + (instancetype)sharedInstance {
    66     static id sharedInstance;
    67     static dispatch_once_t onceToken;
    68     dispatch_once(&onceToken, ^{
    69         sharedInstance = [[self alloc] init];
    70     });
    71 
    72     return sharedInstance;
    73 }
    74 
    75 + (void)prepareForUse {
    76     __unused RTCUIApplicationStatusObserver *observer = [self sharedInstance];
    77 }
    78 
    79 - (id)init {
    80     _isActive = YES;
    81     return self;
    82 }
    83 
    84 - (void)setActive {
    85     _isActive = YES;
    86 }
    87 
    88 - (void)setInactive {
    89     _isActive = NO;
    90 }
    91 
    92 - (BOOL)isApplicationActive {
    93     return _isActive;
    94 }
    95 
    96 @end
    97 */
    9832namespace webrtc {
    9933
     
    10640        [[RTCUIApplicationStatusObserver sharedInstance] setInactive];
    10741 */
    108 }
    109 
    110 std::unique_ptr<webrtc::VideoEncoderFactory> createWebKitEncoderFactory(WebKitCodecSupport codecSupport)
    111 {
    112 #if ENABLE_VCP_ENCODER || ENABLE_VCP_VTB_ENCODER
    113     static std::once_flag onceFlag;
    114     std::call_once(onceFlag, [] {
    115         webrtc::VPModuleInitialize();
    116     });
    117 #endif
    118 
    119     auto internalFactory = ObjCToNativeVideoEncoderFactory([[RTCDefaultVideoEncoderFactory alloc] initWithH265: codecSupport == WebKitCodecSupport::H264VP8AndH265]);
    120     return std::make_unique<VideoEncoderFactoryWithSimulcast>(std::move(internalFactory));
    121 }
    122 
    123 static bool h264HardwareEncoderAllowed = true;
    124 void setH264HardwareEncoderAllowed(bool allowed)
    125 {
    126     h264HardwareEncoderAllowed = allowed;
    127 }
    128 
    129 bool isH264HardwareEncoderAllowed()
    130 {
    131     return h264HardwareEncoderAllowed;
    13242}
    13343
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCVideoDecoderVP9.h

    r237075 r263734  
    1515
    1616RTC_OBJC_EXPORT
     17__attribute__((objc_runtime_name("WK_RTCVideoDecoderVP9")))
    1718@interface RTCVideoDecoderVP9 : NSObject
    1819
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCVideoEncoderVP9.h

    r237075 r263734  
    1515
    1616RTC_OBJC_EXPORT
     17__attribute__((objc_runtime_name("WK_RTCVideoEncoderVP9")))
    1718@interface RTCVideoEncoderVP9 : NSObject
    1819
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h

    r259452 r263734  
    2222__attribute__((objc_runtime_name("WK_RTCDefaultVideoDecoderFactory")))
    2323@interface RTCDefaultVideoDecoderFactory : NSObject <RTCVideoDecoderFactory>
    24 - (id)initWithH265:(bool)supportH265;
     24- (id)initWithH265:(bool)supportH265 vp9:(bool)supportsVP9;
    2525@end
    2626
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m

    r259452 r263734  
    2525
    2626@implementation RTCDefaultVideoDecoderFactory {
    27   bool _supportH265;
     27  bool _supportsH265;
     28  bool _supportsVP9;
    2829}
    2930
    30 - (id)initWithH265:(bool)supportH265
     31- (id)initWithH265:(bool)supportsH265 vp9:(bool)supportsVP9
    3132{
    3233  self = [super init];
    3334  if (self) {
    34       _supportH265 = supportH265;
     35      _supportsH265 = supportsH265;
     36      _supportsVP9 = supportsVP9;
    3537  }
    3638  return self;
     
    5860  RTCVideoCodecInfo *vp8Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name];
    5961
     62  NSMutableArray<RTCVideoCodecInfo *> *codecs = [[NSMutableArray alloc] initWithCapacity:5];
     63
     64  [codecs addObject:constrainedHighInfo];
     65  [codecs addObject:constrainedBaselineInfo];
    6066#if !defined(RTC_DISABLE_H265)
    61   RTCVideoCodecInfo *h265Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH265Name];
     67  if (_supportsH265) {
     68    RTCVideoCodecInfo *h265Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH265Name];
     69    [codecs addObject:h265Info];
     70  }
    6271#endif
    63  
     72  [codecs addObject:vp8Info];
    6473#if defined(RTC_ENABLE_VP9)
    65   RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
     74  if (_supportsVP9) {
     75    RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
     76    [codecs addObject:vp9Info];
     77  }
    6678#endif
    6779
    68   if (!_supportH265) {
    69     return @[
    70       constrainedHighInfo,
    71       constrainedBaselineInfo,
    72       vp8Info,
    73 #if defined(RTC_ENABLE_VP9)
    74       vp9Info,
    75 #endif
    76     ];
    77   }
    78   return @[
    79     constrainedHighInfo,
    80     constrainedBaselineInfo,
    81 #if !defined(RTC_DISABLE_H265)
    82     h265Info,
    83 #endif
    84     vp8Info,
    85 #if defined(RTC_ENABLE_VP9)
    86     vp9Info,
    87 #endif
    88   ];
     80  return codecs;
    8981}
    9082
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.h

    r259452 r263734  
    2323@interface RTCDefaultVideoEncoderFactory : NSObject <RTCVideoEncoderFactory>
    2424
    25 - (id)initWithH265:(bool)supportH265;
     25- (id)initWithH265:(bool)supportH265 vp9:(bool)supportsVP9;
    2626+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecs;
     27+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecsWithH265:(bool)supportsH265 vp9:(bool)supportsVP9;
    2728
    2829@end
  • trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m

    r259452 r263734  
    2525
    2626@implementation RTCDefaultVideoEncoderFactory {
    27   bool _supportH265;
     27  bool _supportsH265;
     28  bool _supportsVP9;
    2829}
    2930
    30 - (id)initWithH265:(bool)supportH265
     31- (id)initWithH265:(bool)supportsH265 vp9:(bool)supportsVP9
    3132{
    3233  self = [super init];
    3334  if (self) {
    34       _supportH265 = supportH265;
     35      _supportsH265 = supportsH265;
     36      _supportsVP9 = supportsVP9;
    3537  }
    3638  return self;
     
    3840
    3941+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
     42    return [self supportedCodecsWithH265:true vp9:true];
     43}
     44
     45+ (NSArray<RTCVideoCodecInfo *> *)supportedCodecsWithH265:(bool)supportsH265 vp9:(bool)supportsVP9 {
    4046  NSDictionary<NSString *, NSString *> *constrainedHighParams = @{
    4147    @"profile-level-id" : kRTCMaxSupportedH264ProfileLevelConstrainedHigh,
     
    5662                                   parameters:constrainedBaselineParams];
    5763
    58 #if !defined(DISABLE_H265)
    59   RTCVideoCodecInfo *h265Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH265Name];
     64  NSMutableArray<RTCVideoCodecInfo *> *codecs = [[NSMutableArray alloc] initWithCapacity:5];
     65
     66  [codecs addObject:constrainedHighInfo];
     67  [codecs addObject:constrainedBaselineInfo];
     68#if !defined(RTC_DISABLE_H265)
     69  if (supportsH265) {
     70    RTCVideoCodecInfo *h265Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecH265Name];
     71    [codecs addObject:h265Info];
     72  }
    6073#endif
    6174
    6275  RTCVideoCodecInfo *vp8Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp8Name];
     76  [codecs addObject:vp8Info];
    6377
    6478#if defined(RTC_ENABLE_VP9)
    65   RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
     79  if (supportsVP9) {
     80    RTCVideoCodecInfo *vp9Info = [[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecVp9Name];
     81    [codecs addObject:vp9Info];
     82  }
    6683#endif
    6784
    68   return @[
    69     constrainedHighInfo,
    70     constrainedBaselineInfo,
    71 #if !defined(DISABLE_H265)
    72     h265Info,
    73 #endif
    74     vp8Info,
    75 #if defined(RTC_ENABLE_VP9)
    76     vp9Info,
    77 #endif
    78   ];
     85  return codecs;
    7986}
    8087
     
    100107
    101108- (NSArray<RTCVideoCodecInfo *> *)supportedCodecs {
    102   NSMutableArray<RTCVideoCodecInfo *> *codecs = [[[self class] supportedCodecs] mutableCopy];
    103 
    104   NSMutableArray<RTCVideoCodecInfo *> *orderedCodecs = [NSMutableArray array];
    105   [orderedCodecs addObjectsFromArray:codecs];
    106   if (!_supportH265)
    107     [orderedCodecs removeObjectAtIndex:0];
    108 
    109   return [orderedCodecs copy];
     109  return [[self class] supportedCodecsWithH265:_supportsH265 vp9: _supportsVP9];
    110110}
    111111
  • trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj

    r262308 r263734  
    979979                413E67A5216988DC00EF37ED /* video_stream_encoder_observer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413E67A4216988DC00EF37ED /* video_stream_encoder_observer.cc */; };
    980980                413F4D7022B0BAEF006A7A6B /* RTCVideoDecoderVP8.h in Headers */ = {isa = PBXBuildFile; fileRef = 413F4D6F22B0BAEE006A7A6B /* RTCVideoDecoderVP8.h */; };
     981                414035EC24AA0EBC00BCE9B2 /* RTCVideoDecoderVP9.h in Headers */ = {isa = PBXBuildFile; fileRef = 414035E824AA0EBB00BCE9B2 /* RTCVideoDecoderVP9.h */; };
     982                414035ED24AA0EBC00BCE9B2 /* RTCVideoEncoderVP9.mm in Sources */ = {isa = PBXBuildFile; fileRef = 414035E924AA0EBB00BCE9B2 /* RTCVideoEncoderVP9.mm */; };
     983                414035EE24AA0EBC00BCE9B2 /* RTCVideoEncoderVP9.h in Headers */ = {isa = PBXBuildFile; fileRef = 414035EA24AA0EBB00BCE9B2 /* RTCVideoEncoderVP9.h */; };
     984                414035EF24AA0EBC00BCE9B2 /* RTCVideoDecoderVP9.mm in Sources */ = {isa = PBXBuildFile; fileRef = 414035EB24AA0EBB00BCE9B2 /* RTCVideoDecoderVP9.mm */; };
     985                414035F224AA0F5400BCE9B2 /* video_rtp_depacketizer_vp9.cc in Sources */ = {isa = PBXBuildFile; fileRef = 414035F024AA0F5300BCE9B2 /* video_rtp_depacketizer_vp9.cc */; };
     986                414035F324AA0F5400BCE9B2 /* video_rtp_depacketizer_vp9.h in Headers */ = {isa = PBXBuildFile; fileRef = 414035F124AA0F5300BCE9B2 /* video_rtp_depacketizer_vp9.h */; };
    981987                4140B8201E4E3383007409E6 /* audio_encoder_pcm.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4140B8181E4E3383007409E6 /* audio_encoder_pcm.cc */; };
    982988                4140B8211E4E3383007409E6 /* audio_encoder_pcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 4140B8191E4E3383007409E6 /* audio_encoder_pcm.h */; };
     
    49924998                413E67AA2169894C00EF37ED /* RTCNativeMutableI420Buffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCNativeMutableI420Buffer.h; sourceTree = "<group>"; };
    49934999                413F4D6F22B0BAEE006A7A6B /* RTCVideoDecoderVP8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCVideoDecoderVP8.h; sourceTree = "<group>"; };
     5000                414035E824AA0EBB00BCE9B2 /* RTCVideoDecoderVP9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCVideoDecoderVP9.h; sourceTree = "<group>"; };
     5001                414035E924AA0EBB00BCE9B2 /* RTCVideoEncoderVP9.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RTCVideoEncoderVP9.mm; sourceTree = "<group>"; };
     5002                414035EA24AA0EBB00BCE9B2 /* RTCVideoEncoderVP9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCVideoEncoderVP9.h; sourceTree = "<group>"; };
     5003                414035EB24AA0EBB00BCE9B2 /* RTCVideoDecoderVP9.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RTCVideoDecoderVP9.mm; sourceTree = "<group>"; };
     5004                414035F024AA0F5300BCE9B2 /* video_rtp_depacketizer_vp9.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = video_rtp_depacketizer_vp9.cc; sourceTree = "<group>"; };
     5005                414035F124AA0F5300BCE9B2 /* video_rtp_depacketizer_vp9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_rtp_depacketizer_vp9.h; sourceTree = "<group>"; };
    49945006                4140B8181E4E3383007409E6 /* audio_encoder_pcm.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_encoder_pcm.cc; path = g711/audio_encoder_pcm.cc; sourceTree = "<group>"; };
    49955007                4140B8191E4E3383007409E6 /* audio_encoder_pcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio_encoder_pcm.h; path = g711/audio_encoder_pcm.h; sourceTree = "<group>"; };
     
    92839295                                417954012169851F0028266B /* RTCVideoEncoderVP8.h */,
    92849296                                413E67642169854500EF37ED /* RTCVideoEncoderVP8.mm */,
     9297                                414035E824AA0EBB00BCE9B2 /* RTCVideoDecoderVP9.h */,
     9298                                414035EB24AA0EBB00BCE9B2 /* RTCVideoDecoderVP9.mm */,
     9299                                414035EA24AA0EBB00BCE9B2 /* RTCVideoEncoderVP9.h */,
     9300                                414035E924AA0EBB00BCE9B2 /* RTCVideoEncoderVP9.mm */,
    92859301                                417953FE2169851F0028266B /* RTCWrappedNativeVideoDecoder.h */,
    92869302                                41795403216985200028266B /* RTCWrappedNativeVideoDecoder.mm */,
     
    1346113477                                4189390A242A704C007FDC41 /* video_rtp_depacketizer_vp8.cc */,
    1346213478                                4189390B242A704C007FDC41 /* video_rtp_depacketizer_vp8.h */,
     13479                                414035F024AA0F5300BCE9B2 /* video_rtp_depacketizer_vp9.cc */,
     13480                                414035F124AA0F5300BCE9B2 /* video_rtp_depacketizer_vp9.h */,
    1346313481                        );
    1346413482                        name = source;
     
    1506215080                                41893A5C242A77B8007FDC41 /* event_based_exponential_moving_average.h in Headers */,
    1506315081                                5CD286151E6A66130094FDC8 /* event_log_writer.h in Headers */,
     15082                                414035EC24AA0EBC00BCE9B2 /* RTCVideoDecoderVP9.h in Headers */,
    1506415083                                41893A5B242A77B8007FDC41 /* event_rate_counter.h in Headers */,
    1506515084                                4131C051234B898D0028A615 /* event_tracer.h in Headers */,
     
    1570415723                                4131C4DB234C84A30028A615 /* rtp_dependency_descriptor_reader.h in Headers */,
    1570515724                                4131C4DC234C84A30028A615 /* rtp_dependency_descriptor_writer.h in Headers */,
     15725                                414035EE24AA0EBC00BCE9B2 /* RTCVideoEncoderVP9.h in Headers */,
    1570615726                                4189391B242A704E007FDC41 /* rtp_descriptor_authentication.h in Headers */,
    1570715727                                5CDD8AB71E43C00F00621E92 /* rtp_file_source.h in Headers */,
     
    1598816008                                5CDD86D71E43BA2800621E92 /* vad_core.h in Headers */,
    1598916009                                5CDD86DA1E43BA2800621E92 /* vad_filterbank.h in Headers */,
     16010                                414035F324AA0F5400BCE9B2 /* video_rtp_depacketizer_vp9.h in Headers */,
    1599016011                                5CDD86DD1E43BA2800621E92 /* vad_gmm.h in Headers */,
    1599116012                                5CDD86E01E43BA2800621E92 /* vad_sp.h in Headers */,
     
    1739717418                                5CD285461E6A61D20094FDC8 /* audio_format.cc in Sources */,
    1739817419                                41DDB26F212679D200296D47 /* audio_format_to_string.cc in Sources */,
     17420                                414035EF24AA0EBC00BCE9B2 /* RTCVideoDecoderVP9.mm in Sources */,
    1739917421                                4131C3A7234B96C30028A615 /* audio_frame.cc in Sources */,
    1740017422                                5CD284921E6A5F410094FDC8 /* audio_frame_manipulator.cc in Sources */,
     
    1779017812                                4131C227234B8BB20028A615 /* keyframe_interval_settings.cc in Sources */,
    1779117813                                5CDD87C41E43BC0500621E92 /* lattice.c in Sources */,
     17814                                414035ED24AA0EBC00BCE9B2 /* RTCVideoEncoderVP9.mm in Sources */,
    1779217815                                41433CF21F79B33400387B4D /* lattice.c in Sources */,
    1779317816                                41433D141F79B33400387B4D /* lattice_c.c in Sources */,
     
    1786717890                                417953B4216982420028266B /* nalu_rewriter.cc in Sources */,
    1786817891                                4131C03C234B898D0028A615 /* nat_server.cc in Sources */,
     17892                                414035F224AA0F5400BCE9B2 /* video_rtp_depacketizer_vp9.cc in Sources */,
    1786917893                                4131C054234B898D0028A615 /* nat_socket_factory.cc in Sources */,
    1787017894                                4131C089234B898D0028A615 /* nat_types.cc in Sources */,
  • trunk/Source/WebCore/ChangeLog

    r263729 r263734  
     12020-06-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Add VP9 WebRTC codec runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=213724
     5
     6        Reviewed by Eric Carlson.
     7
     8        Add binding code to switch on/off VP9 in WebRTC factories based on runtime flag.
     9
     10        Test: webrtc/vp9.html
     11
     12        * page/Page.cpp:
     13        (WebCore::m_shouldRelaxThirdPartyCookieBlocking):
     14        * page/RuntimeEnabledFeatures.h:
     15        (WebCore::RuntimeEnabledFeatures::webRTCVP9CodecEnabled const):
     16        (WebCore::RuntimeEnabledFeatures::setWebRTCVP9CodecEnabled):
     17        * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
     18        * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
     19        (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
     20        (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
     21        * testing/Internals.cpp:
     22        (WebCore::Internals::setWebRTCH265Support):
     23        (WebCore::Internals::setWebRTCVP9Support):
     24        * testing/Internals.h:
     25        * testing/Internals.idl:
     26
    1272020-06-29  Antoine Quint  <graouts@webkit.org>
    228
  • trunk/Source/WebCore/page/Page.cpp

    r263531 r263734  
    335335
    336336#if USE(LIBWEBRTC)
    337     m_libWebRTCProvider->supportsH265(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
     337    m_libWebRTCProvider->setH265Support(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
     338    m_libWebRTCProvider->setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9CodecEnabled());
    338339#endif
    339340
  • trunk/Source/WebCore/page/RuntimeEnabledFeatures.h

    r263700 r263734  
    242242    bool webRTCH265CodecEnabled() const { return m_isWebRTCH265CodecEnabled; }
    243243    void setWebRTCH265CodecEnabled(bool isEnabled) { m_isWebRTCH265CodecEnabled = isEnabled; }
     244    bool webRTCVP9CodecEnabled() const { return m_isWebRTCVP9CodecEnabled; }
     245    void setWebRTCVP9CodecEnabled(bool isEnabled) { m_isWebRTCVP9CodecEnabled = isEnabled; }
    244246    bool peerConnectionEnabled() const { return m_isPeerConnectionEnabled; }
    245247    void setPeerConnectionEnabled(bool isEnabled) { m_isPeerConnectionEnabled = isEnabled; }
     
    511513#if ENABLE(WEB_RTC)
    512514    bool m_isWebRTCDTMFEnabled { true };
    513     bool m_isWebRTCH265CodecEnabled { true };
     515    bool m_isWebRTCH265CodecEnabled { false };
     516    bool m_isWebRTCVP9CodecEnabled { false };
    514517    bool m_isPeerConnectionEnabled { true };
    515518    bool m_isWebRTCMDNSICECandidatesEnabled { false };
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h

    r261277 r263734  
    105105    void enableEnumeratingAllNetworkInterfaces();
    106106
    107     void supportsH265(bool value) { m_supportsH265 = value; }
     107    void setH265Support(bool value) { m_supportsH265 = value; }
     108    void setVP9Support(bool value) { m_supportsVP9 = value; }
     109    bool isSupportingH265() const { return m_supportsH265; }
     110    bool isSupportingVP9() const { return m_supportsVP9; }
    108111    virtual void disableNonLocalhostConnections() { m_disableNonLocalhostConnections = true; }
    109112
     
    147150    bool m_disableNonLocalhostConnections { false };
    148151    bool m_supportsH265 { false };
     152    bool m_supportsVP9 { false };
    149153    bool m_enableLogging { true };
    150154    bool m_useDTLS10 { false };
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp

    r261651 r263734  
    5757    ASSERT(isMainThread());
    5858
    59     auto codecSupport = m_supportsH265 ? webrtc::WebKitCodecSupport::H264VP8AndH265 : webrtc::WebKitCodecSupport::H264AndVP8;
    60     return webrtc::createWebKitDecoderFactory(codecSupport);
     59    return webrtc::createWebKitDecoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off);
    6160}
    6261
     
    6564    ASSERT(isMainThread());
    6665
    67     auto codecSupport = m_supportsH265 ? webrtc::WebKitCodecSupport::H264VP8AndH265 : webrtc::WebKitCodecSupport::H264AndVP8;
    68     return webrtc::createWebKitEncoderFactory(codecSupport);
     66    return webrtc::createWebKitEncoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off);
    6967}
    7068
  • trunk/Source/WebCore/testing/Internals.cpp

    r263700 r263734  
    16141614    connection.applyRotationForOutgoingVideoSources();
    16151615}
     1616void Internals::setWebRTCH265Support(bool value)
     1617{
     1618#if USE(LIBWEBRTC)
     1619    if (auto* page = contextDocument()->page()) {
     1620        page->libWebRTCProvider().setH265Support(value);
     1621        page->libWebRTCProvider().clearFactory();
     1622    }
     1623#endif
     1624}
     1625
     1626void Internals::setWebRTCVP9Support(bool value)
     1627{
     1628#if USE(LIBWEBRTC)
     1629    if (auto* page = contextDocument()->page()) {
     1630        page->libWebRTCProvider().setVP9Support(value);
     1631        page->libWebRTCProvider().clearFactory();
     1632    }
     1633#endif
     1634}
    16161635
    16171636void Internals::setEnableWebRTCEncryption(bool value)
  • trunk/Source/WebCore/testing/Internals.h

    r263700 r263734  
    598598    void clearPeerConnectionFactory();
    599599    void applyRotationForOutgoingVideoSources(RTCPeerConnection&);
     600    void setWebRTCH265Support(bool);
     601    void setWebRTCVP9Support(bool);
    600602    void setEnableWebRTCEncryption(bool);
    601603    void setUseDTLS10(bool);
  • trunk/Source/WebCore/testing/Internals.idl

    r263700 r263734  
    777777    [Conditional=WEB_RTC] void setH264HardwareEncoderAllowed(boolean allowed);
    778778    [Conditional=WEB_RTC] void applyRotationForOutgoingVideoSources(RTCPeerConnection connection);
     779    [Conditional=WEB_RTC] void setWebRTCH265Support(boolean allowed);
     780    [Conditional=WEB_RTC] void setWebRTCVP9Support(boolean allowed);
    779781
    780782    [Conditional=MEDIA_STREAM] void setMockAudioTrackChannelNumber(MediaStreamTrack track, unsigned short count);
  • trunk/Source/WebKit/ChangeLog

    r263727 r263734  
     12020-06-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Add VP9 WebRTC codec runtime flag
     4        https://bugs.webkit.org/show_bug.cgi?id=213724
     5
     6        Reviewed by Eric Carlson.
     7
     8        * Shared/WebPreferences.yaml:
     9        * WebProcess/WebPage/WebPage.cpp:
     10        (WebKit::WebPage::updatePreferences):
     11
    1122020-06-29  Brady Eidson  <beidson@apple.com>
    213
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r263718 r263734  
    607607  category: experimental
    608608
     609WebRTCVP9CodecEnabled:
     610  type: bool
     611  defaultValue: false
     612  webcoreBinding: RuntimeEnabledFeatures
     613  condition: ENABLE(WEB_RTC)
     614  humanReadableName: "WebRTC VP9 codec"
     615  humanReadableDescription: "Enable WebRTC VP9 codec"
     616  category: experimental
     617
    609618WebRTCPlatformCodecsInGPUProcessEnabled:
    610619  type: bool
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r263727 r263734  
    37293729
    37303730#if USE(LIBWEBRTC)
    3731     m_page->libWebRTCProvider().supportsH265(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
     3731    m_page->libWebRTCProvider().setH265Support(RuntimeEnabledFeatures::sharedFeatures().webRTCH265CodecEnabled());
     3732    m_page->libWebRTCProvider().setVP9Support(RuntimeEnabledFeatures::sharedFeatures().webRTCVP9CodecEnabled());
    37323733#endif
    37333734
Note: See TracChangeset for help on using the changeset viewer.