Skip to content

Commit

Permalink
chore(webrtc-sys): bump to m125_release (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp authored Dec 11, 2024
1 parent 2ba0a2e commit a1b926e
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .nanpa/bump-webrtc.kdl
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions webrtc-sys/include/livekit/audio_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <atomic>

#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 {
Expand Down Expand Up @@ -119,7 +119,7 @@ class AudioDevice : public webrtc::AudioDeviceModule {
private:
mutable webrtc::Mutex mutex_;
std::vector<int16_t> data_;
std::unique_ptr<rtc::TaskQueue> audio_queue_;
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> audio_queue_;
webrtc::RepeatingTaskHandle audio_task_;
webrtc::AudioTransport* audio_transport_;
webrtc::TaskQueueFactory* task_queue_factory_;
Expand Down
4 changes: 2 additions & 2 deletions webrtc-sys/include/livekit/audio_track.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -127,7 +127,7 @@ class AudioTrackSource {

private:
mutable webrtc::Mutex mutex_;
std::unique_ptr<rtc::TaskQueue> audio_queue_;
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> audio_queue_;
webrtc::RepeatingTaskHandle audio_task_;

std::vector<webrtc::AudioTrackSinkInterface*> sinks_ RTC_GUARDED_BY(mutex_);
Expand Down
5 changes: 3 additions & 2 deletions webrtc-sys/include/livekit/video_decoder_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -29,8 +30,8 @@ class VideoDecoderFactory : public webrtc::VideoDecoderFactory {
CodecSupport QueryCodecSupport(const webrtc::SdpVideoFormat& format,
bool reference_scaling) const override;

std::unique_ptr<webrtc::VideoDecoder> CreateVideoDecoder(
const webrtc::SdpVideoFormat& format) override;
std::unique_ptr<webrtc::VideoDecoder> Create(
const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) override;

private:
std::vector<std::unique_ptr<webrtc::VideoDecoderFactory>> factories_;
Expand Down
8 changes: 4 additions & 4 deletions webrtc-sys/include/livekit/video_encoder_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class VideoEncoderFactory : public webrtc::VideoEncoderFactory {
const webrtc::SdpVideoFormat& format,
absl::optional<std::string> scalability_mode) const override;

std::unique_ptr<webrtc::VideoEncoder> CreateVideoEncoder(
const webrtc::SdpVideoFormat& format) override;
std::unique_ptr<webrtc::VideoEncoder> Create(
const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) override;

private:
std::vector<std::unique_ptr<webrtc::VideoEncoderFactory>> factories_;
Expand All @@ -47,8 +47,8 @@ class VideoEncoderFactory : public webrtc::VideoEncoderFactory {
const webrtc::SdpVideoFormat& format,
absl::optional<std::string> scalability_mode) const override;

std::unique_ptr<webrtc::VideoEncoder> CreateVideoEncoder(
const webrtc::SdpVideoFormat& format) override;
std::unique_ptr<webrtc::VideoEncoder> Create(
const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) override;

private:
std::unique_ptr<InternalFactory> internal_factory_;
Expand Down
2 changes: 1 addition & 1 deletion webrtc-sys/libwebrtc/.gclient
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 5 additions & 0 deletions webrtc-sys/libwebrtc/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions webrtc-sys/libwebrtc/build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions webrtc-sys/libwebrtc/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions webrtc-sys/libwebrtc/build_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions webrtc-sys/libwebrtc/build_windows.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions webrtc-sys/libwebrtc/patches/abseil_use_optional.patch
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions webrtc-sys/src/audio_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ int32_t AudioDevice::Init() {
return 0;

audio_queue_ =
std::make_unique<rtc::TaskQueue>(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_) {
Expand Down
6 changes: 3 additions & 3 deletions webrtc-sys/src/audio_track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ AudioTrackSource::InternalSource::InternalSource(
buffer_.reserve(queue_size_samples_ + notify_threshold_samples_);

audio_queue_ =
std::make_unique<rtc::TaskQueue>(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_);

Expand Down
27 changes: 10 additions & 17 deletions webrtc-sys/src/peer_connection_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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<webrtc::RtcEventLogFactory>(
dependencies.task_queue_factory.get());
dependencies.call_factory = webrtc::CreateCallFactory();
dependencies.event_log_factory = std::make_unique<webrtc::RtcEventLogFactory>();
dependencies.trials = std::make_unique<webrtc::FieldTrialBasedConfig>();

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<livekit::AudioDevice>(
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<livekit::VideoEncoderFactory>());
media_deps.video_decoder_factory =
dependencies.video_decoder_factory =
std::move(std::make_unique<livekit::VideoDecoderFactory>());
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));

Expand Down
11 changes: 6 additions & 5 deletions webrtc-sys/src/video_decoder_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -69,7 +70,7 @@ std::vector<webrtc::SdpVideoFormat> 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

Expand All @@ -92,17 +93,17 @@ VideoDecoderFactory::CodecSupport VideoDecoderFactory::QueryCodecSupport(
return codec_support;
}

std::unique_ptr<webrtc::VideoDecoder> VideoDecoderFactory::CreateVideoDecoder(
const webrtc::SdpVideoFormat& format) {
std::unique_ptr<webrtc::VideoDecoder> 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))
Expand Down
15 changes: 8 additions & 7 deletions webrtc-sys/src/video_encoder_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -84,20 +85,20 @@ VideoEncoderFactory::InternalFactory::QueryCodecSupport(
}

std::unique_ptr<webrtc::VideoEncoder>
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);
}
}

auto original_format =
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;
Expand All @@ -119,12 +120,12 @@ VideoEncoderFactory::CodecSupport VideoEncoderFactory::QueryCodecSupport(
return internal_factory_->QueryCodecSupport(format, scalability_mode);
}

std::unique_ptr<webrtc::VideoEncoder> VideoEncoderFactory::CreateVideoEncoder(
const webrtc::SdpVideoFormat& format) {
std::unique_ptr<webrtc::VideoEncoder> VideoEncoderFactory::Create(
const webrtc::Environment& env, const webrtc::SdpVideoFormat& format) {
std::unique_ptr<webrtc::VideoEncoder> encoder;
if (format.IsCodecInList(internal_factory_->GetSupportedFormats())) {
encoder = std::make_unique<webrtc::SimulcastEncoderAdapter>(
internal_factory_.get(), format);
env, internal_factory_.get(), nullptr, format);
}

return encoder;
Expand Down

0 comments on commit a1b926e

Please sign in to comment.