From 111902f17da1086c9096863b16d9ca382bf64f0a Mon Sep 17 00:00:00 2001 From: Youenn Fablet Date: Fri, 2 Dec 2022 08:02:28 -0800 Subject: [PATCH] Use dav1d decoder instead of libaom decoder https://bugs.webkit.org/show_bug.cgi?id=248523 rdar://problem/102804765 Reviewed by Jean-Yves Avenard. dav1d decoder is more efficient than libaom decoder so it is best to use dav1d. dav1d is a librarly linked in WebCore so we create a dav1d webrtc decoder in WebCore and not libwebrtc. We integrate this decoder at WebKit level. We have to export more headers, including libyuv from libwebrtc to be used in WebCore. We update xcconfig for that purpose. We link dav1d conditionnaly on ENABLE_WEB_RTC if it is not already linked through libavif. * Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp: * Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp: * Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp: * Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig: * Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig: * Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.h: * Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm: (webrtc::RemoteVideoDecoder::RemoteVideoDecoder): (webrtc::RemoteVideoDecoderFactory::CreateVideoDecoder): * Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m: (-[RTCDefaultVideoDecoderFactory supportedCodecs]): (-[RTCDefaultVideoDecoderFactory createDecoder:]): * Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m: (+[RTCDefaultVideoEncoderFactory supportedCodecsWithH265:vp9Profile0:vp9Profile2:av1:]): (-[RTCDefaultVideoEncoderFactory createEncoder:]): * Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj: * Source/WebCore/PAL/libavif/dav1d/dav1d.xcodeproj/project.pbxproj: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.cpp: Added. (WebCore::ScopedDav1dData::~ScopedDav1dData): (WebCore::ScopedDav1dData::Data): (WebCore::ScopedDav1dPicture::~ScopedDav1dPicture): (WebCore::ScopedDav1dPicture::Picture): (WebCore::NullFreeCallback): (WebCore::Dav1dDecoder::Dav1dDecoder): (WebCore::Dav1dDecoder::~Dav1dDecoder): (WebCore::Dav1dDecoder::Configure): (WebCore::Dav1dDecoder::RegisterDecodeCompleteCallback): (WebCore::Dav1dDecoder::Release): (WebCore::Dav1dDecoder::GetDecoderInfo const): (WebCore::Dav1dDecoder::ImplementationName const): (WebCore::Dav1dDecoder::Decode): (WebCore::createLibWebRTCDav1dDecoder): * Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.h: Added. * Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::createVideoDecoder): (WebKit::releaseVideoDecoder): (WebKit::decodeVideoFrame): (WebKit::registerDecodeCompleteCallback): Canonical link: https://commits.webkit.org/257283@main --- .../Configurations/libwebrtc.iOS.exp | 15 +- .../Configurations/libwebrtc.iOSsim.exp | 15 +- .../Configurations/libwebrtc.mac.exp | 15 +- .../Configurations/libwebrtc.xcconfig | 2 +- .../libwebrtc/Configurations/libyuv.xcconfig | 6 +- .../Source/webrtc/sdk/WebKit/WebKitDecoder.h | 12 +- .../Source/webrtc/sdk/WebKit/WebKitDecoder.mm | 15 +- .../RTCDefaultVideoDecoderFactory.m | 6 +- .../RTCDefaultVideoEncoderFactory.m | 6 +- .../libwebrtc.xcodeproj/project.pbxproj | 149 +++++++++++- .../WebCore/PAL/Configurations/PAL.xcconfig | 9 +- .../dav1d/dav1d.xcodeproj/project.pbxproj | 14 +- .../WebCore/WebCore.xcodeproj/project.pbxproj | 8 + .../libwebrtc/LibWebRTCDav1dDecoder.cpp | 223 ++++++++++++++++++ .../libwebrtc/LibWebRTCDav1dDecoder.h | 44 ++++ .../GPUProcess/webrtc/LibWebRTCCodecsProxy.mm | 2 + Source/WebKit/Shared/VideoCodecType.h | 6 +- .../WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp | 22 +- 18 files changed, 534 insertions(+), 35 deletions(-) create mode 100644 Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.cpp create mode 100644 Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.h diff --git a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp index 2ba30ae3fca2..8c8cf02061eb 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp +++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp @@ -204,7 +204,7 @@ __ZN6webrtc17setDecodingFormatEPvPKhmtt __ZN6webrtc11decodeFrameEPvxPKhm __ZN6webrtc24videoDecoderTaskCompleteEPvjjP10__CVBuffer __ZN6webrtc24videoDecoderTaskCompleteEPvjjS0_PFP10__CVBufferS0_EPFvS0_Eii -__ZN6webrtc24setVideoDecoderCallbacksEPFPvRKNS_14SdpVideoFormatEEPFiS0_EPFiS0_jPKhmttEPFiS0_S0_E +__ZN6webrtc24setVideoDecoderCallbacksEPFNS_18WebKitVideoDecoderERKNS_14SdpVideoFormatEEPFiPvEPFiS6_jPKhmttEPFiS6_S6_E __ZN6webrtc24toWebRTCVideoFrameBufferEPvPFP10__CVBufferS0_EPFvS0_Eii __ZN6webrtc24videoFrameBufferProviderERKNS_10VideoFrameE __ZN6webrtc19setDecoderFrameSizeEPvtt @@ -362,3 +362,16 @@ __ZNK6webrtc10ColorSpace5rangeEv __ZNK6webrtc10ColorSpace6matrixEv __ZNK6webrtc10ColorSpace8transferEv __ZNK6webrtc10ColorSpace9primariesEv +_I420Copy +__ZN6webrtc10VideoFrame7Builder15set_color_spaceEPKNS_10ColorSpaceE +__ZN6webrtc10VideoFrame7Builder15set_ntp_time_msEx +__ZN6webrtc10VideoFrame7Builder17set_timestamp_rtpEj +__ZN6webrtc10VideoFrame7Builder22set_video_frame_bufferERKN3rtc13scoped_refptrINS_16VideoFrameBufferEEE +__ZN6webrtc10VideoFrame7Builder5buildEv +__ZN6webrtc10VideoFrame7BuilderC1Ev +__ZN6webrtc10VideoFrame7BuilderD1Ev +__ZN6webrtc20VideoFrameBufferPool16CreateI420BufferEii +__ZN6webrtc20VideoFrameBufferPool7ReleaseEv +__ZN6webrtc20VideoFrameBufferPoolC1Ebm +__ZN6webrtc20VideoFrameBufferPoolD1Ev +__ZTVN6webrtc12VideoDecoderE diff --git a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp index 2ba30ae3fca2..8c8cf02061eb 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp +++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp @@ -204,7 +204,7 @@ __ZN6webrtc17setDecodingFormatEPvPKhmtt __ZN6webrtc11decodeFrameEPvxPKhm __ZN6webrtc24videoDecoderTaskCompleteEPvjjP10__CVBuffer __ZN6webrtc24videoDecoderTaskCompleteEPvjjS0_PFP10__CVBufferS0_EPFvS0_Eii -__ZN6webrtc24setVideoDecoderCallbacksEPFPvRKNS_14SdpVideoFormatEEPFiS0_EPFiS0_jPKhmttEPFiS0_S0_E +__ZN6webrtc24setVideoDecoderCallbacksEPFNS_18WebKitVideoDecoderERKNS_14SdpVideoFormatEEPFiPvEPFiS6_jPKhmttEPFiS6_S6_E __ZN6webrtc24toWebRTCVideoFrameBufferEPvPFP10__CVBufferS0_EPFvS0_Eii __ZN6webrtc24videoFrameBufferProviderERKNS_10VideoFrameE __ZN6webrtc19setDecoderFrameSizeEPvtt @@ -362,3 +362,16 @@ __ZNK6webrtc10ColorSpace5rangeEv __ZNK6webrtc10ColorSpace6matrixEv __ZNK6webrtc10ColorSpace8transferEv __ZNK6webrtc10ColorSpace9primariesEv +_I420Copy +__ZN6webrtc10VideoFrame7Builder15set_color_spaceEPKNS_10ColorSpaceE +__ZN6webrtc10VideoFrame7Builder15set_ntp_time_msEx +__ZN6webrtc10VideoFrame7Builder17set_timestamp_rtpEj +__ZN6webrtc10VideoFrame7Builder22set_video_frame_bufferERKN3rtc13scoped_refptrINS_16VideoFrameBufferEEE +__ZN6webrtc10VideoFrame7Builder5buildEv +__ZN6webrtc10VideoFrame7BuilderC1Ev +__ZN6webrtc10VideoFrame7BuilderD1Ev +__ZN6webrtc20VideoFrameBufferPool16CreateI420BufferEii +__ZN6webrtc20VideoFrameBufferPool7ReleaseEv +__ZN6webrtc20VideoFrameBufferPoolC1Ebm +__ZN6webrtc20VideoFrameBufferPoolD1Ev +__ZTVN6webrtc12VideoDecoderE diff --git a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp index 00ba1ac277c6..ff3a08b94f8a 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp +++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp @@ -206,7 +206,7 @@ __ZN6webrtc24videoDecoderTaskCompleteEPvjjP10__CVBuffer __ZN6webrtc24videoDecoderTaskCompleteEPvjjS0_PFP10__CVBufferS0_EPFvS0_Eii __ZN6webrtc24toWebRTCVideoFrameBufferEPvPFP10__CVBufferS0_EPFvS0_Eii __ZN6webrtc24videoFrameBufferProviderERKNS_10VideoFrameE -__ZN6webrtc24setVideoDecoderCallbacksEPFPvRKNS_14SdpVideoFormatEEPFiS0_EPFiS0_jPKhmttEPFiS0_S0_E +__ZN6webrtc24setVideoDecoderCallbacksEPFNS_18WebKitVideoDecoderERKNS_14SdpVideoFormatEEPFiPvEPFiS6_jPKhmttEPFiS6_S6_E __ZN6webrtc19setDecoderFrameSizeEPvtt __ZN6webrtc18RtpCodecCapabilityC1Ev __ZN6webrtc24encoderVideoTaskCompleteEPvNS_14VideoCodecTypeEPKhmRKNS_22WebKitEncodedFrameInfoE @@ -362,3 +362,16 @@ __ZNK6webrtc10ColorSpace5rangeEv __ZNK6webrtc10ColorSpace6matrixEv __ZNK6webrtc10ColorSpace8transferEv __ZNK6webrtc10ColorSpace9primariesEv +_I420Copy +__ZN6webrtc10VideoFrame7Builder15set_color_spaceEPKNS_10ColorSpaceE +__ZN6webrtc10VideoFrame7Builder15set_ntp_time_msEx +__ZN6webrtc10VideoFrame7Builder17set_timestamp_rtpEj +__ZN6webrtc10VideoFrame7Builder22set_video_frame_bufferERKN3rtc13scoped_refptrINS_16VideoFrameBufferEEE +__ZN6webrtc10VideoFrame7Builder5buildEv +__ZN6webrtc10VideoFrame7BuilderC1Ev +__ZN6webrtc10VideoFrame7BuilderD1Ev +__ZN6webrtc20VideoFrameBufferPool16CreateI420BufferEii +__ZN6webrtc20VideoFrameBufferPool7ReleaseEv +__ZN6webrtc20VideoFrameBufferPoolC1Ebm +__ZN6webrtc20VideoFrameBufferPoolD1Ev +__ZTVN6webrtc12VideoDecoderE diff --git a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig index ba55b9dc7ccd..78525f57351c 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig +++ b/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.xcconfig @@ -56,7 +56,7 @@ PUBLIC_HEADERS_FOLDER_PREFIX = $(WK_LIBRARY_HEADERS_FOLDER_PATH); INSTALL_PUBLIC_HEADER_PREFIX = $(INSTALL_PATH_PREFIX)$(PUBLIC_HEADERS_FOLDER_PREFIX); SYSTEM_PUBLIC_HEADER_PREFIX = $(SYSTEM_PUBLIC_HEADER_PREFIX_$(USE_SYSTEM_CONTENT_PATH)); SYSTEM_PUBLIC_HEADER_PREFIX_YES = $(DSTROOT)$(PUBLIC_HEADERS_FOLDER_PREFIX); -HEADER_FOLDER_LIST = absl libwebrtc webm webrtc; +HEADER_FOLDER_LIST = absl libwebrtc webm webrtc libyuv; PUBLIC_LIBRARY_FOLDER_PREFIX = $(WK_LIBRARY_INSTALL_PATH); INSTALL_PUBLIC_LIBRARY_PREFIX = $(INSTALL_PATH_PREFIX)$(PUBLIC_LIBRARY_FOLDER_PREFIX); diff --git a/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig b/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig index 8600ff16062f..dac84d951be7 100644 --- a/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig +++ b/Source/ThirdParty/libwebrtc/Configurations/libyuv.xcconfig @@ -9,7 +9,11 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; HEADER_SEARCH_PATHS = Source/third_party/libyuv/include; INSTALL_PATH = $(INSTALL_PATH_PREFIX)$(WK_LIBRARY_INSTALL_PATH); -PUBLIC_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)$(WK_LIBRARY_HEADERS_FOLDER_PATH)/libwebrtc; USE_HEADERMAP = NO; OTHER_LDFLAGS = $(inherited) $(SOURCE_VERSION_LDFLAGS); + +APPLY_RULES_IN_COPY_HEADERS = $(WK_USE_NEW_BUILD_SYSTEM); +PUBLIC_HEADERS_FOLDER_PATH = $(PUBLIC_HEADERS_FOLDER_PATH_$(WK_WHICH_BUILD_SYSTEM)); +PUBLIC_HEADERS_FOLDER_PATH_not_legacy = $(INSTALL_PATH_PREFIX)$(WK_LIBRARY_HEADERS_FOLDER_PATH)/liyuv; +PUBLIC_HEADERS_FOLDER_PATH_legacy = $(WK_LIBRARY_HEADERS_FOLDER_PATH)/libyuv_flattened; diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.h b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.h index efad07c157fb..28e03d993a00 100644 --- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.h +++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.h @@ -45,11 +45,15 @@ namespace webrtc { struct SdpVideoFormat; class VideoDecoderFactory; -using WebKitVideoDecoder = void*; +struct WebKitVideoDecoder { + using Value = void*; + Value value { nullptr }; + bool isWebRTCVideoDecoder { false }; +}; using VideoDecoderCreateCallback = WebKitVideoDecoder(*)(const SdpVideoFormat& format); -using VideoDecoderReleaseCallback = int32_t(*)(WebKitVideoDecoder); -using VideoDecoderDecodeCallback = int32_t(*)(WebKitVideoDecoder, uint32_t timeStamp, const uint8_t*, size_t length, uint16_t width, uint16_t height); -using VideoDecoderRegisterDecodeCompleteCallback = int32_t(*)(WebKitVideoDecoder, void* decodedImageCallback); +using VideoDecoderReleaseCallback = int32_t(*)(WebKitVideoDecoder::Value); +using VideoDecoderDecodeCallback = int32_t(*)(WebKitVideoDecoder::Value, uint32_t timeStamp, const uint8_t*, size_t length, uint16_t width, uint16_t height); +using VideoDecoderRegisterDecodeCompleteCallback = int32_t(*)(WebKitVideoDecoder::Value, void* decodedImageCallback); void setVideoDecoderCallbacks(VideoDecoderCreateCallback, VideoDecoderReleaseCallback, VideoDecoderDecodeCallback, VideoDecoderRegisterDecodeCompleteCallback); diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm index 3ef1e6cd50a5..98067543851a 100644 --- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm +++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitDecoder.mm @@ -161,7 +161,7 @@ - (void)flush { class RemoteVideoDecoder final : public webrtc::VideoDecoder { public: - RemoteVideoDecoder(WebKitVideoDecoder, bool isVP9); + RemoteVideoDecoder(WebKitVideoDecoder::Value, bool isVP9); ~RemoteVideoDecoder(); bool isVP9() const { return m_isVP9; } @@ -173,7 +173,7 @@ - (void)flush { int32_t Release() final; const char* ImplementationName() const final { return "RemoteVideoToolBox"; } - WebKitVideoDecoder m_internalDecoder; + WebKitVideoDecoder::Value m_internalDecoder; bool m_isVP9 { false }; }; @@ -198,7 +198,7 @@ void setVideoDecoderCallbacks(VideoDecoderCreateCallback createCallback, VideoDe callbacks.registerDecodeCompleteCallback = registerDecodeCompleteCallback; } -RemoteVideoDecoder::RemoteVideoDecoder(WebKitVideoDecoder internalDecoder, bool isVP9) +RemoteVideoDecoder::RemoteVideoDecoder(WebKitVideoDecoder::Value internalDecoder, bool isVP9) : m_internalDecoder(internalDecoder) , m_isVP9(isVP9) { @@ -280,11 +280,14 @@ void videoDecoderTaskComplete(void* callback, uint32_t timeStamp, uint32_t timeS if (!videoDecoderCallbacks().createCallback) return m_internalFactory->CreateVideoDecoder(format); - auto identifier = videoDecoderCallbacks().createCallback(format); - if (!identifier) + auto createdDecoder = videoDecoderCallbacks().createCallback(format); + if (!createdDecoder.value) return m_internalFactory->CreateVideoDecoder(format); - auto decoder = std::make_unique(identifier, format.name == "VP9"); + if (createdDecoder.isWebRTCVideoDecoder) + return std::unique_ptr { static_cast(createdDecoder.value) }; + + auto decoder = std::make_unique(createdDecoder.value, format.name == "VP9"); if (!decoder->isVP9()) return decoder; return webrtc::CreateVideoDecoderSoftwareFallbackWrapper(m_internalFactory->CreateVideoDecoder(format), std::move(decoder)); diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m index 5a69124a3d2a..57c6e06c4dd4 100644 --- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m +++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoDecoderFactory.m @@ -23,7 +23,7 @@ #import "RTCH265ProfileLevelId.h" #import "RTCVideoDecoderH265.h" #endif -#if !defined(DISABLE_LIBAOM_AV1) +#if !defined(DISABLE_RTC_AV1) #import "sdk/objc/api/video_codec/RTCVideoDecoderAV1.h" #endif @@ -97,7 +97,7 @@ - (id)initWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9P }]]; } #endif -#if !defined(DISABLE_LIBAOM_AV1) +#if !defined(DISABLE_RTC_AV1) if (_supportsAv1) { [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecAv1Name]]; } @@ -122,7 +122,7 @@ - (id)initWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9P return [RTCVideoDecoderVP9 vp9Decoder]; } #endif -#if !defined(DISABLE_LIBAOM_AV1) +#if !defined(DISABLE_RTC_AV1) } else if ([info.name isEqualToString:kRTCVideoCodecAv1Name]) { return [RTCVideoDecoderAV1 av1Decoder]; } diff --git a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m index cb3d63157199..dca6a0a4fa83 100644 --- a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m +++ b/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCDefaultVideoEncoderFactory.m @@ -22,7 +22,7 @@ #import "RTCH265ProfileLevelId.h" #import "RTCVideoEncoderH265.h" #endif -#if !defined(DISABLE_LIBAOM_AV1_ENCODER) +#if !defined(DISABLE_RTC_AV1) #import "sdk/objc/api/video_codec/RTCVideoEncoderAV1.h" #endif @@ -98,7 +98,7 @@ - (id)initWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9P }]]; } #endif -#if !defined(DISABLE_LIBAOM_AV1) +#if !defined(DISABLE_RTC_AV1) if (supportsAv1) { [codecs addObject:[[RTCVideoCodecInfo alloc] initWithName:kRTCVideoCodecAv1Name]]; } @@ -125,7 +125,7 @@ - (id)initWithH265:(bool)supportsH265 vp9Profile0:(bool)supportsVP9Profile0 vp9P } #endif } -#if !defined(DISABLE_LIBAOM_AV1) +#if !defined(DISABLE_RTC_AV1) if ([info.name isEqualToString:kRTCVideoCodecAv1Name]) { return [RTCVideoEncoderAV1 av1Encoder]; } diff --git a/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj b/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj index 574fe979ac23..e933f4a49367 100644 --- a/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj +++ b/Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj @@ -476,6 +476,29 @@ 410B38E8292BAA610003E515 /* sad_neon.c in Sources */ = {isa = PBXBuildFile; fileRef = 410B35A0292B6E730003E515 /* sad_neon.c */; }; 410B38E9292BAA610003E515 /* transpose_neon.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B35A1292B6E740003E515 /* transpose_neon.h */; }; 410B38EB292BAAF20003E515 /* arm_cpudetect.c in Sources */ = {isa = PBXBuildFile; fileRef = 410B38EA292BAAF10003E515 /* arm_cpudetect.c */; }; + 410B3913292CC1800003E515 /* compare_row.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B38FC292CC1700003E515 /* compare_row.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3914292CC1800003E515 /* basic_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B38FD292CC1700003E515 /* basic_types.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3915292CC1800003E515 /* loongson_intrinsics.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B38FE292CC1700003E515 /* loongson_intrinsics.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3916292CC1800003E515 /* macros_msa.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B38FF292CC1710003E515 /* macros_msa.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3917292CC1800003E515 /* scale_argb.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3900292CC1710003E515 /* scale_argb.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3918292CC1800003E515 /* scale_uv.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3901292CC1710003E515 /* scale_uv.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3919292CC1800003E515 /* scale_row.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3902292CC1720003E515 /* scale_row.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B391A292CC1800003E515 /* compare.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3903292CC1730003E515 /* compare.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B391B292CC1800003E515 /* video_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3904292CC1730003E515 /* video_common.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B391C292CC1800003E515 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3905292CC1740003E515 /* version.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B391D292CC1800003E515 /* convert_argb.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3906292CC1750003E515 /* convert_argb.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B391E292CC1800003E515 /* rotate_row.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3907292CC1760003E515 /* rotate_row.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B391F292CC1800003E515 /* convert_from.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3908292CC1770003E515 /* convert_from.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3920292CC1800003E515 /* rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3909292CC1770003E515 /* rotate.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3921292CC1800003E515 /* mjpeg_decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B390A292CC1780003E515 /* mjpeg_decoder.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3922292CC1800003E515 /* convert_from_argb.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B390B292CC1780003E515 /* convert_from_argb.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3923292CC1800003E515 /* convert.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B390C292CC1790003E515 /* convert.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3924292CC1800003E515 /* scale_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B390D292CC1790003E515 /* scale_rgb.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3925292CC1800003E515 /* scale.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B390E292CC17A0003E515 /* scale.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3926292CC1800003E515 /* cpu_id.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B390F292CC17B0003E515 /* cpu_id.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3927292CC1800003E515 /* planar_functions.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3910292CC17C0003E515 /* planar_functions.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3928292CC1800003E515 /* row.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3911292CC17E0003E515 /* row.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B3929292CC1800003E515 /* rotate_argb.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B3912292CC17E0003E515 /* rotate_argb.h */; settings = {ATTRIBUTES = (Private, ); }; }; 410BA1232570F60C002E2F8A /* deprecated_rtp_sender_egress.cc in Sources */ = {isa = PBXBuildFile; fileRef = 410BA1212570F60C002E2F8A /* deprecated_rtp_sender_egress.cc */; }; 410BA1242570F60C002E2F8A /* deprecated_rtp_sender_egress.h in Headers */ = {isa = PBXBuildFile; fileRef = 410BA1222570F60C002E2F8A /* deprecated_rtp_sender_egress.h */; settings = {ATTRIBUTES = (Public, ); }; }; 410BA1292570F6A5002E2F8A /* libaom_av1_decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 410BA1272570F6A5002E2F8A /* libaom_av1_decoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -2454,13 +2477,13 @@ 41B675C2216599A80040A75D /* highbd_quantize_intrin_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 41C62912212E2DE4002313D4 /* highbd_quantize_intrin_sse2.c */; }; 41B675C3216599A80040A75D /* highbd_variance_sse2.c in Sources */ = {isa = PBXBuildFile; fileRef = 41C62916212E2DE6002313D4 /* highbd_variance_sse2.c */; }; 41B8D76428C8875200E5FA37 /* i210_buffer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41B8D75C28C8874D00E5FA37 /* i210_buffer.cc */; }; - 41B8D76528C8875200E5FA37 /* i422_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D75D28C8874E00E5FA37 /* i422_buffer.h */; }; + 41B8D76528C8875200E5FA37 /* i422_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D75D28C8874E00E5FA37 /* i422_buffer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 41B8D76628C8875200E5FA37 /* i422_buffer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41B8D75E28C8874E00E5FA37 /* i422_buffer.cc */; }; 41B8D76728C8875200E5FA37 /* frame_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D75F28C8874F00E5FA37 /* frame_buffer.h */; }; - 41B8D76828C8875200E5FA37 /* i210_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D76028C8874F00E5FA37 /* i210_buffer.h */; }; + 41B8D76828C8875200E5FA37 /* i210_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D76028C8874F00E5FA37 /* i210_buffer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 41B8D76928C8875200E5FA37 /* frame_buffer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41B8D76128C8874F00E5FA37 /* frame_buffer.cc */; }; 41B8D76A28C8875200E5FA37 /* i444_buffer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41B8D76228C8875100E5FA37 /* i444_buffer.cc */; }; - 41B8D76B28C8875200E5FA37 /* i444_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D76328C8875200E5FA37 /* i444_buffer.h */; }; + 41B8D76B28C8875200E5FA37 /* i444_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D76328C8875200E5FA37 /* i444_buffer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 41B8D77328C887DF00E5FA37 /* rtc_event_field_encoding_parser.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41B8D76C28C887DD00E5FA37 /* rtc_event_field_encoding_parser.cc */; }; 41B8D77428C887DF00E5FA37 /* rtc_event_end_log.h in Headers */ = {isa = PBXBuildFile; fileRef = 41B8D76D28C887DD00E5FA37 /* rtc_event_end_log.h */; }; 41B8D77528C887DF00E5FA37 /* rtc_event_field_extraction.cc in Sources */ = {isa = PBXBuildFile; fileRef = 41B8D76E28C887DE00E5FA37 /* rtc_event_field_extraction.cc */; }; @@ -5084,6 +5107,19 @@ /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ + 410B392C292CC6890003E515 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + filePatterns = "*/libyuv/include/libyuv/*.h"; + fileType = pattern.proxy; + inputFiles = ( + ); + isEditable = 1; + outputFiles = ( + "$(HEADER_OUTPUT_DIR)/libyuv/$(INPUT_FILE_NAME)", + ); + script = "# Type a script or drag a script file from your workspace to insert its path.\ncp -f \"${INPUT_FILE_PATH}\" \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + }; 41CB0A57215C8E060097B8AA /* PBXBuildRule */ = { isa = PBXBuildRule; compilerSpec = com.apple.compilers.proxy.script; @@ -6113,6 +6149,30 @@ 410B38C8292BAA4D0003E515 /* av1_fwd_txfm2d_neon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = av1_fwd_txfm2d_neon.c; path = neon/av1_fwd_txfm2d_neon.c; sourceTree = ""; }; 410B38C9292BAA4F0003E515 /* encodetxb_neon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = encodetxb_neon.c; path = neon/encodetxb_neon.c; sourceTree = ""; }; 410B38EA292BAAF10003E515 /* arm_cpudetect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arm_cpudetect.c; sourceTree = ""; }; + 410B38F7292CC0B40003E515 /* libyuv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libyuv.h; sourceTree = ""; }; + 410B38FC292CC1700003E515 /* compare_row.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compare_row.h; sourceTree = ""; }; + 410B38FD292CC1700003E515 /* basic_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = basic_types.h; sourceTree = ""; }; + 410B38FE292CC1700003E515 /* loongson_intrinsics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = loongson_intrinsics.h; sourceTree = ""; }; + 410B38FF292CC1710003E515 /* macros_msa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macros_msa.h; sourceTree = ""; }; + 410B3900292CC1710003E515 /* scale_argb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scale_argb.h; sourceTree = ""; }; + 410B3901292CC1710003E515 /* scale_uv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scale_uv.h; sourceTree = ""; }; + 410B3902292CC1720003E515 /* scale_row.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scale_row.h; sourceTree = ""; }; + 410B3903292CC1730003E515 /* compare.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compare.h; sourceTree = ""; }; + 410B3904292CC1730003E515 /* video_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = video_common.h; sourceTree = ""; }; + 410B3905292CC1740003E515 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; + 410B3906292CC1750003E515 /* convert_argb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert_argb.h; sourceTree = ""; }; + 410B3907292CC1760003E515 /* rotate_row.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rotate_row.h; sourceTree = ""; }; + 410B3908292CC1770003E515 /* convert_from.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert_from.h; sourceTree = ""; }; + 410B3909292CC1770003E515 /* rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rotate.h; sourceTree = ""; }; + 410B390A292CC1780003E515 /* mjpeg_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mjpeg_decoder.h; sourceTree = ""; }; + 410B390B292CC1780003E515 /* convert_from_argb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert_from_argb.h; sourceTree = ""; }; + 410B390C292CC1790003E515 /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = ""; }; + 410B390D292CC1790003E515 /* scale_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scale_rgb.h; sourceTree = ""; }; + 410B390E292CC17A0003E515 /* scale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scale.h; sourceTree = ""; }; + 410B390F292CC17B0003E515 /* cpu_id.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_id.h; sourceTree = ""; }; + 410B3910292CC17C0003E515 /* planar_functions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = planar_functions.h; sourceTree = ""; }; + 410B3911292CC17E0003E515 /* row.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = row.h; sourceTree = ""; }; + 410B3912292CC17E0003E515 /* rotate_argb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rotate_argb.h; sourceTree = ""; }; 410BA1212570F60C002E2F8A /* deprecated_rtp_sender_egress.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deprecated_rtp_sender_egress.cc; sourceTree = ""; }; 410BA1222570F60C002E2F8A /* deprecated_rtp_sender_egress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deprecated_rtp_sender_egress.h; sourceTree = ""; }; 410BA1262570F6A5002E2F8A /* libaom_av1_decoder_absent.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libaom_av1_decoder_absent.cc; sourceTree = ""; }; @@ -11863,6 +11923,45 @@ path = common; sourceTree = ""; }; + 410B38F6292CC0950003E515 /* include */ = { + isa = PBXGroup; + children = ( + 410B38FB292CC1460003E515 /* libyuv */, + 410B38F7292CC0B40003E515 /* libyuv.h */, + ); + path = include; + sourceTree = ""; + }; + 410B38FB292CC1460003E515 /* libyuv */ = { + isa = PBXGroup; + children = ( + 410B38FD292CC1700003E515 /* basic_types.h */, + 410B3903292CC1730003E515 /* compare.h */, + 410B38FC292CC1700003E515 /* compare_row.h */, + 410B390C292CC1790003E515 /* convert.h */, + 410B3906292CC1750003E515 /* convert_argb.h */, + 410B3908292CC1770003E515 /* convert_from.h */, + 410B390B292CC1780003E515 /* convert_from_argb.h */, + 410B390F292CC17B0003E515 /* cpu_id.h */, + 410B38FE292CC1700003E515 /* loongson_intrinsics.h */, + 410B38FF292CC1710003E515 /* macros_msa.h */, + 410B390A292CC1780003E515 /* mjpeg_decoder.h */, + 410B3910292CC17C0003E515 /* planar_functions.h */, + 410B3909292CC1770003E515 /* rotate.h */, + 410B3912292CC17E0003E515 /* rotate_argb.h */, + 410B3907292CC1760003E515 /* rotate_row.h */, + 410B3911292CC17E0003E515 /* row.h */, + 410B390E292CC17A0003E515 /* scale.h */, + 410B3900292CC1710003E515 /* scale_argb.h */, + 410B390D292CC1790003E515 /* scale_rgb.h */, + 410B3902292CC1720003E515 /* scale_row.h */, + 410B3901292CC1710003E515 /* scale_uv.h */, + 410B3905292CC1740003E515 /* version.h */, + 410B3904292CC1730003E515 /* video_common.h */, + ); + path = libyuv; + sourceTree = ""; + }; 410BA1252570F67B002E2F8A /* av1 */ = { isa = PBXGroup; children = ( @@ -16696,6 +16795,7 @@ 5C4B4D2D1E4323AA002651C8 /* libyuv */ = { isa = PBXGroup; children = ( + 410B38F6292CC0950003E515 /* include */, 5C4B4D2E1E4323C4002651C8 /* source */, ); path = libyuv; @@ -19863,6 +19963,29 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 410B3914292CC1800003E515 /* basic_types.h in Headers */, + 410B391A292CC1800003E515 /* compare.h in Headers */, + 410B3913292CC1800003E515 /* compare_row.h in Headers */, + 410B3923292CC1800003E515 /* convert.h in Headers */, + 410B391D292CC1800003E515 /* convert_argb.h in Headers */, + 410B391F292CC1800003E515 /* convert_from.h in Headers */, + 410B3922292CC1800003E515 /* convert_from_argb.h in Headers */, + 410B3926292CC1800003E515 /* cpu_id.h in Headers */, + 410B3915292CC1800003E515 /* loongson_intrinsics.h in Headers */, + 410B3916292CC1800003E515 /* macros_msa.h in Headers */, + 410B3921292CC1800003E515 /* mjpeg_decoder.h in Headers */, + 410B3927292CC1800003E515 /* planar_functions.h in Headers */, + 410B3920292CC1800003E515 /* rotate.h in Headers */, + 410B3929292CC1800003E515 /* rotate_argb.h in Headers */, + 410B391E292CC1800003E515 /* rotate_row.h in Headers */, + 410B3928292CC1800003E515 /* row.h in Headers */, + 410B3925292CC1800003E515 /* scale.h in Headers */, + 410B3917292CC1800003E515 /* scale_argb.h in Headers */, + 410B3924292CC1800003E515 /* scale_rgb.h in Headers */, + 410B3919292CC1800003E515 /* scale_row.h in Headers */, + 410B3918292CC1800003E515 /* scale_uv.h in Headers */, + 410B391C292CC1800003E515 /* version.h in Headers */, + 410B391B292CC1800003E515 /* video_common.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -22484,12 +22607,14 @@ buildConfigurationList = 5C0884DA1E4A980100403995 /* Build configuration list for PBXNativeTarget "yuv" */; buildPhases = ( 5C0884D51E4A980100403995 /* Headers */, + 410B392B292CC3F30003E515 /* (Legacy) Nest Headers */, 5C0884D61E4A980100403995 /* Sources */, 5C0884D71E4A980100403995 /* Frameworks */, 5C0884D81E4A980100403995 /* CopyFiles */, 5C0884D91E4A980100403995 /* CopyFiles */, ); buildRules = ( + 410B392C292CC6890003E515 /* PBXBuildRule */, ); dependencies = ( ); @@ -22683,6 +22808,24 @@ /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ + 410B392B292CC3F30003E515 /* (Legacy) Nest Headers */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "(Legacy) Nest Headers"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n[ \"${WK_USE_NEW_BUILD_SYSTEM}\" = YES ] && exit 0\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" installhdrs SYMROOT=\"${TARGET_TEMP_DIR}/LegacyNestHeaders-build\" DSTROOT=\"${BUILT_PRODUCTS_DIR}\" SDKROOT=\"${SDKROOT}\" -UseNewBuildSystem=YES\n"; + }; 41F2354122F39AC000B4FCDB /* Check For Inappropriate Objective-C Class Names */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Source/WebCore/PAL/Configurations/PAL.xcconfig b/Source/WebCore/PAL/Configurations/PAL.xcconfig index 6c7c01f8a537..59dfe4cc229b 100644 --- a/Source/WebCore/PAL/Configurations/PAL.xcconfig +++ b/Source/WebCore/PAL/Configurations/PAL.xcconfig @@ -22,6 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include? "/AppleInternal/XcodeConfig/PlatformSupport.xcconfig" +#include "../../Configurations/FeatureDefines.xcconfig" #include "../../../../Configurations/Version.xcconfig" #include "../../../../Configurations/WebKitTargetConditionals.xcconfig" @@ -100,5 +101,11 @@ USE_LIBAVIF = $(USE_LIBAVIF_$(TARGET_MAC_OS_X_VERSION_MAJOR)); USE_LIBAVIF_110000 = YES; USE_LIBAVIF_120000 = YES; -OTHER_LIBTOOLFLAGS = $(AVIF_LIBTOOLFLAGS_$(USE_LIBAVIF)); +USE_LIBDAV1D = $(USE_LIBDAV1D_$(ENABLE_WEB_RTC)); +USE_LIBDAV1D_ENABLE_WEB_RTC = $(USE_LIBDAV1D_ENABLE_WEB_RTC_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +USE_LIBDAV1D_ENABLE_WEB_RTC_130000 = YES; +USE_LIBDAV1D_ENABLE_WEB_RTC_140000 = YES; + +OTHER_LIBTOOLFLAGS = $(AVIF_LIBTOOLFLAGS_$(USE_LIBAVIF)) $(DAV1D_LIBTOOLFLAGS_$(USE_LIBDAV1D)); AVIF_LIBTOOLFLAGS_YES = $(BUILT_PRODUCTS_DIR)/libavif.a; +DAV1D_LIBTOOLFLAGS_YES = $(BUILT_PRODUCTS_DIR)/libdav1d.a; diff --git a/Source/WebCore/PAL/libavif/dav1d/dav1d.xcodeproj/project.pbxproj b/Source/WebCore/PAL/libavif/dav1d/dav1d.xcodeproj/project.pbxproj index 69a50ecb6880..f9dd531e0f48 100644 --- a/Source/WebCore/PAL/libavif/dav1d/dav1d.xcodeproj/project.pbxproj +++ b/Source/WebCore/PAL/libavif/dav1d/dav1d.xcodeproj/project.pbxproj @@ -58,6 +58,12 @@ 1C4FAE8228FC7E6900FFE212 /* ipred_prepare_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1C4FAD3C28FC71B900FFE212 /* ipred_prepare_tmpl.c */; }; 1C4FAE8328FC7E6900FFE212 /* loopfilter_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1C4FAD2928FC71B900FFE212 /* loopfilter_tmpl.c */; }; 1C4FAE8428FC7E6900FFE212 /* cdef_tmpl.c in Sources */ = {isa = PBXBuildFile; fileRef = 1C4FAD0D28FC71B900FFE212 /* cdef_tmpl.c */; }; + 410B38F0292CBFA50003E515 /* dav1d.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4FACFD28FC714500FFE212 /* dav1d.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B38F1292CBFE30003E515 /* picture.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4FACF728FC714500FFE212 /* picture.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B38F2292CBFEC0003E515 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4FACFC28FC714500FFE212 /* common.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B38F3292CBFF10003E515 /* data.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4FACF928FC714500FFE212 /* data.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B38F4292CC0150003E515 /* headers.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4FACFA28FC714500FFE212 /* headers.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B38F5292CC02C0003E515 /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4FAE4628FC77AF00FFE212 /* version.h */; settings = {ATTRIBUTES = (Private, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -96,7 +102,7 @@ 1C4FACF728FC714500FFE212 /* picture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = picture.h; sourceTree = ""; }; 1C4FACF828FC714500FFE212 /* version.h.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = version.h.in; sourceTree = ""; }; 1C4FACF928FC714500FFE212 /* data.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = data.h; sourceTree = ""; }; - 1C4FACFA28FC714500FFE212 /* headers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = headers.h; sourceTree = ""; }; + 1C4FACFA28FC714500FFE212 /* headers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = headers.h; sourceTree = ""; wrapsLines = 0; }; 1C4FACFB28FC714500FFE212 /* meson.build */ = {isa = PBXFileReference; lastKnownFileType = text; path = meson.build; sourceTree = ""; }; 1C4FACFC28FC714500FFE212 /* common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; 1C4FACFD28FC714500FFE212 /* dav1d.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dav1d.h; sourceTree = ""; }; @@ -972,6 +978,12 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 410B38F2292CBFEC0003E515 /* common.h in Headers */, + 410B38F3292CBFF10003E515 /* data.h in Headers */, + 410B38F0292CBFA50003E515 /* dav1d.h in Headers */, + 410B38F4292CC0150003E515 /* headers.h in Headers */, + 410B38F1292CBFE30003E515 /* picture.h in Headers */, + 410B38F5292CC02C0003E515 /* version.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index bd3ce5564f6f..ff22982f67dd 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1084,6 +1084,8 @@ 3FBC4AF4189881560046EE38 /* VideoFullscreenInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AF2189881560046EE38 /* VideoFullscreenInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3FF813A71DBA8640009BF001 /* PointerLockController.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CFC434F192406A900A0D3B5 /* PointerLockController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4107908C1FC3F0330061B27A /* ClientOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 4107908A1FC3E4F20061B27A /* ClientOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 410B38EE292BED000003E515 /* LibWebRTCDav1dDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 410B38EC292BECFE0003E515 /* LibWebRTCDav1dDecoder.cpp */; }; + 410B38EF292BED000003E515 /* LibWebRTCDav1dDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 410B38ED292BECFF0003E515 /* LibWebRTCDav1dDecoder.h */; settings = {ATTRIBUTES = (Private, ); }; }; 410BCF5626F0CD8C0040B124 /* RTCLocalSessionDescriptionInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 410BCF5326F0CD8B0040B124 /* RTCLocalSessionDescriptionInit.h */; }; 410C48A7280420F80084D104 /* WorkerInitializationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 410C48A6280420F20084D104 /* WorkerInitializationData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 410E4461234373E9000173D4 /* LibWebRTCSocketIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 410E445F234373AD000173D4 /* LibWebRTCSocketIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -8804,6 +8806,8 @@ 410A8EF924F8F47B004F9070 /* TextEncoderStreamEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextEncoderStreamEncoder.h; sourceTree = ""; }; 410AD2DE2822BBF6009C93C8 /* CoreAudioSharedUnit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudioSharedUnit.h; sourceTree = ""; }; 410AD2DF2822BBF6009C93C8 /* CoreAudioSharedUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreAudioSharedUnit.cpp; sourceTree = ""; }; + 410B38EC292BECFE0003E515 /* LibWebRTCDav1dDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCDav1dDecoder.cpp; path = libwebrtc/LibWebRTCDav1dDecoder.cpp; sourceTree = ""; }; + 410B38ED292BECFF0003E515 /* LibWebRTCDav1dDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCDav1dDecoder.h; path = libwebrtc/LibWebRTCDav1dDecoder.h; sourceTree = ""; }; 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageEventCustom.cpp; sourceTree = ""; }; 410BA1312570FE57002E2F8A /* LibWebRTCRtpTransformableFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCRtpTransformableFrame.cpp; path = libwebrtc/LibWebRTCRtpTransformableFrame.cpp; sourceTree = ""; }; 410BCF5326F0CD8B0040B124 /* RTCLocalSessionDescriptionInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCLocalSessionDescriptionInit.h; sourceTree = ""; }; @@ -21787,6 +21791,8 @@ 41D51BB21E4E2E8100131A5B /* LibWebRTCAudioFormat.h */, 415080341E3F00AA0051D75D /* LibWebRTCAudioModule.cpp */, 415080351E3F00AA0051D75D /* LibWebRTCAudioModule.h */, + 410B38EC292BECFE0003E515 /* LibWebRTCDav1dDecoder.cpp */, + 410B38ED292BECFF0003E515 /* LibWebRTCDav1dDecoder.h */, 41F2354522F550BE00B4FCDB /* LibWebRTCDTMFSenderBackend.cpp */, 41F2354622F550BF00B4FCDB /* LibWebRTCDTMFSenderBackend.h */, 44E349F7246F4DC70068479C /* LibWebRTCEnumTraits.h */, @@ -37385,6 +37391,7 @@ 0F8716701C869D83004FF0DE /* LengthPoint.h in Headers */, BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */, 415080371E3F00B00051D75D /* LibWebRTCAudioModule.h in Headers */, + 410B38EF292BED000003E515 /* LibWebRTCDav1dDecoder.h in Headers */, 44E349F9246F4E190068479C /* LibWebRTCEnumTraits.h in Headers */, 415747471E3869A400E914D8 /* LibWebRTCMacros.h in Headers */, 417612B01E3A994000C3D81D /* LibWebRTCMediaEndpoint.h in Headers */, @@ -40123,6 +40130,7 @@ CDE8B5EC1A69777300B4B66A /* LegacyCDMPrivateClearKey.cpp in Sources */, CDCA98EB18B2C8EB00C12FF9 /* LegacyCDMPrivateMediaPlayer.cpp in Sources */, CDE8B5F01A69778B00B4B66A /* LegacyCDMSessionClearKey.cpp in Sources */, + 410B38EE292BED000003E515 /* LibWebRTCDav1dDecoder.cpp in Sources */, FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */, 41E9EE1F28B51067006A2298 /* MediaCaptureStatusBarManager.mm in Sources */, 2D9BF7051DBFBB24007A7D99 /* MediaEncryptedEvent.cpp in Sources */, diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.cpp b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.cpp new file mode 100644 index 000000000000..8eb09c12b9e3 --- /dev/null +++ b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2022 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. + */ + +#include "config.h" +#include "LibWebRTCDav1dDecoder.h" + +#if USE(LIBWEBRTC) + +#include "LibWebRTCMacros.h" +#include "Logging.h" +#include +#include +#include + +ALLOW_UNUSED_PARAMETERS_BEGIN +ALLOW_COMMA_BEGIN + +#include +#include +#include +#include +#include +#include +#include +#include + +ALLOW_UNUSED_PARAMETERS_END +ALLOW_COMMA_END + +namespace WebCore { + +class Dav1dDecoder final : public webrtc::VideoDecoder { + WTF_MAKE_FAST_ALLOCATED; +public: + Dav1dDecoder(); + ~Dav1dDecoder(); + +private: + bool Configure(const Settings&) final; + int32_t Decode(const webrtc::EncodedImage&, bool missingFrames, int64_t renderTimeMs) final; + int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback*) final; + int32_t Release() final; + DecoderInfo GetDecoderInfo() const final; + const char* ImplementationName() const final; + + webrtc::VideoFrameBufferPool m_bufferPool; + Dav1dContext* m_context { nullptr }; + webrtc::DecodedImageCallback* m_decodeCompleteCallback { nullptr }; +}; + +class ScopedDav1dData { +public: + ~ScopedDav1dData() { dav1d_data_unref(&m_data); } + Dav1dData& Data() { return m_data; } + +private: + Dav1dData m_data; +}; + +class ScopedDav1dPicture { +public: + ~ScopedDav1dPicture() { dav1d_picture_unref(&m_picture); } + Dav1dPicture& Picture() { return m_picture; } + +private: + Dav1dPicture m_picture; +}; + +constexpr char kDav1dName[] = "dav1d"; + +// Calling `dav1d_data_wrap` requires a `free_callback` to be registered. +static void NullFreeCallback(const uint8_t*, void*) +{ +} + +Dav1dDecoder::Dav1dDecoder() + : m_bufferPool(false, 150) +{ +} + +Dav1dDecoder::~Dav1dDecoder() +{ + Release(); +} + +bool Dav1dDecoder::Configure(const Settings& settings) +{ + Dav1dSettings s; + dav1d_default_settings(&s); + + // FIXME: We might want to use a more efficient configuration, at which point we might need to revise Dav1dDecoder::Decode as decoding might become async. + s.n_threads = std::max(2, settings.number_of_cores()); + s.max_frame_delay = 1; + s.all_layers = 0; + s.operating_point = 31; + + return !dav1d_open(&m_context, &s); +} + +int32_t Dav1dDecoder::RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) +{ + m_decodeCompleteCallback = callback; + return WEBRTC_VIDEO_CODEC_OK; +} + +int32_t Dav1dDecoder::Release() +{ + dav1d_close(&m_context); + if (m_context != nullptr) + return WEBRTC_VIDEO_CODEC_MEMORY; + + m_bufferPool.Release(); + return WEBRTC_VIDEO_CODEC_OK; +} + +Dav1dDecoder::DecoderInfo Dav1dDecoder::GetDecoderInfo() const +{ + DecoderInfo info; + info.implementation_name = kDav1dName; + info.is_hardware_accelerated = false; + return info; +} + +const char* Dav1dDecoder::ImplementationName() const +{ + return kDav1dName; +} + +int32_t Dav1dDecoder::Decode(const webrtc::EncodedImage& encodedImage, bool /*missingFrames*/, int64_t /*renderTimeMs*/) +{ + if (!m_context || m_decodeCompleteCallback == nullptr) + return WEBRTC_VIDEO_CODEC_UNINITIALIZED; + + ScopedDav1dData scopedDav1dData; + Dav1dData& dav1dData = scopedDav1dData.Data(); + memset(&dav1dData, 0, sizeof(Dav1dData)); + auto* data = encodedImage.data(); + auto size = encodedImage.size(); + if (!data || !size) { + RELEASE_LOG_ERROR(WebRTC, "Dav1dDecoder::Decode decoding failed as data is empty"); + return WEBRTC_VIDEO_CODEC_ERROR; + } + dav1d_data_wrap(&dav1dData, data, size, &NullFreeCallback, nullptr); + + if (int res = dav1d_send_data(m_context, &dav1dData)) { + RELEASE_LOG_ERROR(WebRTC, "Dav1dDecoder::Decode decoding failed with error code %d", res); + return WEBRTC_VIDEO_CODEC_ERROR; + } + + ScopedDav1dPicture scopedDav1dPicture; + Dav1dPicture& dav1dPicture = scopedDav1dPicture.Picture(); + memset(&dav1dPicture, 0, sizeof(Dav1dPicture)); + + if (int res = dav1d_get_picture(m_context, &dav1dPicture)) { + RELEASE_LOG_ERROR(WebRTC, "Dav1dDecoder::Decode getting picture failed with error code %d", res); + return WEBRTC_VIDEO_CODEC_ERROR; + } + + // Only accept I420 pixel format and 8 bit depth. + if (dav1dPicture.p.layout != DAV1D_PIXEL_LAYOUT_I420 || dav1dPicture.p.bpc != 8) + return WEBRTC_VIDEO_CODEC_ERROR; + + auto buffer = m_bufferPool.CreateI420Buffer(dav1dPicture.p.w, dav1dPicture.p.h); + if (!buffer.get()) { + RELEASE_LOG_ERROR(WebRTC, "Dav1dDecoder::Decode failed to get frame from the buffer pool"); + return WEBRTC_VIDEO_CODEC_ERROR; + } + + auto* yData = static_cast(dav1dPicture.data[0]); + auto* uData = static_cast(dav1dPicture.data[1]); + auto* vData = static_cast(dav1dPicture.data[2]); + int yStride = dav1dPicture.stride[0]; + int uvStride = dav1dPicture.stride[1]; + libyuv::I420Copy(yData, yStride, + uData, uvStride, + vData, uvStride, + buffer->MutableDataY(), buffer->StrideY(), + buffer->MutableDataU(), buffer->StrideU(), + buffer->MutableDataV(), buffer->StrideV(), + dav1dPicture.p.w, + dav1dPicture.p.h); + + webrtc::VideoFrame decodedFrame = webrtc::VideoFrame::Builder() + .set_video_frame_buffer(buffer) + .set_timestamp_rtp(encodedImage.Timestamp()) + .set_ntp_time_ms(encodedImage.ntp_time_ms_) + .set_color_space(encodedImage.ColorSpace()) + .build(); + + m_decodeCompleteCallback->Decoded(decodedFrame, absl::nullopt, absl::nullopt); + return WEBRTC_VIDEO_CODEC_OK; +} + +UniqueRef createLibWebRTCDav1dDecoder() +{ + return makeUniqueRef(); +} + +} // namespace + +#endif diff --git a/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.h b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.h new file mode 100644 index 000000000000..a60cf848f85f --- /dev/null +++ b/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCDav1dDecoder.h @@ -0,0 +1,44 @@ +/* + * 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 USE(LIBWEBRTC) + +ALLOW_UNUSED_PARAMETERS_BEGIN +ALLOW_COMMA_BEGIN + +#include + +ALLOW_UNUSED_PARAMETERS_END +ALLOW_COMMA_END + +namespace WebCore { + +WEBCORE_EXPORT UniqueRef createLibWebRTCDav1dDecoder(); + +} // namespace WebCore + +#endif diff --git a/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm b/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm index 72f93b892ee5..258201f7b0b2 100644 --- a/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm +++ b/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm @@ -126,6 +126,8 @@ return webrtc::createLocalH265Decoder(block.get()); case VideoCodecType::VP9: return webrtc::createLocalVP9Decoder(block.get()); + default: + break; } ASSERT_NOT_REACHED(); return nullptr; diff --git a/Source/WebKit/Shared/VideoCodecType.h b/Source/WebKit/Shared/VideoCodecType.h index 973162610972..6b15645a5db8 100644 --- a/Source/WebKit/Shared/VideoCodecType.h +++ b/Source/WebKit/Shared/VideoCodecType.h @@ -32,7 +32,8 @@ namespace WebKit { enum class VideoCodecType : uint8_t { H264, H265, - VP9 + VP9, + AV1 }; } // namespace WebKit @@ -45,7 +46,8 @@ template<> struct EnumTraits { WebKit::VideoCodecType, WebKit::VideoCodecType::H264, WebKit::VideoCodecType::H265, - WebKit::VideoCodecType::VP9 + WebKit::VideoCodecType::VP9, + WebKit::VideoCodecType::AV1 >; }; diff --git a/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp b/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp index ac1c01126d8a..4cc1d79a3271 100644 --- a/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp +++ b/Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp @@ -38,6 +38,7 @@ #include "WebProcess.h" #include #include +#include #include #include #include @@ -60,15 +61,20 @@ static webrtc::WebKitVideoDecoder createVideoDecoder(const webrtc::SdpVideoForma { auto& codecs = WebProcess::singleton().libWebRTCCodecs(); if (format.name == "H264") - return codecs.createDecoder(VideoCodecType::H264); + return { codecs.createDecoder(VideoCodecType::H264), false }; if (format.name == "H265") - return codecs.createDecoder(VideoCodecType::H265); + return { codecs.createDecoder(VideoCodecType::H265), false }; if (format.name == "VP9" && codecs.supportVP9VTB()) - return codecs.createDecoder(VideoCodecType::VP9); + return { codecs.createDecoder(VideoCodecType::VP9), false }; - return nullptr; + if (format.name == "AV1") { + auto av1Decoder = createLibWebRTCDav1dDecoder().moveToUniquePtr(); + return { av1Decoder.release(), true }; + } + + return { }; } std::optional LibWebRTCCodecs::videoCodecTypeFromWebCodec(const String& codec) @@ -86,17 +92,17 @@ std::optional LibWebRTCCodecs::videoCodecTypeFromWebCodec(const return { }; } -static int32_t releaseVideoDecoder(webrtc::WebKitVideoDecoder decoder) +static int32_t releaseVideoDecoder(webrtc::WebKitVideoDecoder::Value decoder) { return WebProcess::singleton().libWebRTCCodecs().releaseDecoder(*static_cast(decoder)); } -static int32_t decodeVideoFrame(webrtc::WebKitVideoDecoder decoder, uint32_t timeStamp, const uint8_t* data, size_t size, uint16_t width, uint16_t height) +static int32_t decodeVideoFrame(webrtc::WebKitVideoDecoder::Value decoder, uint32_t timeStamp, const uint8_t* data, size_t size, uint16_t width, uint16_t height) { return WebProcess::singleton().libWebRTCCodecs().decodeFrame(*static_cast(decoder), timeStamp, data, size, width, height); } -static int32_t registerDecodeCompleteCallback(webrtc::WebKitVideoDecoder decoder, void* decodedImageCallback) +static int32_t registerDecodeCompleteCallback(webrtc::WebKitVideoDecoder::Value decoder, void* decodedImageCallback) { WebProcess::singleton().libWebRTCCodecs().registerDecodeFrameCallback(*static_cast(decoder), decodedImageCallback); return 0; @@ -455,6 +461,8 @@ static inline webrtc::VideoCodecType toWebRTCCodecType(VideoCodecType type) return webrtc::kVideoCodecH265; case VideoCodecType::VP9: return webrtc::kVideoCodecVP9; + case VideoCodecType::AV1: + return webrtc::kVideoCodecAV1; } }