Diff
Modified: trunk/LayoutTests/ChangeLog (268804 => 268805)
--- trunk/LayoutTests/ChangeLog 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/LayoutTests/ChangeLog 2020-10-21 17:14:25 UTC (rev 268805)
@@ -1,3 +1,16 @@
+2020-10-21 Youenn Fablet <you...@apple.com>
+
+ WebRTC VP9 Decoder should be able to use VTB
+ https://bugs.webkit.org/show_bug.cgi?id=217811
+
+ Reviewed by Eric Carlson.
+
+ * TestExpectations:
+ * platform/mac-wk1/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+ * webrtc/vp9-vtb-expected.txt: Added.
+ * webrtc/vp9-vtb.html: Added.
+
2020-10-21 Hector Lopez <hector_i_lo...@apple.com>
Add test expectation
Modified: trunk/LayoutTests/TestExpectations (268804 => 268805)
--- trunk/LayoutTests/TestExpectations 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/LayoutTests/TestExpectations 2020-10-21 17:14:25 UTC (rev 268805)
@@ -1923,6 +1923,8 @@
# Experimental H265 support.
webrtc/h265.html [ Pass Failure ]
+webrtc/vp9-vtb.html [ Skip ]
+
webrtc/simulcast-h264.html [ Slow ]
webrtc/h264-baseline.html [ Slow ]
webrtc/h264-high.html [ Slow ]
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (268804 => 268805)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-10-21 17:14:25 UTC (rev 268805)
@@ -1273,6 +1273,7 @@
# rdar://65269589 ([ macOS and iOS ] media/vp9.html is failing consistently.)
[ BigSur+ ] media/vp9.html [ Pass ]
+[ BigSur+ ] webrtc/vp9-vtb.html [ Pass ]
webkit.org/b/215700 [ Debug ] fast/scrolling/mac/scrollbars/overlay-scrollbar-hovered.html [ Pass Failure Timeout ]
Added: trunk/LayoutTests/webrtc/vp9-vtb-expected.txt (0 => 268805)
--- trunk/LayoutTests/webrtc/vp9-vtb-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/vp9-vtb-expected.txt 2020-10-21 17:14:25 UTC (rev 268805)
@@ -0,0 +1,10 @@
+
+
+PASS VP9 in getCapabilities
+PASS Verify VP9 activation
+PASS Setting video exchange
+PASS Ensuring connection state is connected
+PASS Track is enabled, video should not be black
+PASS Track is disabled, video should be black
+PASS Track is enabled, video should not be black 2
+
Added: trunk/LayoutTests/webrtc/vp9-vtb.html (0 => 268805)
--- trunk/LayoutTests/webrtc/vp9-vtb.html (rev 0)
+++ trunk/LayoutTests/webrtc/vp9-vtb.html 2020-10-21 17:14:25 UTC (rev 268805)
@@ -0,0 +1,94 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>VP9 VTB in WebRTC</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <video id="video" autoplay playsInline width="320" height="240"></video>
+ <canvas id="canvas1" width="320" height="240"></canvas>
+ <canvas id="canvas2" width="320" height="240"></canvas>
+ <canvas id="canvas3" width="320" height="240"></canvas>
+ <script src =""
+ <script>
+let hasVP9;
+test(() => {
+ if (window.internals) {
+ window.internals.setWebRTCVP9Support(true);
+ window.internals.setWebRTCVP9VTBSupport(true);
+ }
+
+ codecs = RTCRtpSender.getCapabilities("video").codecs;
+ hasVP9 = codecs.some((codec) => { return codec.mimeType == "video/VP9"; });
+ assert_true(hasVP9);
+}, "VP9 in getCapabilities");
+
+if (hasVP9) {
+ promise_test(async (test) => {
+ const pc = new RTCPeerConnection();
+ pc.addTransceiver("video");
+ const description = await pc.createOffer();
+ pc.close();
+ assert_true(description.sdp.indexOf("VP9") !== -1, "VP9 codec is in the SDP");
+ }, "Verify VP9 activation")
+
+ var track;
+ var remoteTrack;
+ var receivingConnection;
+ promise_test((test) => {
+ return navigator.mediaDevices.getUserMedia({video: {width: 320, height: 240, facingMode: "environment"}}).then((localStream) => {
+ return new Promise((resolve, reject) => {
+ track = localStream.getVideoTracks()[0];
+
+ createConnections((firstConnection) => {
+ firstConnection.addTrack(track, localStream);
+ }, (secondConnection) => {
+ receivingConnection = secondConnection;
+ secondConnection._ontrack_ = (trackEvent) => {
+ remoteTrack = trackEvent.track;
+ resolve(trackEvent.streams[0]);
+ };
+ }, { observeOffer : (offer) => {
+ offer.sdp = setCodec(offer.sdp, "VP9");
+ return offer;
+ }
+ });
+ setTimeout(() => reject("Test timed out"), 5000);
+ });
+ }).then((remoteStream) => {
+ video.srcObject = remoteStream;
+ return video.play();
+ });
+ }, "Setting video exchange");
+
+ promise_test(() => {
+ if (receivingConnection.connectionState === "connected")
+ return Promise.resolve();
+ return new Promise((resolve, reject) => {
+ receivingConnection._onconnectionstatechange_ = () => {
+ if (receivingConnection.connectionState === "connected")
+ resolve();
+ };
+ setTimeout(() => reject("Test timed out"), 5000);
+ });
+ }, "Ensuring connection state is connected");
+
+ promise_test((test) => {
+ return checkVideoBlack(false, canvas1, video);
+ }, "Track is enabled, video should not be black");
+
+ promise_test((test) => {
+ track.enabled = false;
+ return checkVideoBlack(true, canvas2, video);
+ }, "Track is disabled, video should be black");
+
+ promise_test((test) => {
+ track.enabled = true;
+ return checkVideoBlack(false, canvas2, video);
+ }, "Track is enabled, video should not be black 2");
+}
+ </script>
+ </body>
+</html>
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2020-10-21 17:14:25 UTC (rev 268805)
@@ -1,3 +1,53 @@
+2020-10-21 Youenn Fablet <you...@apple.com>
+
+ WebRTC VP9 Decoder should be able to use VTB
+ https://bugs.webkit.org/show_bug.cgi?id=217811
+
+ Reviewed by Eric Carlson.
+
+ Add RTCVideoDecoderVTBVP9 as a VP9 decoder using the VTB API.
+ Enable this code path by default if VP9 is enabled and hardware VP9 decoding is supported.
+ Allow to override this setting for testing purposes.
+
+ Add SPI header files in case they are not available.
+
+ * Configurations/libwebrtc.iOS.exp:
+ * Configurations/libwebrtc.iOSsim.exp:
+ * Configurations/libwebrtc.mac.exp:
+ * Source/webrtc/sdk/WebKit/CMBaseObjectSPI.h: Added.
+ * Source/webrtc/sdk/WebKit/VTVideoDecoderSPI.h: Added.
+ * Source/webrtc/sdk/WebKit/WebKitDecoder.mm:
+ (webrtc::createWebKitDecoderFactory):
+ * Source/webrtc/sdk/WebKit/WebKitUtilities.h:
+ * Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp:
+ (webrtc::createWebKitVP9Decoder):
+ * Source/webrtc/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm:
+ (-[RTCWrappedNativeVideoDecoder implementationName]):
+ * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h:
+ * Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m:
+ (-[RTCDefaultVideoDecoderFactory initWithH265:vp9:vp9VTB:]):
+ (-[RTCDefaultVideoDecoderFactory createDecoder:]):
+ * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.h: Added.
+ * Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.mm: Added.
+ (RTCFrameDecodeParams::RTCFrameDecodeParams):
+ (VP9BufferToCMSampleBuffer):
+ (vp9DecompressionOutputCallback):
+ (-[RTCVideoDecoderVTBVP9 dealloc]):
+ (-[RTCVideoDecoderVTBVP9 startDecodeWithNumberOfCores:]):
+ (-[RTCVideoDecoderVTBVP9 decode:missingFrames:codecSpecificInfo:renderTimeMs:]):
+ (-[RTCVideoDecoderVTBVP9 decodeData:size:timeStamp:]):
+ (-[RTCVideoDecoderVTBVP9 setCallback:]):
+ (-[RTCVideoDecoderVTBVP9 setError:]):
+ (-[RTCVideoDecoderVTBVP9 releaseDecoder]):
+ (-[RTCVideoDecoderVTBVP9 resetDecompressionSession]):
+ (-[RTCVideoDecoderVTBVP9 configureDecompressionSession]):
+ (-[RTCVideoDecoderVTBVP9 destroyDecompressionSession]):
+ (-[RTCVideoDecoderVTBVP9 setVideoFormat:]):
+ (-[RTCVideoDecoderVTBVP9 implementationName]):
+ * Source/webrtc/sdk/objc/native/src/objc_video_decoder_factory.mm:
+ (webrtc::ObjCVideoDecoderFactory::CreateVideoDecoder):
+ * libwebrtc.xcodeproj/project.pbxproj:
+
2020-10-13 Keith Rollin <krol...@apple.com>
Remove leftover MACOSX_DEPLOYMENT_TARGET_macosx support
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2020-10-21 17:14:25 UTC (rev 268805)
@@ -104,7 +104,7 @@
__ZN6webrtc27SessionDescriptionInterface16RemoveCandidatesERKNSt3__16vectorIN7cricket9CandidateENS1_9allocatorIS4_EEEE
__ZNK6webrtc21IceCandidateInterface10server_urlEv
__ZN6webrtc20setApplicationStatusEb
-__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
+__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9ENS_12WebKitVP9VTBE
__ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
__ZN6webrtc29setH264HardwareEncoderAllowedEb
__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2020-10-21 17:14:25 UTC (rev 268805)
@@ -104,7 +104,7 @@
__ZN6webrtc27SessionDescriptionInterface16RemoveCandidatesERKNSt3__16vectorIN7cricket9CandidateENS1_9allocatorIS4_EEEE
__ZNK6webrtc21IceCandidateInterface10server_urlEv
__ZN6webrtc20setApplicationStatusEb
-__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
+__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9ENS_12WebKitVP9VTBE
__ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
__ZN6webrtc29setH264HardwareEncoderAllowedEb
__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2020-10-21 17:14:25 UTC (rev 268805)
@@ -104,7 +104,7 @@
__ZN6webrtc27SessionDescriptionInterface16RemoveCandidatesERKNSt3__16vectorIN7cricket9CandidateENS1_9allocatorIS4_EEEE
__ZNK6webrtc21IceCandidateInterface10server_urlEv
__ZN6webrtc20setApplicationStatusEb
-__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
+__ZN6webrtc26createWebKitDecoderFactoryENS_10WebKitH265ENS_9WebKitVP9ENS_12WebKitVP9VTBE
__ZN6webrtc26createWebKitEncoderFactoryENS_10WebKitH265ENS_9WebKitVP9E
__ZN6webrtc29setH264HardwareEncoderAllowedEb
__ZN6webrtc31setH264LowLatencyEncoderEnabledEb
Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/CMBaseObjectSPI.h (0 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/CMBaseObjectSPI.h (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/CMBaseObjectSPI.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
+#include <CoreMedia/CMBaseObject.h>
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ kCMBaseObject_ClassVersion_1 = 1,
+ kCMBaseObject_ClassVersion_2 = 2,
+ kCMBaseObject_ClassVersion_3 = 3
+};
+
+enum {
+ kCMBaseObject_ProtocolVersion_1 = 1
+};
+
+typedef struct OpaqueCMBaseObject *CMBaseObjectRef;
+typedef struct OpaqueCMBaseClass *CMBaseClassID;
+typedef struct OpaqueCMBaseProtocol *CMBaseProtocolID;
+
+typedef OSStatus (*CMBaseObjectCopyPropertyFunction)(CMBaseObjectRef, CFStringRef propertyKey, CFAllocatorRef, void *propertyValueOut);
+typedef OSStatus (*CMBaseObjectSetPropertyFunction)(CMBaseObjectRef object, CFStringRef propertyKey, CFTypeRef propertyValue);
+
+#pragma pack(push)
+#pragma pack()
+typedef struct {
+ CMBaseClassVersion version;
+ CFStringRef (*copyProtocolDebugDescription)(CMBaseObjectRef);
+} CMBaseProtocol;
+#pragma pack(pop)
+
+#pragma pack(push)
+#pragma pack()
+struct CMBaseProtocolVTable {
+ const struct OpaqueCMBaseProtocolVTableReserved *reserved;
+ const CMBaseProtocol *baseProtocol;
+};
+#pragma pack(pop)
+
+typedef struct CMBaseProtocolTableEntry {
+ CMBaseProtocolID (*getProtocolID)(void);
+ CMBaseProtocolVTable *protocolVTable;
+} CMBaseProtocolTableEntry;
+
+struct CMBaseProtocolTable {
+ uint32_t version;
+ uint32_t numSupportedProtocols;
+ CMBaseProtocolTableEntry * supportedProtocols;
+};
+
+#pragma pack(push, 4)
+typedef struct {
+ CMBaseClassVersion version;
+ size_t derivedStorageSize;
+
+ Boolean (*equal)(CMBaseObjectRef, CMBaseObjectRef);
+ OSStatus (*invalidate)(CMBaseObjectRef);
+ void (*finalize)(CMBaseObjectRef);
+ CFStringRef (*copyDebugDescription)(CMBaseObjectRef);
+
+ CMBaseObjectCopyPropertyFunction copyProperty;
+ CMBaseObjectSetPropertyFunction setProperty;
+ OSStatus (*notificationBarrier)(CMBaseObjectRef);
+ const CMBaseProtocolTable *protocolTable;
+} CMBaseClass;
+#pragma pack(pop)
+
+#pragma pack(push)
+#pragma pack()
+typedef struct {
+ const struct OpaqueCMBaseVTableReserved *reserved;
+ const CMBaseClass *baseClass;
+} CMBaseVTable;
+#pragma pack(pop)
+
+CM_EXPORT OSStatus CMDerivedObjectCreate(CFAllocatorRef, const CMBaseVTable*, CMBaseClassID, CMBaseObjectRef*);
+CM_EXPORT void *CMBaseObjectGetDerivedStorage(CMBaseObjectRef);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // __has_include && __has_include(<CoreFoundation/CFPriv.h>)
Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VTVideoDecoderSPI.h (0 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VTVideoDecoderSPI.h (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/VTVideoDecoderSPI.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
+#include <VideoToolbox/VTVideoDecoder.h>
+#include <VideoToolbox/VTVideoDecoderRegistration.h>
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#pragma pack(push, 4)
+
+typedef FourCharCode FigVideoCodecType;
+typedef struct OpaqueVTVideoDecoder* VTVideoDecoderRef;
+typedef struct OpaqueVTVideoDecoderSession* VTVideoDecoderSession;
+typedef struct OpaqueVTVideoDecoderFrame* VTVideoDecoderFrame;
+
+typedef OSStatus (*VTVideoDecoderFunction_CreateInstance)(FourCharCode codecType, CFAllocatorRef allocator, VTVideoDecoderRef *instanceOut);
+typedef OSStatus (*VTVideoDecoderFunction_StartSession)(VTVideoDecoderRef, VTVideoDecoderSession, CMVideoFormatDescriptionRef);
+typedef OSStatus (*VTVideoDecoderFunction_DecodeFrame)(VTVideoDecoderRef, VTVideoDecoderFrame, CMSampleBufferRef, VTDecodeFrameFlags, VTDecodeInfoFlags*);
+typedef OSStatus (*VTVideoDecoderFunction_TBD)();
+
+enum {
+ kVTVideoDecoder_ClassVersion_1 = 1,
+ kVTVideoDecoder_ClassVersion_2 = 2,
+ kVTVideoDecoder_ClassVersion_3 = 3,
+};
+
+typedef struct {
+ CMBaseClassVersion version;
+
+ VTVideoDecoderFunction_StartSession startSession;
+ VTVideoDecoderFunction_DecodeFrame decodeFrame;
+
+ VTVideoDecoderFunction_TBD copySupportedPropertyDictionary;
+ VTVideoDecoderFunction_TBD setProperties;
+
+ VTVideoDecoderFunction_TBD copySerializableProperties;
+ VTVideoDecoderFunction_TBD canAcceptFormatDescription;
+ VTVideoDecoderFunction_TBD finishDelayedFrames;
+ VTVideoDecoderFunction_TBD reserved7;
+ VTVideoDecoderFunction_TBD reserved8;
+ VTVideoDecoderFunction_TBD reserved9;
+} VTVideoDecoderClass;
+
+typedef struct {
+ CMBaseVTable base;
+ const VTVideoDecoderClass *videoDecoderClass;
+} VTVideoDecoderVTable;
+
+VT_EXPORT CMBaseClassID VTVideoDecoderGetClassID(void);
+VT_EXPORT CVPixelBufferPoolRef VTDecoderSessionGetPixelBufferPool(VTVideoDecoderSession session );
+VT_EXPORT OSStatus VTDecoderSessionSetPixelBufferAttributes(VTVideoDecoderSession session, CFDictionaryRef decompressorPixelBufferAttributes);
+VT_EXPORT OSStatus VTDecoderSessionEmitDecodedFrame(VTVideoDecoderSession session, VTVideoDecoderFrame frame, OSStatus status, VTDecodeInfoFlags infoFlags, CVImageBufferRef imageBuffer);
+VT_EXPORT OSStatus VTRegisterVideoDecoder(FigVideoCodecType, VTVideoDecoderFunction_CreateInstance);
+
+#pragma pack(pop)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // __has_include && __has_include(<CoreFoundation/CFPriv.h>)
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm 2020-10-21 17:14:25 UTC (rev 268805)
@@ -167,9 +167,9 @@
return std::make_unique<RemoteVideoDecoder>(identifier);
}
-std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265 supportsH265, WebKitVP9 supportsVP9)
+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]);
+ auto internalFactory = ObjCToNativeVideoDecoderFactory([[RTCDefaultVideoDecoderFactory alloc] initWithH265: supportsH265 == WebKitH265::On vp9: supportsVP9 == WebKitVP9::On 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/WebKitUtilities.h (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -42,9 +42,10 @@
enum class WebKitH265 { Off, On };
enum class WebKitVP9 { Off, On };
+enum class WebKitVP9VTB { Off, On };
std::unique_ptr<webrtc::VideoEncoderFactory> createWebKitEncoderFactory(WebKitH265, WebKitVP9);
-std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265, WebKitVP9);
+std::unique_ptr<webrtc::VideoDecoderFactory> createWebKitDecoderFactory(WebKitH265, WebKitVP9, WebKitVP9VTB);
void setApplicationStatus(bool isActive);
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP9Decoder.cpp 2020-10-21 17:14:25 UTC (rev 268805)
@@ -25,16 +25,15 @@
#include "WebKitVP9Decoder.h"
-#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
-
#include "WebKitUtilities.h"
-#include <CoreMedia/CMBaseObject.h>
-#include <VideoToolbox/VTVideoDecoder.h>
-#include <VideoToolbox/VTVideoDecoderRegistration.h>
+#include <VideoToolbox/VideoToolbox.h>
#include "modules/video_coding/codecs/vp9/vp9_impl.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/cpu_info.h"
+#include "CMBaseObjectSPI.h"
+#include "VTVideoDecoderSPI.h"
+
namespace webrtc {
static OSStatus createWebKitVP9Decoder(FigVideoCodecType, CFAllocatorRef allocator, VTVideoDecoderRef*);
@@ -85,15 +84,17 @@
finalizeVP9Decoder,
copyVP9DecoderDebugDescription,
nullptr, // CopyProperty
- nullptr // SetProperty
+ nullptr, // SetProperty
+ nullptr,
+ nullptr
};
static OSStatus startVP9DecoderSession(VTVideoDecoderRef, VTVideoDecoderSession, CMVideoFormatDescriptionRef);
static OSStatus decodeVP9DecoderFrame(VTVideoDecoderRef, VTVideoDecoderFrame, CMSampleBufferRef, VTDecodeFrameFlags, VTDecodeInfoFlags*);
-static const VTVideoDecoderClass WebKitVP9Decoder_VideoEncoderClass =
+static const VTVideoDecoderClass WebKitVP9Decoder_VideoDecoderClass =
{
- kVTVideoDecoder_ClassVersion_3,
+ kVTVideoDecoder_ClassVersion_1,
startVP9DecoderSession,
decodeVP9DecoderFrame,
nullptr, // VTVideoDecoderFunction_CopySupportedPropertyDictionary,
@@ -109,7 +110,7 @@
static const VTVideoDecoderVTable WebKitVP9DecoderVTable =
{
{ nullptr, &WebKitVP9Decoder_BaseClass },
- &WebKitVP9Decoder_VideoEncoderClass
+ &WebKitVP9Decoder_VideoDecoderClass
};
OSStatus createWebKitVP9Decoder(FigVideoCodecType, CFAllocatorRef allocator, VTVideoDecoderRef* decoderOut)
@@ -387,14 +388,3 @@
}
}
-
-#else // defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
-
-namespace webrtc {
-
-void registerWebKitVP9Decoder()
-{
-}
-
-}
-#endif // defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm 2020-10-21 17:14:25 UTC (rev 268805)
@@ -54,7 +54,9 @@
}
- (NSString *)implementationName {
+#if !defined(WEBRTC_WEBKIT_BUILD)
RTC_NOTREACHED();
+#endif
return nil;
}
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -21,7 +21,7 @@
RTC_OBJC_EXPORT
__attribute__((objc_runtime_name("WK_RTCDefaultVideoDecoderFactory")))
@interface RTCDefaultVideoDecoderFactory : NSObject <RTCVideoDecoderFactory>
-- (id)initWithH265:(bool)supportH265 vp9:(bool)supportsVP9;
+- (id)initWithH265:(bool)supportH265 vp9:(bool)supportsVP9 vp9VTB:(bool)supportsVP9VTB;
@end
NS_ASSUME_NONNULL_END
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m 2020-10-21 17:14:25 UTC (rev 268805)
@@ -17,6 +17,7 @@
#import "base/RTCVideoCodecInfo.h"
#if defined(RTC_ENABLE_VP9)
#import "api/video_codec/RTCVideoDecoderVP9.h"
+#import "RTCVideoDecoderVTBVP9.h"
#endif
#if !defined(RTC_DISABLE_H265)
#import "RTCH265ProfileLevelId.h"
@@ -23,17 +24,23 @@
#import "RTCVideoDecoderH265.h"
#endif
+#import <VideoToolbox/VideoToolbox.h>
+
@implementation RTCDefaultVideoDecoderFactory {
bool _supportsH265;
bool _supportsVP9;
+ bool _supportsVP9VTB;
}
-- (id)initWithH265:(bool)supportsH265 vp9:(bool)supportsVP9
+- (id)initWithH265:(bool)supportsH265 vp9:(bool)supportsVP9 vp9VTB:(bool)supportsVP9VTB
{
self = [super init];
if (self) {
_supportsH265 = supportsH265;
_supportsVP9 = supportsVP9;
+ // Use kCMVideoCodecType_VP9 once added to CMFormatDescription.h
+ _supportsVP9VTB = supportsVP9 && (supportsVP9VTB || VTIsHardwareDecodeSupported('vp09'));
+;
}
return self;
}
@@ -91,7 +98,11 @@
#endif
#if defined(RTC_ENABLE_VP9)
} else if ([info.name isEqualToString:kRTCVideoCodecVp9Name]) {
- return [RTCVideoDecoderVP9 vp9Decoder];
+ if (_supportsVP9VTB) {
+ return [[RTCVideoDecoderVTBVP9 alloc] init];
+ } else {
+ return [RTCVideoDecoderVP9 vp9Decoder];
+ }
#endif
}
Copied: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.h (from rev 268804, trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitUtilities.h) (0 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.h (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "RTCMacros.h"
+#import "RTCVideoDecoder.h"
+
+RTC_OBJC_EXPORT
+__attribute__((objc_runtime_name("WK_RTCVideoDecoderVTBVP9")))
+@interface RTCVideoDecoderVTBVP9 : NSObject <RTCVideoDecoder>
+- (NSInteger)decodeData:(const uint8_t *)data
+ size:(size_t)size
+ timeStamp:(uint32_t)timeStamp;
+@end
Added: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.mm (0 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.mm (rev 0)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderVTBVP9.mm 2020-10-21 17:14:25 UTC (rev 268805)
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * VP9 decoding through VTB, highly based on RTCVideoDecoderH264.mm
+ */
+
+#import "RTCVideoDecoderVTBVP9.h"
+
+#if defined(RTC_ENABLE_VP9)
+
+#import <VideoToolbox/VideoToolbox.h>
+
+#import "base/RTCVideoFrame.h"
+#import "base/RTCVideoFrameBuffer.h"
+#import "components/video_frame_buffer/RTCCVPixelBuffer.h"
+#import "helpers.h"
+#import "helpers/scoped_cftyperef.h"
+
+#include "modules/video_coding/include/video_error_codes.h"
+#include "rtc_base/checks.h"
+#include "rtc_base/logging.h"
+#include "rtc_base/time_utils.h"
+
+// Struct that we pass to the decoder per frame to decode. We receive it again
+// in the decoder callback.
+struct RTCFrameDecodeParams {
+ RTCFrameDecodeParams(RTCVideoDecoderCallback cb, int64_t ts) : callback(cb), timestamp(ts) {}
+ RTCVideoDecoderCallback callback;
+ int64_t timestamp;
+};
+
+@interface RTCVideoDecoderVTBVP9 ()
+- (void)setError:(OSStatus)error;
+@end
+
+CMSampleBufferRef VP9BufferToCMSampleBuffer(const uint8_t* buffer,
+ size_t buffer_size,
+ CMVideoFormatDescriptionRef video_format) {
+ CMBlockBufferRef new_block_buffer;
+ if (auto error = CMBlockBufferCreateWithMemoryBlock(kCFAllocatorDefault, NULL, buffer_size, kCFAllocatorDefault, NULL, 0, buffer_size, kCMBlockBufferAssureMemoryNowFlag, &new_block_buffer)) {
+ RTC_LOG(LS_ERROR) << "VP9BufferToCMSampleBuffer CMBlockBufferCreateWithMemoryBlock failed with: " << error;
+ return nullptr;
+ }
+ auto block_buffer = rtc::ScopedCF(new_block_buffer);
+
+ if (auto error = CMBlockBufferReplaceDataBytes(buffer, block_buffer.get(), 0, buffer_size)) {
+ RTC_LOG(LS_ERROR) << "VP9BufferToCMSampleBuffer CMBlockBufferReplaceDataBytes failed with: " << error;
+ return nullptr;
+ }
+
+ CMSampleBufferRef sample_buffer = nullptr;
+ if (auto error = CMSampleBufferCreate(kCFAllocatorDefault, block_buffer.get(), true, nullptr, nullptr, video_format, 1, 0, nullptr, 0, nullptr, &sample_buffer)) {
+ RTC_LOG(LS_ERROR) << "VP9BufferToCMSampleBuffer CMSampleBufferCreate failed with: " << error;
+ return nullptr;
+ }
+ return sample_buffer;
+}
+
+// This is the callback function that VideoToolbox calls when decode is
+// complete.
+void vp9DecompressionOutputCallback(void *decoderRef,
+ void *params,
+ OSStatus status,
+ VTDecodeInfoFlags infoFlags,
+ CVImageBufferRef imageBuffer,
+ CMTime timestamp,
+ CMTime duration) {
+ std::unique_ptr<RTCFrameDecodeParams> decodeParams(
+ reinterpret_cast<RTCFrameDecodeParams *>(params));
+ if (status != noErr) {
+ RTCVideoDecoderVTBVP9 *decoder = (__bridge RTCVideoDecoderVTBVP9 *)decoderRef;
+ [decoder setError:status];
+ RTC_LOG(LS_ERROR) << "Failed to decode frame. Status: " << status;
+ return;
+ }
+ RTCCVPixelBuffer *frameBuffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer:imageBuffer];
+ RTCVideoFrame *decodedFrame =
+ [[RTCVideoFrame alloc] initWithBuffer:frameBuffer
+ rotation:RTCVideoRotation_0
+ timeStampNs:CMTimeGetSeconds(timestamp) * rtc::kNumNanosecsPerSec];
+ decodedFrame.timeStamp = decodeParams->timestamp;
+ decodeParams->callback(decodedFrame);
+}
+
+// Decoder.
+@implementation RTCVideoDecoderVTBVP9 {
+ CMVideoFormatDescriptionRef _videoFormat;
+ VTDecompressionSessionRef _decompressionSession;
+ RTCVideoDecoderCallback _callback;
+ OSStatus _error;
+ int32_t _width;
+ int32_t _height;
+}
+
+- (void)dealloc {
+ [self destroyDecompressionSession];
+ [self setVideoFormat:nullptr];
+}
+
+- (NSInteger)startDecodeWithNumberOfCores:(int)numberOfCores {
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+- (NSInteger)decode:(RTCEncodedImage *)inputImage
+ missingFrames:(BOOL)missingFrames
+ codecSpecificInfo:(nullable id<RTCCodecSpecificInfo>)info
+ renderTimeMs:(int64_t)renderTimeMs {
+ RTC_DCHECK(inputImage.buffer);
+ if (inputImage.frameType == RTCFrameTypeVideoFrameKey) {
+ _width = inputImage.encodedWidth;
+ _height = inputImage.encodedHeight;
+ }
+ return [self decodeData: (uint8_t *)inputImage.buffer.bytes size: inputImage.buffer.length timeStamp: inputImage.timeStamp];
+}
+
+- (NSInteger)decodeData:(const uint8_t *)data
+ size:(size_t)size
+ timeStamp:(uint32_t)timeStamp {
+
+ if (_error != noErr) {
+ RTC_LOG(LS_WARNING) << "Last frame decode failed.";
+ _error = noErr;
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ CMVideoFormatDescriptionRef formatDescription = nullptr;
+ // Use kCMVideoCodecType_VP9 once added to CMFormatDescription.h
+ if (noErr != CMVideoFormatDescriptionCreate(kCFAllocatorDefault, 'vp09', _width, _height, nullptr, &formatDescription))
+ return WEBRTC_VIDEO_CODEC_ERROR;
+
+ rtc::ScopedCFTypeRef<CMVideoFormatDescriptionRef> inputFormat = rtc::ScopedCF(formatDescription);
+ if (inputFormat) {
+ // Check if the video format has changed, and reinitialize decoder if
+ // needed.
+ if (!CMFormatDescriptionEqual(inputFormat.get(), _videoFormat)) {
+ [self setVideoFormat:inputFormat.get()];
+ int resetDecompressionSessionError = [self resetDecompressionSession];
+ if (resetDecompressionSessionError != WEBRTC_VIDEO_CODEC_OK) {
+ return resetDecompressionSessionError;
+ }
+ }
+ }
+ if (!_videoFormat) {
+ // We received a frame but we don't have format information so we can't
+ // decode it.
+ // This can happen after backgrounding. We need to wait for the next
+ // sps/pps before we can resume so we request a keyframe by returning an
+ // error.
+ RTC_LOG(LS_WARNING) << "Missing video format. Frame with sps/pps required.";
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ auto sampleBuffer = rtc::ScopedCF(VP9BufferToCMSampleBuffer(data, size, _videoFormat));
+ if (!sampleBuffer) {
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+
+ VTDecodeFrameFlags decodeFlags = kVTDecodeFrame_EnableAsynchronousDecompression;
+ std::unique_ptr<RTCFrameDecodeParams> frameDecodeParams;
+ frameDecodeParams.reset(new RTCFrameDecodeParams(_callback, timeStamp));
+ OSStatus status = VTDecompressionSessionDecodeFrame(
+ _decompressionSession, sampleBuffer.get(), decodeFlags, frameDecodeParams.release(), nullptr);
+#if defined(WEBRTC_IOS)
+ // Re-initialize the decoder if we have an invalid session while the app is
+ // active or decoder malfunctions and retry the decode request.
+ if ((status == kVTInvalidSessionErr || status == kVTVideoDecoderMalfunctionErr) &&
+ [self resetDecompressionSession] == WEBRTC_VIDEO_CODEC_OK) {
+ RTC_LOG(LS_INFO) << "Failed to decode frame with code: " << status
+ << " retrying decode after decompression session reset";
+ frameDecodeParams.reset(new RTCFrameDecodeParams(_callback, timeStamp));
+ status = VTDecompressionSessionDecodeFrame(
+ _decompressionSession, sampleBuffer.get(), decodeFlags, frameDecodeParams.release(), nullptr);
+ }
+#endif
+ if (status != noErr) {
+ RTC_LOG(LS_ERROR) << "Failed to decode frame with code: " << status;
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+- (void)setCallback:(RTCVideoDecoderCallback)callback {
+ _callback = callback;
+}
+
+- (void)setError:(OSStatus)error {
+ _error = error;
+}
+
+- (NSInteger)releaseDecoder {
+ // Need to invalidate the session so that callbacks no longer occur and it
+ // is safe to null out the callback.
+ [self destroyDecompressionSession];
+ [self setVideoFormat:nullptr];
+ _callback = nullptr;
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+#pragma mark - Private
+
+- (int)resetDecompressionSession {
+ [self destroyDecompressionSession];
+
+ // Need to wait for the first SPS to initialize decoder.
+ if (!_videoFormat) {
+ return WEBRTC_VIDEO_CODEC_OK;
+ }
+
+ // Set keys for OpenGL and IOSurface compatibilty, which makes the encoder
+ // create pixel buffers with GPU backed memory. The intent here is to pass
+ // the pixel buffers directly so we avoid a texture upload later during
+ // rendering. This currently is moot because we are converting back to an
+ // I420 frame after decode, but eventually we will be able to plumb
+ // CVPixelBuffers directly to the renderer.
+ // TODO(tkchin): Maybe only set OpenGL/IOSurface keys if we know that that
+ // we can pass CVPixelBuffers as native handles in decoder output.
+ static size_t const attributesSize = 3;
+ CFTypeRef keys[attributesSize] = {
+#if defined(WEBRTC_IOS)
+ kCVPixelBufferOpenGLESCompatibilityKey,
+#elif defined(WEBRTC_MAC)
+ kCVPixelBufferOpenGLCompatibilityKey,
+#endif
+ kCVPixelBufferIOSurfacePropertiesKey,
+ kCVPixelBufferPixelFormatTypeKey
+ };
+ CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
+ int64_t nv12type = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
+ CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &nv12type);
+ CFTypeRef values[attributesSize] = {kCFBooleanTrue, ioSurfaceValue, pixelFormat};
+ CFDictionaryRef attributes = CreateCFTypeDictionary(keys, values, attributesSize);
+ if (ioSurfaceValue) {
+ CFRelease(ioSurfaceValue);
+ ioSurfaceValue = nullptr;
+ }
+ if (pixelFormat) {
+ CFRelease(pixelFormat);
+ pixelFormat = nullptr;
+ }
+ VTDecompressionOutputCallbackRecord record = {
+ vp9DecompressionOutputCallback, (__bridge void *)self,
+ };
+ OSStatus status = VTDecompressionSessionCreate(
+ nullptr, _videoFormat, nullptr, attributes, &record, &_decompressionSession);
+ CFRelease(attributes);
+ if (status != noErr) {
+ RTC_LOG(LS_ERROR) << "Failed to create decompression session: " << status;
+ [self destroyDecompressionSession];
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ [self configureDecompressionSession];
+
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+- (void)configureDecompressionSession {
+ RTC_DCHECK(_decompressionSession);
+#if defined(WEBRTC_IOS)
+ VTSessionSetProperty(_decompressionSession, kVTDecompressionPropertyKey_RealTime, kCFBooleanTrue);
+#endif
+}
+
+- (void)destroyDecompressionSession {
+ if (_decompressionSession) {
+#if defined(WEBRTC_WEBKIT_BUILD)
+ VTDecompressionSessionWaitForAsynchronousFrames(_decompressionSession);
+#else
+#if defined(WEBRTC_IOS)
+ if ([UIDevice isIOS11OrLater]) {
+ VTDecompressionSessionWaitForAsynchronousFrames(_decompressionSession);
+ }
+#endif
+#endif
+ VTDecompressionSessionInvalidate(_decompressionSession);
+ CFRelease(_decompressionSession);
+ _decompressionSession = nullptr;
+ }
+}
+
+- (void)setVideoFormat:(CMVideoFormatDescriptionRef)videoFormat {
+ if (_videoFormat == videoFormat) {
+ return;
+ }
+ if (_videoFormat) {
+ CFRelease(_videoFormat);
+ }
+ _videoFormat = videoFormat;
+ if (_videoFormat) {
+ CFRetain(_videoFormat);
+ }
+}
+
+- (NSString *)implementationName {
+ return @"VideoToolbox";
+}
+
+@end
+
+#endif // defined(RTC_ENABLE_VP9)
Modified: trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/native/src/objc_video_decoder_factory.mm (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/native/src/objc_video_decoder_factory.mm 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/native/src/objc_video_decoder_factory.mm 2020-10-21 17:14:25 UTC (rev 268805)
@@ -100,7 +100,11 @@
// Because of symbol conflict, isKindOfClass doesn't work as expected.
// See https://bugs.webkit.org/show_bug.cgi?id=198782.
// if ([decoder isKindOfClass:[RTCWrappedNativeVideoDecoder class]]) {
- if ([codecName isEqual:@"VP8"] || [codecName isEqual:@"VP9"]) {
+#if !defined(WEBRTC_WEBKIT_BUILD)
+ if ([codecName isEqual:@"VP8"] || [codecName isEqual:@"VP9"]) {
+#else
+ if (![decoder.implementationName isEqual:@"VideoToolbox"]) {
+#endif
return [(RTCWrappedNativeVideoDecoder *)decoder releaseWrappedDecoder];
} else {
return std::unique_ptr<ObjCVideoDecoder>(new ObjCVideoDecoder(decoder));
Modified: trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj (268804 => 268805)
--- trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj 2020-10-21 17:14:25 UTC (rev 268805)
@@ -89,6 +89,9 @@
41299B922127367B00B3414B /* isac_vad.h in Headers */ = {isa = PBXBuildFile; fileRef = 41299B8F2127367B00B3414B /* isac_vad.h */; };
41299B932127367B00B3414B /* pitch_filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 41299B902127367B00B3414B /* pitch_filter.h */; };
41299B972127369100B3414B /* fake_network_pipe.h in Headers */ = {isa = PBXBuildFile; fileRef = 41299B952127369100B3414B /* fake_network_pipe.h */; };
+ 412FF9342539B764001DF036 /* RTCVideoDecoderVTBVP9.mm in Sources */ = {isa = PBXBuildFile; fileRef = 412FF9322539B3C9001DF036 /* RTCVideoDecoderVTBVP9.mm */; };
+ 412FF937253D8F0A001DF036 /* VTVideoDecoderSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 412FF935253D8F0A001DF036 /* VTVideoDecoderSPI.h */; };
+ 412FF938253D8F0A001DF036 /* CMBaseObjectSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 412FF936253D8F0A001DF036 /* CMBaseObjectSPI.h */; };
413091F31EF8CF9200757C55 /* rtp_video_stream_receiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 413091F11EF8CF9100757C55 /* rtp_video_stream_receiver.h */; };
413091F41EF8CF9200757C55 /* rtp_video_stream_receiver.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413091F21EF8CF9100757C55 /* rtp_video_stream_receiver.cc */; };
413091FB1EF8CFF800757C55 /* builtin_audio_encoder_factory.cc in Sources */ = {isa = PBXBuildFile; fileRef = 413091F91EF8CFF300757C55 /* builtin_audio_encoder_factory.cc */; };
@@ -1422,7 +1425,6 @@
417953B8216982420028266B /* RTCVideoDecoderFactoryH264.m in Sources */ = {isa = PBXBuildFile; fileRef = 417953B0216982400028266B /* RTCVideoDecoderFactoryH264.m */; };
417953B9216982420028266B /* RTCVideoEncoderFactoryH264.m in Sources */ = {isa = PBXBuildFile; fileRef = 417953B1216982400028266B /* RTCVideoEncoderFactoryH264.m */; };
417953BA216982420028266B /* RTCCodecSpecificInfoH264+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 417953B2216982410028266B /* RTCCodecSpecificInfoH264+Private.h */; };
- 417953BB216982420028266B /* RTCDefaultVideoDecoderFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 417953B3216982420028266B /* RTCDefaultVideoDecoderFactory.h */; };
417953BC2169824B0028266B /* helpers.cc in Sources */ = {isa = PBXBuildFile; fileRef = 411521D32169821F000ABAF7 /* helpers.cc */; };
417953BD2169824B0028266B /* helpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 416225F5216981F400A91C9B /* helpers.h */; };
417953BF2169824B0028266B /* nalu_rewriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 411521D521698220000ABAF7 /* nalu_rewriter.h */; };
@@ -2236,7 +2238,6 @@
41ECEABC206403C2009D5141 /* WebKitUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEABB206403C1009D5141 /* WebKitUtilities.h */; };
41ECEABE20640498009D5141 /* WebKitUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEABD20640498009D5141 /* WebKitUtilities.mm */; };
41ECEAC120640F28009D5141 /* NSString+StdString.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEABF20640F27009D5141 /* NSString+StdString.h */; };
- 41ECEAFC20646664009D5141 /* EncoderUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEAF920646663009D5141 /* EncoderUtilities.h */; };
41ECEAFD20646664009D5141 /* VideoProcessingSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41ECEAFA20646663009D5141 /* VideoProcessingSoftLink.cpp */; };
41ECEAFE20646664009D5141 /* VideoProcessingSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */; };
41EED77C2152ED8E000F2A16 /* avg_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 419478832152ED4300275257 /* avg_neon.c */; };
@@ -4345,6 +4346,10 @@
41299B9B212736DE00B3414B /* pitch_info.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pitch_info.h; sourceTree = "<group>"; };
41299B9C212736DE00B3414B /* rnn.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = rnn.cc; sourceTree = "<group>"; };
41299B9D212736DF00B3414B /* spectral_features_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spectral_features_internal.h; sourceTree = "<group>"; };
+ 412FF9322539B3C9001DF036 /* RTCVideoDecoderVTBVP9.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RTCVideoDecoderVTBVP9.mm; sourceTree = "<group>"; };
+ 412FF9332539B3C9001DF036 /* RTCVideoDecoderVTBVP9.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCVideoDecoderVTBVP9.h; sourceTree = "<group>"; };
+ 412FF935253D8F0A001DF036 /* VTVideoDecoderSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTVideoDecoderSPI.h; sourceTree = "<group>"; };
+ 412FF936253D8F0A001DF036 /* CMBaseObjectSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMBaseObjectSPI.h; sourceTree = "<group>"; };
413091F11EF8CF9100757C55 /* rtp_video_stream_receiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtp_video_stream_receiver.h; sourceTree = "<group>"; };
413091F21EF8CF9100757C55 /* rtp_video_stream_receiver.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rtp_video_stream_receiver.cc; sourceTree = "<group>"; };
413091F91EF8CFF300757C55 /* builtin_audio_encoder_factory.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = builtin_audio_encoder_factory.cc; path = audio_codecs/builtin_audio_encoder_factory.cc; sourceTree = "<group>"; };
@@ -6694,7 +6699,6 @@
41ECEABB206403C1009D5141 /* WebKitUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitUtilities.h; sourceTree = "<group>"; };
41ECEABD20640498009D5141 /* WebKitUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitUtilities.mm; sourceTree = "<group>"; };
41ECEABF20640F27009D5141 /* NSString+StdString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+StdString.h"; path = "Common/NSString+StdString.h"; sourceTree = "<group>"; };
- 41ECEAF920646663009D5141 /* EncoderUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoderUtilities.h; sourceTree = "<group>"; };
41ECEAFA20646663009D5141 /* VideoProcessingSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoProcessingSoftLink.cpp; sourceTree = "<group>"; };
41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoProcessingSoftLink.h; sourceTree = "<group>"; };
41EED7782152ED83000F2A16 /* save_reg_neon.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; path = save_reg_neon.asm; sourceTree = "<group>"; };
@@ -10056,6 +10060,8 @@
416225F4216981F300A91C9B /* RTCVideoDecoderH264.mm */,
41009200242E3A4300C5EDA2 /* RTCVideoDecoderH265.h */,
41009207242E3A4500C5EDA2 /* RTCVideoDecoderH265.mm */,
+ 412FF9332539B3C9001DF036 /* RTCVideoDecoderVTBVP9.h */,
+ 412FF9322539B3C9001DF036 /* RTCVideoDecoderVTBVP9.mm */,
416225EF216981F200A91C9B /* RTCVideoEncoderFactoryH264.h */,
417953B1216982400028266B /* RTCVideoEncoderFactoryH264.m */,
416225EC216981F200A91C9B /* RTCVideoEncoderH264.h */,
@@ -10751,9 +10757,10 @@
419C84961FE2FE9C0040C30F /* WebKit */ = {
isa = PBXGroup;
children = (
- 41ECEAF920646663009D5141 /* EncoderUtilities.h */,
+ 412FF936253D8F0A001DF036 /* CMBaseObjectSPI.h */,
41ECEAFA20646663009D5141 /* VideoProcessingSoftLink.cpp */,
41ECEAFB20646664009D5141 /* VideoProcessingSoftLink.h */,
+ 412FF935253D8F0A001DF036 /* VTVideoDecoderSPI.h */,
41E84BC92434C4A200D34E41 /* WebKitDecoder.h */,
41E84BCA2434C4A300D34E41 /* WebKitDecoder.mm */,
4158649623BE05E800A0A61E /* WebKitEncoder.h */,
@@ -16028,6 +16035,7 @@
5C08852A1E4A99D200403995 /* cipher.h in Headers */,
5CDD86A21E43B99400621E92 /* circular_buffer.h in Headers */,
4131C373234B957D0028A615 /* clockdrift_detector.h in Headers */,
+ 412FF938253D8F0A001DF036 /* CMBaseObjectSPI.h in Headers */,
41FCBB7621B1FFA400A5DF27 /* cocoa_threading.h in Headers */,
5CDD87B01E43BC0500621E92 /* codec.h in Headers */,
41433CF31F79B33400387B4D /* codec.h in Headers */,
@@ -16168,7 +16176,6 @@
5CDD85A01E43B5C000621E92 /* encoder_rtcp_feedback.h in Headers */,
4189393E242A70AE007FDC41 /* encoder_settings.h in Headers */,
4131C283234B8CC40028A615 /* encoder_simulcast_proxy.h in Headers */,
- 41ECEAFC20646664009D5141 /* EncoderUtilities.h in Headers */,
5CDD8B991E43C2B500621E92 /* energy_inverse.h in Headers */,
5CDD8B9B1E43C2B500621E92 /* enh_upsample.h in Headers */,
5CDD8B9F1E43C2B500621E92 /* enhancer.h in Headers */,
@@ -16726,7 +16733,6 @@
413E678A216987B900EF37ED /* RTCCVPixelBuffer.h in Headers */,
413A24551FE1991A00373E99 /* RTCDataChannel.h in Headers */,
413A24701FE1991A00373E99 /* RTCDataChannelConfiguration.h in Headers */,
- 417953BB216982420028266B /* RTCDefaultVideoDecoderFactory.h in Headers */,
417953C22169824B0028266B /* RTCDefaultVideoEncoderFactory.h in Headers */,
413A24521FE1991A00373E99 /* RTCDispatcher.h in Headers */,
413A245D1FE1991A00373E99 /* RTCEAGLVideoView.h in Headers */,
@@ -17204,6 +17210,7 @@
4131BFA7234B88A60028A615 /* vp9_profile.h in Headers */,
5CDD8BF41E43C2B500621E92 /* vq3.h in Headers */,
5CDD8BF61E43C2B500621E92 /* vq4.h in Headers */,
+ 412FF937253D8F0A001DF036 /* VTVideoDecoderSPI.h in Headers */,
5C4B4C811E431F9C002651C8 /* wav_file.h in Headers */,
5C4B4C841E431F9C002651C8 /* wav_header.h in Headers */,
4131C163234B89E20028A615 /* weak_ptr.h in Headers */,
@@ -19399,6 +19406,7 @@
41E84BD224373C1400D34E41 /* RTCVideoDecoderH265.mm in Sources */,
413E67682169854B00EF37ED /* RTCVideoDecoderVP8.mm in Sources */,
414035EF24AA0EBC00BCE9B2 /* RTCVideoDecoderVP9.mm in Sources */,
+ 412FF9342539B764001DF036 /* RTCVideoDecoderVTBVP9.mm in Sources */,
417953B9216982420028266B /* RTCVideoEncoderFactoryH264.m in Sources */,
417953CA2169824B0028266B /* RTCVideoEncoderH264.mm in Sources */,
41E84BD324373C1A00D34E41 /* RTCVideoEncoderH265.mm in Sources */,
Modified: trunk/Source/WebCore/ChangeLog (268804 => 268805)
--- trunk/Source/WebCore/ChangeLog 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/WebCore/ChangeLog 2020-10-21 17:14:25 UTC (rev 268805)
@@ -1,3 +1,22 @@
+2020-10-21 Youenn Fablet <you...@apple.com>
+
+ WebRTC VP9 Decoder should be able to use VTB
+ https://bugs.webkit.org/show_bug.cgi?id=217811
+
+ Reviewed by Eric Carlson.
+
+ Add testing support to enable VP9 decoding through VTB for WebRTC.
+
+ Test: webrtc/vp9-vtb.html
+
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
+ * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
+ (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
+ * testing/Internals.cpp:
+ (WebCore::Internals::setWebRTCVP9VTBSupport):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2020-10-21 Zalan Bujtas <za...@apple.com>
[LFC][Integration] Disable image map content
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (268804 => 268805)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -108,8 +108,10 @@
void setH265Support(bool value) { m_supportsH265 = value; }
void setVP9Support(bool value) { m_supportsVP9 = value; }
+ void setVP9VTBSupport(bool value) { m_supportsVP9VTB = value; }
bool isSupportingH265() const { return m_supportsH265; }
bool isSupportingVP9() const { return m_supportsVP9; }
+ bool isSupportingVP9VTB() const { return m_supportsVP9VTB; }
virtual void disableNonLocalhostConnections() { m_disableNonLocalhostConnections = true; }
// Callback is executed on a background thread.
@@ -153,6 +155,7 @@
bool m_disableNonLocalhostConnections { false };
bool m_supportsH265 { false };
bool m_supportsVP9 { false };
+ bool m_supportsVP9VTB { false };
bool m_enableLogging { true };
bool m_useDTLS10 { false };
#endif
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp (268804 => 268805)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp 2020-10-21 17:14:25 UTC (rev 268805)
@@ -63,7 +63,7 @@
if (!webRTCAvailable())
return nullptr;
- return webrtc::createWebKitDecoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off);
+ return webrtc::createWebKitDecoderFactory(isSupportingH265() ? webrtc::WebKitH265::On : webrtc::WebKitH265::Off, isSupportingVP9() ? webrtc::WebKitVP9::On : webrtc::WebKitVP9::Off, isSupportingVP9VTB() ? webrtc::WebKitVP9VTB::On : webrtc::WebKitVP9VTB::Off);
}
std::unique_ptr<webrtc::VideoEncoderFactory> LibWebRTCProviderCocoa::createEncoderFactory()
Modified: trunk/Source/WebCore/testing/Internals.cpp (268804 => 268805)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-10-21 17:14:25 UTC (rev 268805)
@@ -1568,6 +1568,16 @@
#endif
}
+void Internals::setWebRTCVP9VTBSupport(bool value)
+{
+#if USE(LIBWEBRTC)
+ if (auto* page = contextDocument()->page()) {
+ page->libWebRTCProvider().setVP9VTBSupport(value);
+ page->libWebRTCProvider().clearFactory();
+ }
+#endif
+}
+
void Internals::setEnableWebRTCEncryption(bool value)
{
#if USE(LIBWEBRTC)
Modified: trunk/Source/WebCore/testing/Internals.h (268804 => 268805)
--- trunk/Source/WebCore/testing/Internals.h 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/WebCore/testing/Internals.h 2020-10-21 17:14:25 UTC (rev 268805)
@@ -599,6 +599,7 @@
void applyRotationForOutgoingVideoSources(RTCPeerConnection&);
void setWebRTCH265Support(bool);
void setWebRTCVP9Support(bool);
+ void setWebRTCVP9VTBSupport(bool);
void setEnableWebRTCEncryption(bool);
void setUseDTLS10(bool);
void setUseGPUProcessForWebRTC(bool);
Modified: trunk/Source/WebCore/testing/Internals.idl (268804 => 268805)
--- trunk/Source/WebCore/testing/Internals.idl 2020-10-21 17:10:14 UTC (rev 268804)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-10-21 17:14:25 UTC (rev 268805)
@@ -793,6 +793,7 @@
[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 setWebRTCVP9VTBSupport(boolean allowed);
[Conditional=MEDIA_STREAM] undefined setMockAudioTrackChannelNumber(MediaStreamTrack track, unsigned short count);
[Conditional=MEDIA_STREAM] undefined setShouldInterruptAudioOnPageVisibilityChange(boolean shouldInterrupt);