diff options
Diffstat (limited to 'third_party/libwebrtc/media')
23 files changed, 70 insertions, 309 deletions
diff --git a/third_party/libwebrtc/media/BUILD.gn b/third_party/libwebrtc/media/BUILD.gn index 97ad4a889a..055bf75a19 100644 --- a/third_party/libwebrtc/media/BUILD.gn +++ b/third_party/libwebrtc/media/BUILD.gn @@ -262,7 +262,6 @@ rtc_library("codec") { ] deps = [ ":media_constants", - "../api:field_trials_view", "../api:rtp_parameters", "../api/audio_codecs:audio_codecs_api", "../api/video_codecs:video_codecs_api", @@ -546,7 +545,6 @@ rtc_library("rtc_audio_video") { "../rtc_base:copy_on_write_buffer", "../rtc_base:dscp", "../rtc_base:event_tracer", - "../rtc_base:ignore_wundef", "../rtc_base:logging", "../rtc_base:macromagic", "../rtc_base:network_route", @@ -611,33 +609,6 @@ rtc_library("rtc_audio_video") { } } -# Heavy but optional helper for unittests and webrtc users who prefer to use -# defaults factories or do not worry about extra dependencies and binary size. -rtc_library("rtc_media_engine_defaults") { - visibility = [ "*" ] - allow_poison = [ - "audio_codecs", - "default_task_queue", - "software_video_codecs", - ] - sources = [ - "engine/webrtc_media_engine_defaults.cc", - "engine/webrtc_media_engine_defaults.h", - ] - deps = [ - ":rtc_audio_video", - "../api/audio_codecs:builtin_audio_decoder_factory", - "../api/audio_codecs:builtin_audio_encoder_factory", - "../api/task_queue:default_task_queue_factory", - "../api/video:builtin_video_bitrate_allocator_factory", - "../api/video_codecs:builtin_video_decoder_factory", - "../api/video_codecs:builtin_video_encoder_factory", - "../modules/audio_processing:api", - "../rtc_base:checks", - "../rtc_base/system:rtc_export", - ] -} - rtc_source_set("rtc_data_sctp_transport_internal") { sources = [ "sctp/sctp_transport_internal.h" ] deps = [ @@ -840,7 +811,6 @@ if (rtc_include_tests) { ":rtc_internal_video_codecs", ":rtc_media", ":rtc_media_base", - ":rtc_media_engine_defaults", ":rtc_media_tests_utils", ":rtc_sdp_video_format_utils", ":rtc_simulcast_encoder_adapter", @@ -860,6 +830,8 @@ if (rtc_include_tests) { "../api:simulcast_test_fixture_api", "../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory", + "../api/environment", + "../api/environment:environment_factory", "../api/rtc_event_log", "../api/task_queue", "../api/task_queue:default_task_queue_factory", diff --git a/third_party/libwebrtc/media/base/codec.cc b/third_party/libwebrtc/media/base/codec.cc index b819707702..c4e1c6f1f3 100644 --- a/third_party/libwebrtc/media/base/codec.cc +++ b/third_party/libwebrtc/media/base/codec.cc @@ -158,8 +158,7 @@ bool Codec::operator==(const Codec& c) const { : (packetization == c.packetization)); } -bool Codec::Matches(const Codec& codec, - const webrtc::FieldTrialsView* field_trials) const { +bool Codec::Matches(const Codec& codec) const { // Match the codec id/name based on the typical static/dynamic name rules. // Matching is case-insensitive. diff --git a/third_party/libwebrtc/media/base/codec.h b/third_party/libwebrtc/media/base/codec.h index 228acad07a..bd4239b251 100644 --- a/third_party/libwebrtc/media/base/codec.h +++ b/third_party/libwebrtc/media/base/codec.h @@ -20,7 +20,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/audio_codecs/audio_format.h" -#include "api/field_trials_view.h" #include "api/rtp_parameters.h" #include "api/video_codecs/sdp_video_format.h" #include "media/base/media_constants.h" @@ -112,8 +111,7 @@ struct RTC_EXPORT Codec { // Indicates if this codec is compatible with the specified codec by // checking the assigned id and profile values for the relevant video codecs. // H264 levels are not compared. - bool Matches(const Codec& codec, - const webrtc::FieldTrialsView* field_trials = nullptr) const; + bool Matches(const Codec& codec) const; bool MatchesRtpCodec(const webrtc::RtpCodec& capability) const; // Find the parameter for `name` and write the value to `out`. diff --git a/third_party/libwebrtc/media/codec_gn/moz.build b/third_party/libwebrtc/media/codec_gn/moz.build index a6fa3b4063..b5ebd454d3 100644 --- a/third_party/libwebrtc/media/codec_gn/moz.build +++ b/third_party/libwebrtc/media/codec_gn/moz.build @@ -195,7 +195,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -205,10 +204,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/engine/null_webrtc_video_engine_unittest.cc b/third_party/libwebrtc/media/engine/null_webrtc_video_engine_unittest.cc index 31c442d53d..9515d44be9 100644 --- a/third_party/libwebrtc/media/engine/null_webrtc_video_engine_unittest.cc +++ b/third_party/libwebrtc/media/engine/null_webrtc_video_engine_unittest.cc @@ -37,7 +37,7 @@ TEST(NullWebRtcVideoEngineTest, CheckInterface) { task_queue_factory.get(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, - webrtc::AudioProcessingBuilder().Create(), nullptr, nullptr, trials); + webrtc::AudioProcessingBuilder().Create(), nullptr, trials); CompositeMediaEngine engine(std::move(audio_engine), std::make_unique<NullWebRtcVideoEngine>()); diff --git a/third_party/libwebrtc/media/engine/webrtc_media_engine.cc b/third_party/libwebrtc/media/engine/webrtc_media_engine.cc index 99d7dd2704..463ed29109 100644 --- a/third_party/libwebrtc/media/engine/webrtc_media_engine.cc +++ b/third_party/libwebrtc/media/engine/webrtc_media_engine.cc @@ -46,7 +46,6 @@ std::unique_ptr<MediaEngineInterface> CreateMediaEngine( std::move(dependencies.audio_decoder_factory), std::move(dependencies.audio_mixer), std::move(dependencies.audio_processing), - dependencies.audio_frame_processor, std::move(dependencies.owned_audio_frame_processor), trials); #ifdef HAVE_WEBRTC_VIDEO auto video_engine = std::make_unique<WebRtcVideoEngine>( diff --git a/third_party/libwebrtc/media/engine/webrtc_media_engine.h b/third_party/libwebrtc/media/engine/webrtc_media_engine.h index 0f6dce35b5..863db9f278 100644 --- a/third_party/libwebrtc/media/engine/webrtc_media_engine.h +++ b/third_party/libwebrtc/media/engine/webrtc_media_engine.h @@ -49,9 +49,6 @@ struct MediaEngineDependencies { rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory; rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer; rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing; - // TODO(bugs.webrtc.org/15111): - // Remove the raw AudioFrameProcessor pointer in the follow-up. - webrtc::AudioFrameProcessor* audio_frame_processor = nullptr; std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor; std::unique_ptr<webrtc::VideoEncoderFactory> video_encoder_factory; @@ -63,8 +60,9 @@ struct MediaEngineDependencies { // CreateMediaEngine may be called on any thread, though the engine is // only expected to be used on one thread, internally called the "worker // thread". This is the thread Init must be called on. -RTC_EXPORT std::unique_ptr<MediaEngineInterface> CreateMediaEngine( - MediaEngineDependencies dependencies); +[[deprecated("bugs.webrtc.org/15574")]] // +RTC_EXPORT std::unique_ptr<MediaEngineInterface> +CreateMediaEngine(MediaEngineDependencies dependencies); // Verify that extension IDs are within 1-byte extension range and are not // overlapping, and that they form a legal change from previously registerd diff --git a/third_party/libwebrtc/media/engine/webrtc_media_engine_defaults.cc b/third_party/libwebrtc/media/engine/webrtc_media_engine_defaults.cc deleted file mode 100644 index 1660873e8b..0000000000 --- a/third_party/libwebrtc/media/engine/webrtc_media_engine_defaults.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ -#include "media/engine/webrtc_media_engine_defaults.h" - -#include "api/audio_codecs/builtin_audio_decoder_factory.h" -#include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "api/task_queue/default_task_queue_factory.h" -#include "api/video/builtin_video_bitrate_allocator_factory.h" -#include "api/video_codecs/builtin_video_decoder_factory.h" -#include "api/video_codecs/builtin_video_encoder_factory.h" -#include "modules/audio_processing/include/audio_processing.h" -#include "rtc_base/checks.h" - -namespace webrtc { - -void SetMediaEngineDefaults(cricket::MediaEngineDependencies* deps) { - RTC_DCHECK(deps); - if (deps->task_queue_factory == nullptr) { - static TaskQueueFactory* const task_queue_factory = - CreateDefaultTaskQueueFactory().release(); - deps->task_queue_factory = task_queue_factory; - } - if (deps->audio_encoder_factory == nullptr) - deps->audio_encoder_factory = CreateBuiltinAudioEncoderFactory(); - if (deps->audio_decoder_factory == nullptr) - deps->audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); - if (deps->audio_processing == nullptr) - deps->audio_processing = AudioProcessingBuilder().Create(); - - if (deps->video_encoder_factory == nullptr) - deps->video_encoder_factory = CreateBuiltinVideoEncoderFactory(); - if (deps->video_decoder_factory == nullptr) - deps->video_decoder_factory = CreateBuiltinVideoDecoderFactory(); -} - -} // namespace webrtc diff --git a/third_party/libwebrtc/media/engine/webrtc_media_engine_defaults.h b/third_party/libwebrtc/media/engine/webrtc_media_engine_defaults.h deleted file mode 100644 index 16b1d462e3..0000000000 --- a/third_party/libwebrtc/media/engine/webrtc_media_engine_defaults.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef MEDIA_ENGINE_WEBRTC_MEDIA_ENGINE_DEFAULTS_H_ -#define MEDIA_ENGINE_WEBRTC_MEDIA_ENGINE_DEFAULTS_H_ - -#include "media/engine/webrtc_media_engine.h" -#include "rtc_base/system/rtc_export.h" - -namespace webrtc { - -// Sets required but null dependencies with default factories. -RTC_EXPORT void SetMediaEngineDefaults(cricket::MediaEngineDependencies* deps); - -} // namespace webrtc - -#endif // MEDIA_ENGINE_WEBRTC_MEDIA_ENGINE_DEFAULTS_H_ diff --git a/third_party/libwebrtc/media/engine/webrtc_media_engine_unittest.cc b/third_party/libwebrtc/media/engine/webrtc_media_engine_unittest.cc index 4615f03deb..40cad75701 100644 --- a/third_party/libwebrtc/media/engine/webrtc_media_engine_unittest.cc +++ b/third_party/libwebrtc/media/engine/webrtc_media_engine_unittest.cc @@ -14,7 +14,6 @@ #include <string> #include <utility> -#include "media/engine/webrtc_media_engine_defaults.h" #include "test/gtest.h" #include "test/scoped_key_value_config.h" @@ -322,16 +321,4 @@ TEST(WebRtcMediaEngineTest, FilterRtpExtensionsRemoveRedundantBwe3) { EXPECT_EQ(RtpExtension::kTimestampOffsetUri, filtered[0].uri); } -TEST(WebRtcMediaEngineTest, Create) { - MediaEngineDependencies deps; - webrtc::SetMediaEngineDefaults(&deps); - webrtc::test::ScopedKeyValueConfig trials; - deps.trials = &trials; - - std::unique_ptr<MediaEngineInterface> engine = - CreateMediaEngine(std::move(deps)); - - EXPECT_TRUE(engine); -} - } // namespace cricket diff --git a/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc b/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc index e8b7ee4b2d..f5736679be 100644 --- a/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc +++ b/third_party/libwebrtc/media/engine/webrtc_video_engine_unittest.cc @@ -20,9 +20,9 @@ #include "absl/algorithm/container.h" #include "absl/strings/match.h" -#include "api/rtc_event_log/rtc_event_log.h" +#include "api/environment/environment.h" +#include "api/environment/environment_factory.h" #include "api/rtp_parameters.h" -#include "api/task_queue/default_task_queue_factory.h" #include "api/test/mock_encoder_selector.h" #include "api/test/mock_video_bitrate_allocator.h" #include "api/test/mock_video_bitrate_allocator_factory.h" @@ -101,6 +101,8 @@ using ::testing::WithArg; using ::webrtc::BitrateConstraints; using ::webrtc::Call; using ::webrtc::CallConfig; +using ::webrtc::CreateEnvironment; +using ::webrtc::Environment; using ::webrtc::kDefaultScalabilityModeStr; using ::webrtc::RtpExtension; using ::webrtc::RtpPacket; @@ -355,13 +357,10 @@ class WebRtcVideoEngineTest : public ::testing::Test { explicit WebRtcVideoEngineTest(const std::string& field_trials) : field_trials_(field_trials), time_controller_(webrtc::Timestamp::Millis(4711)), - task_queue_factory_(time_controller_.CreateTaskQueueFactory()), - call_(Call::Create([&] { - CallConfig call_config(&event_log_); - call_config.task_queue_factory = task_queue_factory_.get(); - call_config.trials = &field_trials_; - return call_config; - }())), + env_(CreateEnvironment(&field_trials_, + time_controller_.CreateTaskQueueFactory(), + time_controller_.GetClock())), + call_(Call::Create(CallConfig(env_))), encoder_factory_(new cricket::FakeWebRtcVideoEncoderFactory), decoder_factory_(new cricket::FakeWebRtcVideoDecoderFactory), video_bitrate_allocator_factory_( @@ -398,8 +397,7 @@ class WebRtcVideoEngineTest : public ::testing::Test { webrtc::test::ScopedKeyValueConfig field_trials_; webrtc::GlobalSimulatedTimeController time_controller_; - webrtc::RtcEventLogNull event_log_; - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_; + Environment env_; // Used in WebRtcVideoEngineVoiceTest, but defined here so it's properly // initialized when the constructor is called. std::unique_ptr<Call> call_; @@ -1479,14 +1477,10 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) { EXPECT_CALL(*decoder_factory, CreateVideoDecoder(format)).Times(0); // Create a call. - webrtc::RtcEventLogNull event_log; webrtc::GlobalSimulatedTimeController time_controller( webrtc::Timestamp::Millis(4711)); - auto task_queue_factory = time_controller.CreateTaskQueueFactory(); - CallConfig call_config(&event_log); - webrtc::FieldTrialBasedConfig field_trials; - call_config.trials = &field_trials; - call_config.task_queue_factory = task_queue_factory.get(); + CallConfig call_config(CreateEnvironment( + time_controller.CreateTaskQueueFactory(), time_controller.GetClock())); const std::unique_ptr<Call> call = Call::Create(call_config); // Create send channel. @@ -1615,18 +1609,11 @@ TEST_F(WebRtcVideoEngineTest, SetVideoRtxEnabled) { class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test { protected: - CallConfig GetCallConfig(webrtc::RtcEventLogNull* event_log, - webrtc::TaskQueueFactory* task_queue_factory) { - CallConfig call_config(event_log); - call_config.task_queue_factory = task_queue_factory; - call_config.trials = &field_trials_; - return call_config; - } - WebRtcVideoChannelEncodedFrameCallbackTest() - : task_queue_factory_(time_controller_.CreateTaskQueueFactory()), - call_(Call::Create( - GetCallConfig(&event_log_, task_queue_factory_.get()))), + : env_(CreateEnvironment(&field_trials_, + time_controller_.CreateTaskQueueFactory(), + time_controller_.GetClock())), + call_(Call::Create(CallConfig(env_))), video_bitrate_allocator_factory_( webrtc::CreateBuiltinVideoBitrateAllocatorFactory()), engine_( @@ -1676,8 +1663,7 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test { webrtc::GlobalSimulatedTimeController time_controller_{ Timestamp::Seconds(1000)}; webrtc::test::ScopedKeyValueConfig field_trials_; - webrtc::RtcEventLogNull event_log_; - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_; + Environment env_; std::unique_ptr<Call> call_; std::unique_ptr<webrtc::VideoBitrateAllocatorFactory> video_bitrate_allocator_factory_; @@ -1796,7 +1782,9 @@ TEST_F(WebRtcVideoChannelEncodedFrameCallbackTest, DoesNotDecodeWhenDisabled) { class WebRtcVideoChannelBaseTest : public ::testing::Test { protected: WebRtcVideoChannelBaseTest() - : task_queue_factory_(time_controller_.CreateTaskQueueFactory()), + : env_(CreateEnvironment(&field_trials_, + time_controller_.CreateTaskQueueFactory(), + time_controller_.GetClock())), video_bitrate_allocator_factory_( webrtc::CreateBuiltinVideoBitrateAllocatorFactory()), engine_(std::make_unique<webrtc::VideoEncoderFactoryTemplate< @@ -1814,10 +1802,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test { void SetUp() override { // One testcase calls SetUp in a loop, only create call_ once. if (!call_) { - CallConfig call_config(&event_log_); - call_config.task_queue_factory = task_queue_factory_.get(); - call_config.trials = &field_trials_; - call_ = Call::Create(call_config); + call_ = Call::Create(CallConfig(env_)); } cricket::MediaConfig media_config; @@ -2016,10 +2001,9 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test { webrtc::GlobalSimulatedTimeController time_controller_{ Timestamp::Seconds(1000)}; - webrtc::RtcEventLogNull event_log_; webrtc::test::ScopedKeyValueConfig field_trials_; std::unique_ptr<webrtc::test::ScopedKeyValueConfig> override_field_trials_; - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_; + Environment env_; std::unique_ptr<Call> call_; std::unique_ptr<webrtc::VideoBitrateAllocatorFactory> video_bitrate_allocator_factory_; @@ -4378,7 +4362,7 @@ TEST_F(WebRtcVideoChannelTest, SetDefaultSendCodecs) { absl::optional<VideoCodec> codec = send_channel_->GetSendCodec(); ASSERT_TRUE(codec); - EXPECT_TRUE(codec->Matches(engine_.send_codecs()[0], &field_trials_)); + EXPECT_TRUE(codec->Matches(engine_.send_codecs()[0])); // Using a RTX setup to verify that the default RTX payload type is good. const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); @@ -9863,7 +9847,6 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test { } webrtc::test::ScopedKeyValueConfig field_trials_; - webrtc::RtcEventLogNull event_log_; FakeCall fake_call_; cricket::FakeWebRtcVideoEncoderFactory* encoder_factory_; cricket::FakeWebRtcVideoDecoderFactory* decoder_factory_; diff --git a/third_party/libwebrtc/media/engine/webrtc_voice_engine.cc b/third_party/libwebrtc/media/engine/webrtc_voice_engine.cc index adf8b5c51d..adf662074d 100644 --- a/third_party/libwebrtc/media/engine/webrtc_voice_engine.cc +++ b/third_party/libwebrtc/media/engine/webrtc_voice_engine.cc @@ -66,7 +66,6 @@ #include "rtc_base/checks.h" #include "rtc_base/dscp.h" #include "rtc_base/experiments/struct_parameters_parser.h" -#include "rtc_base/ignore_wundef.h" #include "rtc_base/logging.h" #include "rtc_base/race_checker.h" #include "rtc_base/string_encode.h" @@ -79,13 +78,12 @@ #include "system_wrappers/include/metrics.h" #if WEBRTC_ENABLE_PROTOBUF -RTC_PUSH_IGNORING_WUNDEF() #ifdef WEBRTC_ANDROID_PLATFORM_BUILD #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/config.pb.h" #else #include "modules/audio_coding/audio_network_adaptor/config.pb.h" #endif -RTC_POP_IGNORING_WUNDEF() + #endif namespace cricket { @@ -147,12 +145,10 @@ bool IsCodec(const AudioCodec& codec, const char* ref_name) { return absl::EqualsIgnoreCase(codec.name, ref_name); } -absl::optional<AudioCodec> FindCodec( - const std::vector<AudioCodec>& codecs, - const AudioCodec& codec, - const webrtc::FieldTrialsView* field_trials) { +absl::optional<AudioCodec> FindCodec(const std::vector<AudioCodec>& codecs, + const AudioCodec& codec) { for (const AudioCodec& c : codecs) { - if (c.Matches(codec, field_trials)) { + if (c.Matches(codec)) { return c; } } @@ -344,10 +340,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine( const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing, - // TODO(bugs.webrtc.org/15111): - // Remove the raw AudioFrameProcessor pointer in the follow-up. - webrtc::AudioFrameProcessor* audio_frame_processor, - std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor, + std::unique_ptr<webrtc::AudioFrameProcessor> audio_frame_processor, const webrtc::FieldTrialsView& trials) : task_queue_factory_(task_queue_factory), adm_(adm), @@ -355,8 +348,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine( decoder_factory_(decoder_factory), audio_mixer_(audio_mixer), apm_(audio_processing), - audio_frame_processor_(audio_frame_processor), - owned_audio_frame_processor_(std::move(owned_audio_frame_processor)), + audio_frame_processor_(std::move(audio_frame_processor)), minimized_remsampling_on_mobile_trial_enabled_( IsEnabled(trials, "WebRTC-Audio-MinimizeResamplingOnMobile")) { RTC_LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; @@ -425,11 +417,7 @@ void WebRtcVoiceEngine::Init() { if (audio_frame_processor_) { config.async_audio_processing_factory = rtc::make_ref_counted<webrtc::AsyncAudioProcessing::Factory>( - *audio_frame_processor_, *task_queue_factory_); - } else if (owned_audio_frame_processor_) { - config.async_audio_processing_factory = - rtc::make_ref_counted<webrtc::AsyncAudioProcessing::Factory>( - std::move(owned_audio_frame_processor_), *task_queue_factory_); + std::move(audio_frame_processor_), *task_queue_factory_); } audio_state_ = webrtc::AudioState::Create(config); } @@ -2151,8 +2139,7 @@ bool WebRtcVoiceReceiveChannel::SetRecvCodecs( for (const AudioCodec& codec : codecs) { // Log a warning if a codec's payload type is changing. This used to be // treated as an error. It's abnormal, but not really illegal. - absl::optional<AudioCodec> old_codec = - FindCodec(recv_codecs_, codec, &call_->trials()); + absl::optional<AudioCodec> old_codec = FindCodec(recv_codecs_, codec); if (old_codec && old_codec->id != codec.id) { RTC_LOG(LS_WARNING) << codec.name << " mapped to a second payload type (" << codec.id << ", was already mapped to " diff --git a/third_party/libwebrtc/media/engine/webrtc_voice_engine.h b/third_party/libwebrtc/media/engine/webrtc_voice_engine.h index a3e6d3acab..ed71667525 100644 --- a/third_party/libwebrtc/media/engine/webrtc_voice_engine.h +++ b/third_party/libwebrtc/media/engine/webrtc_voice_engine.h @@ -90,9 +90,6 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface { const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing, - // TODO(bugs.webrtc.org/15111): - // Remove the raw AudioFrameProcessor pointer in the follow-up. - webrtc::AudioFrameProcessor* audio_frame_processor, std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor, const webrtc::FieldTrialsView& trials); @@ -166,10 +163,7 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface { // The audio processing module. rtc::scoped_refptr<webrtc::AudioProcessing> apm_; // Asynchronous audio processing. - // TODO(bugs.webrtc.org/15111): - // Remove the raw AudioFrameProcessor pointer in the follow-up. - webrtc::AudioFrameProcessor* const audio_frame_processor_; - std::unique_ptr<webrtc::AudioFrameProcessor> owned_audio_frame_processor_; + std::unique_ptr<webrtc::AudioFrameProcessor> audio_frame_processor_; // The primary instance of WebRtc VoiceEngine. rtc::scoped_refptr<webrtc::AudioState> audio_state_; std::vector<AudioCodec> send_codecs_; diff --git a/third_party/libwebrtc/media/engine/webrtc_voice_engine_unittest.cc b/third_party/libwebrtc/media/engine/webrtc_voice_engine_unittest.cc index b1393eec74..4d6580631d 100644 --- a/third_party/libwebrtc/media/engine/webrtc_voice_engine_unittest.cc +++ b/third_party/libwebrtc/media/engine/webrtc_voice_engine_unittest.cc @@ -18,8 +18,9 @@ #include "absl/types/optional.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" +#include "api/environment/environment.h" +#include "api/environment/environment_factory.h" #include "api/media_types.h" -#include "api/rtc_event_log/rtc_event_log.h" #include "api/rtp_parameters.h" #include "api/scoped_refptr.h" #include "api/task_queue/default_task_queue_factory.h" @@ -45,6 +46,7 @@ #include "test/mock_audio_encoder_factory.h" #include "test/scoped_key_value_config.h" +namespace { using ::testing::_; using ::testing::ContainerEq; using ::testing::Contains; @@ -55,11 +57,11 @@ using ::testing::ReturnPointee; using ::testing::SaveArg; using ::testing::StrictMock; using ::testing::UnorderedElementsAreArray; +using ::webrtc::BitrateConstraints; using ::webrtc::Call; using ::webrtc::CallConfig; - -namespace { -using webrtc::BitrateConstraints; +using ::webrtc::CreateEnvironment; +using ::webrtc::Environment; constexpr uint32_t kMaxUnsignaledRecvStreams = 4; @@ -174,7 +176,7 @@ TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) { task_queue_factory.get(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm, - nullptr, nullptr, trials); + nullptr, trials); engine.Init(); } } @@ -220,7 +222,7 @@ class WebRtcVoiceEngineTestFake : public ::testing::TestWithParam<bool> { auto decoder_factory = webrtc::CreateBuiltinAudioDecoderFactory(); engine_.reset(new cricket::WebRtcVoiceEngine( task_queue_factory_.get(), adm_.get(), encoder_factory, decoder_factory, - nullptr, apm_, nullptr, nullptr, field_trials_)); + nullptr, apm_, nullptr, field_trials_)); engine_->Init(); send_parameters_.codecs.push_back(kPcmuCodec); recv_parameters_.codecs.push_back(kPcmuCodec); @@ -3678,24 +3680,18 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) { for (bool use_null_apm : {false, true}) { // If the VoiceEngine wants to gather available codecs early, that's fine // but we never want it to create a decoder at this stage. - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory = - webrtc::CreateDefaultTaskQueueFactory(); + Environment env = CreateEnvironment(); rtc::scoped_refptr<webrtc::test::MockAudioDeviceModule> adm = webrtc::test::MockAudioDeviceModule::CreateNice(); rtc::scoped_refptr<webrtc::AudioProcessing> apm = use_null_apm ? nullptr : webrtc::AudioProcessingBuilder().Create(); - webrtc::FieldTrialBasedConfig field_trials; cricket::WebRtcVoiceEngine engine( - task_queue_factory.get(), adm.get(), + &env.task_queue_factory(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm, - nullptr, nullptr, field_trials); + nullptr, env.field_trials()); engine.Init(); - webrtc::RtcEventLogNull event_log; - CallConfig call_config(&event_log); - call_config.trials = &field_trials; - call_config.task_queue_factory = task_queue_factory.get(); - std::unique_ptr<Call> call = Call::Create(call_config); + std::unique_ptr<Call> call = Call::Create(CallConfig(env)); std::unique_ptr<cricket::VoiceMediaSendChannelInterface> send_channel = engine.CreateSendChannel( call.get(), cricket::MediaConfig(), cricket::AudioOptions(), @@ -3713,25 +3709,19 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) { TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) { rtc::AutoThread main_thread; for (bool use_null_apm : {false, true}) { - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory = - webrtc::CreateDefaultTaskQueueFactory(); + Environment env = CreateEnvironment(); auto adm = rtc::make_ref_counted< ::testing::NiceMock<webrtc::test::MockAudioDeviceModule>>(); { rtc::scoped_refptr<webrtc::AudioProcessing> apm = use_null_apm ? nullptr : webrtc::AudioProcessingBuilder().Create(); - webrtc::FieldTrialBasedConfig field_trials; cricket::WebRtcVoiceEngine engine( - task_queue_factory.get(), adm.get(), + &env.task_queue_factory(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm, - nullptr, nullptr, field_trials); + nullptr, env.field_trials()); engine.Init(); - webrtc::RtcEventLogNull event_log; - CallConfig call_config(&event_log); - call_config.trials = &field_trials; - call_config.task_queue_factory = task_queue_factory.get(); - std::unique_ptr<Call> call = Call::Create(call_config); + std::unique_ptr<Call> call = Call::Create(CallConfig(env)); std::unique_ptr<cricket::VoiceMediaSendChannelInterface> send_channel = engine.CreateSendChannel( call.get(), cricket::MediaConfig(), cricket::AudioOptions(), @@ -3765,7 +3755,7 @@ TEST(WebRtcVoiceEngineTest, HasCorrectPayloadTypeMapping) { task_queue_factory.get(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm, - nullptr, nullptr, field_trials); + nullptr, field_trials); engine.Init(); for (const cricket::AudioCodec& codec : engine.send_codecs()) { auto is_codec = [&codec](const char* name, int clockrate = 0) { @@ -3804,24 +3794,18 @@ TEST(WebRtcVoiceEngineTest, HasCorrectPayloadTypeMapping) { TEST(WebRtcVoiceEngineTest, Has32Channels) { rtc::AutoThread main_thread; for (bool use_null_apm : {false, true}) { - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory = - webrtc::CreateDefaultTaskQueueFactory(); + Environment env = CreateEnvironment(); rtc::scoped_refptr<webrtc::test::MockAudioDeviceModule> adm = webrtc::test::MockAudioDeviceModule::CreateNice(); rtc::scoped_refptr<webrtc::AudioProcessing> apm = use_null_apm ? nullptr : webrtc::AudioProcessingBuilder().Create(); - webrtc::FieldTrialBasedConfig field_trials; cricket::WebRtcVoiceEngine engine( - task_queue_factory.get(), adm.get(), + &env.task_queue_factory(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::MockAudioDecoderFactory::CreateUnusedFactory(), nullptr, apm, - nullptr, nullptr, field_trials); + nullptr, env.field_trials()); engine.Init(); - webrtc::RtcEventLogNull event_log; - CallConfig call_config(&event_log); - call_config.trials = &field_trials; - call_config.task_queue_factory = task_queue_factory.get(); - std::unique_ptr<Call> call = Call::Create(call_config); + std::unique_ptr<Call> call = Call::Create(CallConfig(env)); std::vector<std::unique_ptr<cricket::VoiceMediaSendChannelInterface>> channels; @@ -3843,8 +3827,7 @@ TEST(WebRtcVoiceEngineTest, Has32Channels) { TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { rtc::AutoThread main_thread; for (bool use_null_apm : {false, true}) { - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory = - webrtc::CreateDefaultTaskQueueFactory(); + Environment env = CreateEnvironment(); // TODO(ossu): I'm not sure of the intent of this test. It's either: // - Check that our builtin codecs are usable by Channel. // - The codecs provided by the engine is usable by Channel. @@ -3856,18 +3839,13 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { webrtc::test::MockAudioDeviceModule::CreateNice(); rtc::scoped_refptr<webrtc::AudioProcessing> apm = use_null_apm ? nullptr : webrtc::AudioProcessingBuilder().Create(); - webrtc::FieldTrialBasedConfig field_trials; cricket::WebRtcVoiceEngine engine( - task_queue_factory.get(), adm.get(), + &env.task_queue_factory(), adm.get(), webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), webrtc::CreateBuiltinAudioDecoderFactory(), nullptr, apm, nullptr, - nullptr, field_trials); + env.field_trials()); engine.Init(); - webrtc::RtcEventLogNull event_log; - CallConfig call_config(&event_log); - call_config.trials = &field_trials; - call_config.task_queue_factory = task_queue_factory.get(); - std::unique_ptr<Call> call = Call::Create(call_config); + std::unique_ptr<Call> call = Call::Create(CallConfig(env)); cricket::WebRtcVoiceReceiveChannel channel( &engine, cricket::MediaConfig(), cricket::AudioOptions(), webrtc::CryptoOptions(), call.get(), @@ -3880,22 +3858,17 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { TEST(WebRtcVoiceEngineTest, SetRtpSendParametersMaxBitrate) { rtc::AutoThread main_thread; - std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory = - webrtc::CreateDefaultTaskQueueFactory(); + Environment env = CreateEnvironment(); rtc::scoped_refptr<webrtc::test::MockAudioDeviceModule> adm = webrtc::test::MockAudioDeviceModule::CreateNice(); - webrtc::FieldTrialBasedConfig field_trials; FakeAudioSource source; - cricket::WebRtcVoiceEngine engine(task_queue_factory.get(), adm.get(), + cricket::WebRtcVoiceEngine engine(&env.task_queue_factory(), adm.get(), webrtc::CreateBuiltinAudioEncoderFactory(), webrtc::CreateBuiltinAudioDecoderFactory(), - nullptr, nullptr, nullptr, nullptr, - field_trials); + nullptr, nullptr, nullptr, + env.field_trials()); engine.Init(); - webrtc::RtcEventLogNull event_log; - CallConfig call_config(&event_log); - call_config.trials = &field_trials; - call_config.task_queue_factory = task_queue_factory.get(); + CallConfig call_config(env); { webrtc::AudioState::Config config; config.audio_mixer = webrtc::AudioMixerImpl::Create(); @@ -3965,7 +3938,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) { webrtc::FieldTrialBasedConfig field_trials; cricket::WebRtcVoiceEngine engine( task_queue_factory.get(), adm.get(), unused_encoder_factory, - mock_decoder_factory, nullptr, apm, nullptr, nullptr, field_trials); + mock_decoder_factory, nullptr, apm, nullptr, field_trials); engine.Init(); auto codecs = engine.recv_codecs(); EXPECT_EQ(11u, codecs.size()); diff --git a/third_party/libwebrtc/media/media_channel_gn/moz.build b/third_party/libwebrtc/media/media_channel_gn/moz.build index 1bedb41bf2..c665368568 100644 --- a/third_party/libwebrtc/media/media_channel_gn/moz.build +++ b/third_party/libwebrtc/media/media_channel_gn/moz.build @@ -192,16 +192,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/media_channel_impl_gn/moz.build b/third_party/libwebrtc/media/media_channel_impl_gn/moz.build index 7d0a4bd650..27bfa53fff 100644 --- a/third_party/libwebrtc/media/media_channel_impl_gn/moz.build +++ b/third_party/libwebrtc/media/media_channel_impl_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/media_constants_gn/moz.build b/third_party/libwebrtc/media/media_constants_gn/moz.build index af4cd6b257..95a0c3a056 100644 --- a/third_party/libwebrtc/media/media_constants_gn/moz.build +++ b/third_party/libwebrtc/media/media_constants_gn/moz.build @@ -184,7 +184,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -194,10 +193,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/rid_description_gn/moz.build b/third_party/libwebrtc/media/rid_description_gn/moz.build index 61afeec945..944901a1ca 100644 --- a/third_party/libwebrtc/media/rid_description_gn/moz.build +++ b/third_party/libwebrtc/media/rid_description_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/rtc_media_base_gn/moz.build b/third_party/libwebrtc/media/rtc_media_base_gn/moz.build index cfff6f3411..a5b3661adc 100644 --- a/third_party/libwebrtc/media/rtc_media_base_gn/moz.build +++ b/third_party/libwebrtc/media/rtc_media_base_gn/moz.build @@ -203,7 +203,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -213,10 +212,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/rtc_media_config_gn/moz.build b/third_party/libwebrtc/media/rtc_media_config_gn/moz.build index 17afebe8da..8f3f81cc5b 100644 --- a/third_party/libwebrtc/media/rtc_media_config_gn/moz.build +++ b/third_party/libwebrtc/media/rtc_media_config_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build b/third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build index c09703ddd6..6b1032e1b0 100644 --- a/third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build +++ b/third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build @@ -200,7 +200,6 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] @@ -210,10 +209,6 @@ if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": "-msse2" ] - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/rtp_utils_gn/moz.build b/third_party/libwebrtc/media/rtp_utils_gn/moz.build index 1aaa347151..e2e5c11695 100644 --- a/third_party/libwebrtc/media/rtp_utils_gn/moz.build +++ b/third_party/libwebrtc/media/rtp_utils_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True diff --git a/third_party/libwebrtc/media/stream_params_gn/moz.build b/third_party/libwebrtc/media/stream_params_gn/moz.build index 71875c4e01..1582a42c0d 100644 --- a/third_party/libwebrtc/media/stream_params_gn/moz.build +++ b/third_party/libwebrtc/media/stream_params_gn/moz.build @@ -176,16 +176,9 @@ if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux": if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "arm": OS_LIBS += [ - "android_support", "unwind" ] -if CONFIG["OS_TARGET"] == "Android" and CONFIG["TARGET_CPU"] == "x86": - - OS_LIBS += [ - "android_support" - ] - if CONFIG["OS_TARGET"] == "Linux" and CONFIG["TARGET_CPU"] == "aarch64": DEFINES["_GNU_SOURCE"] = True |