From a1b926ece849e45f6a38eb66a2015deaee35f475 Mon Sep 17 00:00:00 2001 From: aoife cassidy Date: Wed, 11 Dec 2024 19:57:22 +0200 Subject: [PATCH] chore(webrtc-sys): bump to m125_release (#505) --- .nanpa/bump-webrtc.kdl | 2 ++ webrtc-sys/include/livekit/audio_device.h | 4 +-- webrtc-sys/include/livekit/audio_track.h | 4 +-- .../include/livekit/video_decoder_factory.h | 5 ++-- .../include/livekit/video_encoder_factory.h | 8 +++--- webrtc-sys/libwebrtc/.gclient | 2 +- webrtc-sys/libwebrtc/build_android.sh | 5 ++++ webrtc-sys/libwebrtc/build_ios.sh | 5 ++++ webrtc-sys/libwebrtc/build_linux.sh | 5 ++++ webrtc-sys/libwebrtc/build_macos.sh | 5 ++++ webrtc-sys/libwebrtc/build_windows.cmd | 5 ++++ .../patches/abseil_use_optional.patch | 13 +++++++++ webrtc-sys/src/audio_device.cpp | 6 ++--- webrtc-sys/src/audio_track.cpp | 6 ++--- webrtc-sys/src/peer_connection_factory.cpp | 27 +++++++------------ webrtc-sys/src/video_decoder_factory.cpp | 11 ++++---- webrtc-sys/src/video_encoder_factory.cpp | 15 ++++++----- 17 files changed, 82 insertions(+), 46 deletions(-) create mode 100644 .nanpa/bump-webrtc.kdl create mode 100644 webrtc-sys/libwebrtc/patches/abseil_use_optional.patch diff --git a/.nanpa/bump-webrtc.kdl b/.nanpa/bump-webrtc.kdl new file mode 100644 index 000000000..996bd1e19 --- /dev/null +++ b/.nanpa/bump-webrtc.kdl @@ -0,0 +1,2 @@ +patch package="webrtc-sys/build" type="added" "bump libwebrtc to m125" +patch package="webrtc-sys" type="added" "bump libwebrtc to m125" diff --git a/webrtc-sys/include/livekit/audio_device.h b/webrtc-sys/include/livekit/audio_device.h index 903e22d6e..74d76823a 100644 --- a/webrtc-sys/include/livekit/audio_device.h +++ b/webrtc-sys/include/livekit/audio_device.h @@ -19,9 +19,9 @@ #include #include "api/task_queue/task_queue_factory.h" +#include "api/task_queue/task_queue_base.h" #include "modules/audio_device/include/audio_device.h" #include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" #include "rtc_base/task_utils/repeating_task.h" namespace livekit { @@ -119,7 +119,7 @@ class AudioDevice : public webrtc::AudioDeviceModule { private: mutable webrtc::Mutex mutex_; std::vector data_; - std::unique_ptr audio_queue_; + std::unique_ptr audio_queue_; webrtc::RepeatingTaskHandle audio_task_; webrtc::AudioTransport* audio_transport_; webrtc::TaskQueueFactory* task_queue_factory_; diff --git a/webrtc-sys/include/livekit/audio_track.h b/webrtc-sys/include/livekit/audio_track.h index e7f3e7520..c780b7797 100644 --- a/webrtc-sys/include/livekit/audio_track.h +++ b/webrtc-sys/include/livekit/audio_track.h @@ -27,7 +27,7 @@ #include "livekit/webrtc.h" #include "pc/local_audio_source.h" #include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" +#include "api/task_queue/task_queue_base.h" #include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/thread_annotations.h" #include "rust/cxx.h" @@ -127,7 +127,7 @@ class AudioTrackSource { private: mutable webrtc::Mutex mutex_; - std::unique_ptr audio_queue_; + std::unique_ptr audio_queue_; webrtc::RepeatingTaskHandle audio_task_; std::vector sinks_ RTC_GUARDED_BY(mutex_); diff --git a/webrtc-sys/include/livekit/video_decoder_factory.h b/webrtc-sys/include/livekit/video_decoder_factory.h index 1943601e6..9b2d7030d 100644 --- a/webrtc-sys/include/livekit/video_decoder_factory.h +++ b/webrtc-sys/include/livekit/video_decoder_factory.h @@ -18,6 +18,7 @@ #include "api/video_codecs/video_decoder.h" #include "api/video_codecs/video_decoder_factory.h" +#include "absl/strings/match.h" namespace livekit { class VideoDecoderFactory : public webrtc::VideoDecoderFactory { @@ -29,8 +30,8 @@ class VideoDecoderFactory : public webrtc::VideoDecoderFactory { CodecSupport QueryCodecSupport(const webrtc::SdpVideoFormat& format, bool reference_scaling) const override; - std::unique_ptr CreateVideoDecoder( - const webrtc::SdpVideoFormat& format) override; + std::unique_ptr Create( + const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) override; private: std::vector> factories_; diff --git a/webrtc-sys/include/livekit/video_encoder_factory.h b/webrtc-sys/include/livekit/video_encoder_factory.h index 1d7852f81..f1e8bc84a 100644 --- a/webrtc-sys/include/livekit/video_encoder_factory.h +++ b/webrtc-sys/include/livekit/video_encoder_factory.h @@ -31,8 +31,8 @@ class VideoEncoderFactory : public webrtc::VideoEncoderFactory { const webrtc::SdpVideoFormat& format, absl::optional scalability_mode) const override; - std::unique_ptr CreateVideoEncoder( - const webrtc::SdpVideoFormat& format) override; + std::unique_ptr Create( + const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) override; private: std::vector> factories_; @@ -47,8 +47,8 @@ class VideoEncoderFactory : public webrtc::VideoEncoderFactory { const webrtc::SdpVideoFormat& format, absl::optional scalability_mode) const override; - std::unique_ptr CreateVideoEncoder( - const webrtc::SdpVideoFormat& format) override; + std::unique_ptr Create( + const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) override; private: std::unique_ptr internal_factory_; diff --git a/webrtc-sys/libwebrtc/.gclient b/webrtc-sys/libwebrtc/.gclient index 5f2dc30af..b4fbb1f00 100644 --- a/webrtc-sys/libwebrtc/.gclient +++ b/webrtc-sys/libwebrtc/.gclient @@ -1,7 +1,7 @@ solutions = [ { "name": 'src', - "url": 'https://github.com/webrtc-sdk/webrtc.git@m114_release', + "url": 'https://github.com/webrtc-sdk/webrtc.git@m125_release', "custom_deps": {}, "deps_file": "DEPS", "managed": False, diff --git a/webrtc-sys/libwebrtc/build_android.sh b/webrtc-sys/libwebrtc/build_android.sh index 01778b206..0b7006fcc 100755 --- a/webrtc-sys/libwebrtc/build_android.sh +++ b/webrtc-sys/libwebrtc/build_android.sh @@ -71,6 +71,11 @@ cd src git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/android_use_libunwind.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn + +cd third_party +git apply "$COMMAND_DIR/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn +cd .. + cd .. mkdir -p "$ARTIFACTS_DIR/lib" diff --git a/webrtc-sys/libwebrtc/build_ios.sh b/webrtc-sys/libwebrtc/build_ios.sh index 3bed8f7f8..94505e8b0 100755 --- a/webrtc-sys/libwebrtc/build_ios.sh +++ b/webrtc-sys/libwebrtc/build_ios.sh @@ -81,6 +81,11 @@ cd src # git apply "$COMMAND_DIR/patches/add_licenses.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn + +cd third_party +git apply "$COMMAND_DIR/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn +cd .. + cd .. mkdir -p "$ARTIFACTS_DIR/lib" diff --git a/webrtc-sys/libwebrtc/build_linux.sh b/webrtc-sys/libwebrtc/build_linux.sh index 5f1af2212..ef63dc744 100755 --- a/webrtc-sys/libwebrtc/build_linux.sh +++ b/webrtc-sys/libwebrtc/build_linux.sh @@ -70,6 +70,11 @@ cd src git apply "$COMMAND_DIR/patches/add_licenses.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn + +cd third_party +git apply "$COMMAND_DIR/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn +cd .. + cd .. mkdir -p "$ARTIFACTS_DIR/lib" diff --git a/webrtc-sys/libwebrtc/build_macos.sh b/webrtc-sys/libwebrtc/build_macos.sh index 4498b2eb0..5b07cb1e3 100755 --- a/webrtc-sys/libwebrtc/build_macos.sh +++ b/webrtc-sys/libwebrtc/build_macos.sh @@ -70,6 +70,11 @@ cd src git apply "$COMMAND_DIR/patches/add_licenses.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn git apply "$COMMAND_DIR/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn + +cd third_party +git apply "$COMMAND_DIR/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn +cd .. + cd .. mkdir -p "$ARTIFACTS_DIR/lib" diff --git a/webrtc-sys/libwebrtc/build_windows.cmd b/webrtc-sys/libwebrtc/build_windows.cmd index 47ca9845b..249320581 100644 --- a/webrtc-sys/libwebrtc/build_windows.cmd +++ b/webrtc-sys/libwebrtc/build_windows.cmd @@ -54,6 +54,11 @@ call git apply "%COMMAND_DIR%/patches/add_licenses.patch" -v --ignore-space-chan call git apply "%COMMAND_DIR%/patches/add_deps.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn call git apply "%COMMAND_DIR%/patches/windows_silence_warnings.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn call git apply "%COMMAND_DIR%/patches/ssl_verify_callback_with_native_handle.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn + +cd third_party +call git apply "%COMMAND_DIR%/patches/abseil_use_optional.patch" -v --ignore-space-change --ignore-whitespace --whitespace=nowarn +cd .. + cd .. mkdir "%ARTIFACTS_DIR%\lib" diff --git a/webrtc-sys/libwebrtc/patches/abseil_use_optional.patch b/webrtc-sys/libwebrtc/patches/abseil_use_optional.patch new file mode 100644 index 000000000..476ad2619 --- /dev/null +++ b/webrtc-sys/libwebrtc/patches/abseil_use_optional.patch @@ -0,0 +1,13 @@ +diff --git a/abseil-cpp/absl/base/options.h b/abseil-cpp/absl/base/options.h +index bd43b6ef0..ab5917e75 100644 +--- a/abseil-cpp/absl/base/options.h ++++ b/abseil-cpp/absl/base/options.h +@@ -121,7 +121,7 @@ + // absl::optional is a typedef of std::optional, use the feature macro + // ABSL_USES_STD_OPTIONAL. + +-#define ABSL_OPTION_USE_STD_OPTIONAL 2 ++#define ABSL_OPTION_USE_STD_OPTIONAL 0 + + + // ABSL_OPTION_USE_STD_STRING_VIEW diff --git a/webrtc-sys/src/audio_device.cpp b/webrtc-sys/src/audio_device.cpp index 75911917a..d146a0c8a 100644 --- a/webrtc-sys/src/audio_device.cpp +++ b/webrtc-sys/src/audio_device.cpp @@ -48,11 +48,11 @@ int32_t AudioDevice::Init() { return 0; audio_queue_ = - std::make_unique(task_queue_factory_->CreateTaskQueue( - "AudioDevice", webrtc::TaskQueueFactory::Priority::NORMAL)); + task_queue_factory_->CreateTaskQueue( + "AudioDevice", webrtc::TaskQueueFactory::Priority::NORMAL); audio_task_ = - webrtc::RepeatingTaskHandle::Start(audio_queue_->Get(), [this]() { + webrtc::RepeatingTaskHandle::Start(audio_queue_.get(), [this]() { webrtc::MutexLock lock(&mutex_); if (playing_) { diff --git a/webrtc-sys/src/audio_track.cpp b/webrtc-sys/src/audio_track.cpp index 8a49c3203..8ca76e801 100644 --- a/webrtc-sys/src/audio_track.cpp +++ b/webrtc-sys/src/audio_track.cpp @@ -153,11 +153,11 @@ AudioTrackSource::InternalSource::InternalSource( buffer_.reserve(queue_size_samples_ + notify_threshold_samples_); audio_queue_ = - std::make_unique(task_queue_factory->CreateTaskQueue( - "AudioSourceCapture", webrtc::TaskQueueFactory::Priority::NORMAL)); + task_queue_factory->CreateTaskQueue( + "AudioSourceCapture", webrtc::TaskQueueFactory::Priority::NORMAL); audio_task_ = webrtc::RepeatingTaskHandle::Start( - audio_queue_->Get(), + audio_queue_.get(), [this, samples10ms]() { webrtc::MutexLock lock(&mutex_); diff --git a/webrtc-sys/src/peer_connection_factory.cpp b/webrtc-sys/src/peer_connection_factory.cpp index bbc73bfdc..31b32729e 100644 --- a/webrtc-sys/src/peer_connection_factory.cpp +++ b/webrtc-sys/src/peer_connection_factory.cpp @@ -23,6 +23,7 @@ #include "api/audio_codecs/builtin_audio_encoder_factory.h" #include "api/peer_connection_interface.h" #include "api/rtc_error.h" +#include "api/enable_media.h" #include "api/rtc_event_log/rtc_event_log_factory.h" #include "api/task_queue/default_task_queue_factory.h" #include "api/video_codecs/builtin_video_decoder_factory.h" @@ -35,7 +36,6 @@ #include "livekit/video_decoder_factory.h" #include "livekit/video_encoder_factory.h" #include "livekit/webrtc.h" -#include "media/engine/webrtc_media_engine.h" #include "rtc_base/thread.h" #include "webrtc-sys/src/peer_connection.rs.h" #include "webrtc-sys/src/peer_connection_factory.rs.h" @@ -55,32 +55,25 @@ PeerConnectionFactory::PeerConnectionFactory( dependencies.signaling_thread = rtc_runtime_->signaling_thread(); dependencies.socket_factory = rtc_runtime_->network_thread()->socketserver(); dependencies.task_queue_factory = webrtc::CreateDefaultTaskQueueFactory(); - dependencies.event_log_factory = std::make_unique( - dependencies.task_queue_factory.get()); - dependencies.call_factory = webrtc::CreateCallFactory(); + dependencies.event_log_factory = std::make_unique(); dependencies.trials = std::make_unique(); - cricket::MediaEngineDependencies media_deps; - media_deps.task_queue_factory = dependencies.task_queue_factory.get(); - audio_device_ = rtc_runtime_->worker_thread()->BlockingCall([&] { return rtc::make_ref_counted( - media_deps.task_queue_factory); + dependencies.task_queue_factory.get()); }); - media_deps.adm = audio_device_; + dependencies.adm = audio_device_; - media_deps.video_encoder_factory = + dependencies.video_encoder_factory = std::move(std::make_unique()); - media_deps.video_decoder_factory = + dependencies.video_decoder_factory = std::move(std::make_unique()); - media_deps.audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory(); - media_deps.audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory(); - media_deps.audio_processing = webrtc::AudioProcessingBuilder().Create(); - media_deps.trials = dependencies.trials.get(); - - dependencies.media_engine = cricket::CreateMediaEngine(std::move(media_deps)); + dependencies.audio_encoder_factory = webrtc::CreateBuiltinAudioEncoderFactory(); + dependencies.audio_decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory(); + dependencies.audio_processing = webrtc::AudioProcessingBuilder().Create(); + webrtc::EnableMedia(dependencies); peer_factory_ = webrtc::CreateModularPeerConnectionFactory(std::move(dependencies)); diff --git a/webrtc-sys/src/video_decoder_factory.cpp b/webrtc-sys/src/video_decoder_factory.cpp index 40e742897..f7e7bb082 100644 --- a/webrtc-sys/src/video_decoder_factory.cpp +++ b/webrtc-sys/src/video_decoder_factory.cpp @@ -16,6 +16,7 @@ #include "livekit/video_decoder_factory.h" +#include "api/environment/environment.h" #include "api/video_codecs/av1_profile.h" #include "api/video_codecs/sdp_video_format.h" #include "livekit/objc_video_factory.h" @@ -69,7 +70,7 @@ std::vector VideoDecoderFactory::GetSupportedFormats() formats.push_back(webrtc::SdpVideoFormat(cricket::kAv1CodecName)); formats.push_back(webrtc::SdpVideoFormat( cricket::kAv1CodecName, - {{webrtc::kAV1FmtpProfile, + {{cricket::kAv1FmtpProfile, AV1ProfileToString(webrtc::AV1Profile::kProfile1).data()}})); #endif @@ -92,17 +93,17 @@ VideoDecoderFactory::CodecSupport VideoDecoderFactory::QueryCodecSupport( return codec_support; } -std::unique_ptr VideoDecoderFactory::CreateVideoDecoder( - const webrtc::SdpVideoFormat& format) { +std::unique_ptr VideoDecoderFactory::Create( + const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) { for (const auto& factory : factories_) { for (const auto& supported_format : factory->GetSupportedFormats()) { if (supported_format.IsSameCodec(format)) - return factory->CreateVideoDecoder(format); + return factory->Create(env, format); } } if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName)) - return webrtc::VP8Decoder::Create(); + return webrtc::CreateVp8Decoder(env); if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName)) return webrtc::VP9Decoder::Create(); if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName)) diff --git a/webrtc-sys/src/video_encoder_factory.cpp b/webrtc-sys/src/video_encoder_factory.cpp index b2005867c..cd362675e 100644 --- a/webrtc-sys/src/video_encoder_factory.cpp +++ b/webrtc-sys/src/video_encoder_factory.cpp @@ -16,6 +16,7 @@ #include "livekit/video_encoder_factory.h" +#include "api/environment/environment_factory.h" #include "api/video_codecs/sdp_video_format.h" #include "api/video_codecs/video_encoder.h" #include "api/video_codecs/video_encoder_factory_template.h" @@ -84,12 +85,12 @@ VideoEncoderFactory::InternalFactory::QueryCodecSupport( } std::unique_ptr -VideoEncoderFactory::InternalFactory::CreateVideoEncoder( - const webrtc::SdpVideoFormat& format) { +VideoEncoderFactory::InternalFactory::Create( + const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) { for (const auto& factory : factories_) { for (const auto& supported_format : factory->GetSupportedFormats()) { if (supported_format.IsSameCodec(format)) - return factory->CreateVideoEncoder(format); + return factory->Create(env, format); } } @@ -97,7 +98,7 @@ VideoEncoderFactory::InternalFactory::CreateVideoEncoder( webrtc::FuzzyMatchSdpVideoFormat(Factory().GetSupportedFormats(), format); if (original_format) { - return Factory().CreateVideoEncoder(*original_format); + return Factory().Create(env, *original_format); } RTC_LOG(LS_ERROR) << "No VideoEncoder found for " << format.name; @@ -119,12 +120,12 @@ VideoEncoderFactory::CodecSupport VideoEncoderFactory::QueryCodecSupport( return internal_factory_->QueryCodecSupport(format, scalability_mode); } -std::unique_ptr VideoEncoderFactory::CreateVideoEncoder( - const webrtc::SdpVideoFormat& format) { +std::unique_ptr VideoEncoderFactory::Create( + const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) { std::unique_ptr encoder; if (format.IsCodecInList(internal_factory_->GetSupportedFormats())) { encoder = std::make_unique( - internal_factory_.get(), format); + env, internal_factory_.get(), nullptr, format); } return encoder;