diff --git a/webrtc-sys/libwebrtc/build_linux.sh b/webrtc-sys/libwebrtc/build_linux.sh index c445fa6a..1322a828 100755 --- a/webrtc-sys/libwebrtc/build_linux.sh +++ b/webrtc-sys/libwebrtc/build_linux.sh @@ -91,6 +91,7 @@ args="is_debug=$debug \ rtc_build_tools=false \ rtc_build_examples=false \ rtc_libvpx_build_vp9=true \ + enable_libaom=true \ is_component_build=false \ enable_stripping=true \ use_goma=false \ diff --git a/webrtc-sys/libwebrtc/build_macos.sh b/webrtc-sys/libwebrtc/build_macos.sh index d5d4723a..4498b2eb 100755 --- a/webrtc-sys/libwebrtc/build_macos.sh +++ b/webrtc-sys/libwebrtc/build_macos.sh @@ -92,11 +92,11 @@ gn gen "$OUTPUT_DIR" --root="src" \ rtc_build_examples=false \ rtc_build_tools=false \ rtc_libvpx_build_vp9=true \ + enable_libaom=true \ is_component_build=false \ enable_stripping=true \ rtc_enable_symbol_export=true \ rtc_enable_objc_symbol_export=false \ - enable_libaom = true \ rtc_include_dav1d_in_internal_decoder_factory = true \ rtc_use_h264=true \ use_custom_libcxx=false \ diff --git a/webrtc-sys/libwebrtc/build_windows.cmd b/webrtc-sys/libwebrtc/build_windows.cmd index 77bf8925..a1ecc33a 100644 --- a/webrtc-sys/libwebrtc/build_windows.cmd +++ b/webrtc-sys/libwebrtc/build_windows.cmd @@ -65,7 +65,7 @@ if "!profile!" == "debug" ( rem generate ninja for release call gn.bat gen %OUTPUT_DIR% --root="src" ^ - --args="is_debug=!debug! is_clang=true target_cpu=\"!arch!\" use_custom_libcxx=false rtc_disable_check_msg=true rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false is_component_build=false rtc_enable_protobuf=false rtc_use_h264=true ffmpeg_branding=\"Chrome\" symbol_level=0 enable_iterator_debugging=false" + --args="is_debug=!debug! is_clang=true target_cpu=\"!arch!\" use_custom_libcxx=false rtc_libvpx_build_vp9=true enable_libaom=true rtc_disable_check_msg=true rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false is_component_build=false rtc_enable_protobuf=false rtc_use_h264=true ffmpeg_branding=\"Chrome\" symbol_level=0 enable_iterator_debugging=false" rem build ninja.exe -C %OUTPUT_DIR% :default diff --git a/webrtc-sys/src/video_decoder_factory.cpp b/webrtc-sys/src/video_decoder_factory.cpp index a988231a..40e74289 100644 --- a/webrtc-sys/src/video_decoder_factory.cpp +++ b/webrtc-sys/src/video_decoder_factory.cpp @@ -16,13 +16,19 @@ #include "livekit/video_decoder_factory.h" +#include "api/video_codecs/av1_profile.h" #include "api/video_codecs/sdp_video_format.h" #include "livekit/objc_video_factory.h" #include "media/base/media_constants.h" #include "modules/video_coding/codecs/h264/include/h264.h" #include "modules/video_coding/codecs/vp8/include/vp8.h" +#include "modules/video_coding/codecs/vp9/include/vp9.h" #include "rtc_base/logging.h" +#if defined(RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY) +#include "modules/video_coding/codecs/av1/dav1d_decoder.h" // nogncheck +#endif + #ifdef WEBRTC_ANDROID #include "livekit/android.h" #endif @@ -52,10 +58,21 @@ std::vector VideoDecoderFactory::GetSupportedFormats() } formats.push_back(webrtc::SdpVideoFormat(cricket::kVp8CodecName)); + for (const webrtc::SdpVideoFormat& format : + webrtc::SupportedVP9DecoderCodecs()) + formats.push_back(format); for (const webrtc::SdpVideoFormat& h264_format : webrtc::SupportedH264DecoderCodecs()) formats.push_back(h264_format); +#if defined(RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY) + formats.push_back(webrtc::SdpVideoFormat(cricket::kAv1CodecName)); + formats.push_back(webrtc::SdpVideoFormat( + cricket::kAv1CodecName, + {{webrtc::kAV1FmtpProfile, + AV1ProfileToString(webrtc::AV1Profile::kProfile1).data()}})); +#endif + return formats; } @@ -86,9 +103,19 @@ std::unique_ptr VideoDecoderFactory::CreateVideoDecoder( if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName)) return webrtc::VP8Decoder::Create(); + if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName)) + return webrtc::VP9Decoder::Create(); if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) return webrtc::H264Decoder::Create(); + +#if defined(RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY) + if (absl::EqualsIgnoreCase(format.name, cricket::kAv1CodecName)) { + return webrtc::CreateDav1dDecoder(); + } +#endif + + RTC_LOG(LS_ERROR) << "No VideoDecoder found for " << format.name; return nullptr; } diff --git a/webrtc-sys/src/video_encoder_factory.cpp b/webrtc-sys/src/video_encoder_factory.cpp index 6d293ee9..b2005867 100644 --- a/webrtc-sys/src/video_encoder_factory.cpp +++ b/webrtc-sys/src/video_encoder_factory.cpp @@ -19,15 +19,18 @@ #include "api/video_codecs/sdp_video_format.h" #include "api/video_codecs/video_encoder.h" #include "api/video_codecs/video_encoder_factory_template.h" -#include "api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h" #include "livekit/objc_video_factory.h" #include "media/base/media_constants.h" #include "media/engine/simulcast_encoder_adapter.h" #include "rtc_base/logging.h" - +#if defined(RTC_USE_LIBAOM_AV1_ENCODER) +#include "api/video_codecs/video_encoder_factory_template_libaom_av1_adapter.h" +#endif #if defined(WEBRTC_USE_H264) #include "api/video_codecs/video_encoder_factory_template_open_h264_adapter.h" #endif +#include "api/video_codecs/video_encoder_factory_template_libvpx_vp8_adapter.h" +#include "api/video_codecs/video_encoder_factory_template_libvpx_vp9_adapter.h" #ifdef WEBRTC_ANDROID #include "livekit/android.h" @@ -35,13 +38,15 @@ namespace livekit { -using Factory = - webrtc::VideoEncoderFactoryTemplate; + webrtc::LibvpxVp9EncoderTemplateAdapter>; VideoEncoderFactory::InternalFactory::InternalFactory() { #ifdef __APPLE__