diff --git a/api/BUILD.gn b/api/BUILD.gn index 1e53f3caab..ab54a77f6a 100644 --- a/api/BUILD.gn +++ b/api/BUILD.gn @@ -601,26 +601,6 @@ rtc_library("neteq_simulator_api") { ] } -rtc_source_set("neteq_factory_with_codecs") { - visibility = [ "*" ] - testonly = true - sources = [ - "test/neteq_factory_with_codecs.cc", - "test/neteq_factory_with_codecs.h", - ] - - deps = [ - ":scoped_refptr", - "../modules/audio_coding:neteq", - "../system_wrappers:system_wrappers", - "audio_codecs:audio_codecs_api", - "audio_codecs:builtin_audio_decoder_factory", - "neteq:default_neteq_controller_factory", - "neteq:neteq_api", - "neteq:neteq_controller_api", - ] -} - rtc_source_set("function_view") { visibility = [ "*" ] sources = [ diff --git a/api/neteq/custom_neteq_factory.cc b/api/neteq/custom_neteq_factory.cc index eaa8c8ac17..b2df5df9ff 100644 --- a/api/neteq/custom_neteq_factory.cc +++ b/api/neteq/custom_neteq_factory.cc @@ -20,21 +20,8 @@ CustomNetEqFactory::CustomNetEqFactory( std::unique_ptr controller_factory) : controller_factory_(std::move(controller_factory)) {} -CustomNetEqFactory::CustomNetEqFactory( - rtc::scoped_refptr decoder_factory, - std::unique_ptr controller_factory) - : decoder_factory_(decoder_factory), - controller_factory_(std::move(controller_factory)) {} CustomNetEqFactory::~CustomNetEqFactory() = default; -std::unique_ptr CustomNetEqFactory::CreateNetEq( - const NetEq::Config& config, - Clock* clock) const { - return std::make_unique( - config, NetEqImpl::Dependencies(config, clock, decoder_factory_, - *controller_factory_)); -} - std::unique_ptr CustomNetEqFactory::CreateNetEq( const NetEq::Config& config, const rtc::scoped_refptr& decoder_factory, diff --git a/api/neteq/custom_neteq_factory.h b/api/neteq/custom_neteq_factory.h index 7a0ee21257..d080f68e8e 100644 --- a/api/neteq/custom_neteq_factory.h +++ b/api/neteq/custom_neteq_factory.h @@ -22,30 +22,21 @@ namespace webrtc { // This factory can be used to generate NetEq instances that make use of a -// custom AudioDecoderFactory and/or NetEqControllerFactory. Using a custom -// AudioDecoderFactory is deprecated and the functionality will be removed soon. +// custom NetEqControllerFactory. class CustomNetEqFactory : public NetEqFactory { public: explicit CustomNetEqFactory( std::unique_ptr controller_factory); - // This constructor is deprecated and will be removed soon. - CustomNetEqFactory( - rtc::scoped_refptr decoder_factory, - std::unique_ptr controller_factory); ~CustomNetEqFactory() override; CustomNetEqFactory(const CustomNetEqFactory&) = delete; CustomNetEqFactory& operator=(const CustomNetEqFactory&) = delete; - std::unique_ptr CreateNetEq(const NetEq::Config& config, - Clock* clock) const override; - std::unique_ptr CreateNetEq( const NetEq::Config& config, const rtc::scoped_refptr& decoder_factory, Clock* clock) const override; private: - rtc::scoped_refptr decoder_factory_; std::unique_ptr controller_factory_; }; diff --git a/api/neteq/neteq_factory.h b/api/neteq/neteq_factory.h index c2d40ef934..65cf9eb2e4 100644 --- a/api/neteq/neteq_factory.h +++ b/api/neteq/neteq_factory.h @@ -31,9 +31,6 @@ class NetEqFactory { const NetEq::Config& config, const rtc::scoped_refptr& decoder_factory, Clock* clock) const = 0; - // This method is deprecated and will be removed. - virtual std::unique_ptr CreateNetEq(const NetEq::Config& config, - Clock* clock) const = 0; }; } // namespace webrtc diff --git a/api/test/neteq_factory_with_codecs.cc b/api/test/neteq_factory_with_codecs.cc deleted file mode 100644 index 3bead93a81..0000000000 --- a/api/test/neteq_factory_with_codecs.cc +++ /dev/null @@ -1,55 +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 "api/test/neteq_factory_with_codecs.h" - -#include "api/audio_codecs/audio_decoder_factory.h" -#include "api/audio_codecs/builtin_audio_decoder_factory.h" -#include "api/neteq/default_neteq_controller_factory.h" -#include "api/neteq/neteq_controller_factory.h" -#include "api/neteq/neteq_factory.h" -#include "modules/audio_coding/neteq/decision_logic.h" -#include "modules/audio_coding/neteq/neteq_impl.h" -#include "system_wrappers/include/clock.h" - -namespace webrtc { -namespace { - -class NetEqFactoryWithCodecs final : public NetEqFactory { - public: - std::unique_ptr CreateNetEq(const NetEq::Config& config, - Clock* clock) const override { - return std::make_unique( - config, NetEqImpl::Dependencies(config, clock, decoder_factory_, - *controller_factory_)); - } - std::unique_ptr CreateNetEq( - const NetEq::Config& config, - const rtc::scoped_refptr& decoder_factory, - Clock* clock) const override { - return std::make_unique( - config, NetEqImpl::Dependencies(config, clock, decoder_factory, - *controller_factory_)); - } - - private: - const rtc::scoped_refptr decoder_factory_ = - CreateBuiltinAudioDecoderFactory(); - const std::unique_ptr controller_factory_ = - std::make_unique(); -}; - -} // namespace - -std::unique_ptr CreateNetEqFactoryWithCodecs() { - return std::make_unique(); -} - -} // namespace webrtc diff --git a/api/test/neteq_factory_with_codecs.h b/api/test/neteq_factory_with_codecs.h deleted file mode 100644 index 7260eb06ff..0000000000 --- a/api/test/neteq_factory_with_codecs.h +++ /dev/null @@ -1,25 +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 API_TEST_NETEQ_FACTORY_WITH_CODECS_H_ -#define API_TEST_NETEQ_FACTORY_WITH_CODECS_H_ - -#include - -#include "api/neteq/neteq_factory.h" - -namespace webrtc { - -// This NetEq factory will use WebRTC's built-in AudioDecoders as well as the -// built-in NetEqController logic. -std::unique_ptr CreateNetEqFactoryWithCodecs(); - -} // namespace webrtc -#endif // API_TEST_NETEQ_FACTORY_WITH_CODECS_H_ diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn index 4b9d20b179..14a1bdc0e5 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -1065,6 +1065,7 @@ rtc_library("neteq_tools_minimal") { ] deps = [ + ":default_neteq_factory", ":neteq", "../../api:neteq_simulator_api", "../../api:rtp_headers", @@ -1239,11 +1240,11 @@ rtc_library("audio_coding_modules_tests_shared") { deps = [ ":audio_coding", ":audio_coding_module_typedefs", + ":default_neteq_factory", ":neteq_test_tools", ":neteq_tools_minimal", ":webrtc_opus_wrapper", "..:module_api", - "../../api:neteq_factory_with_codecs", "../../api:rtp_headers", "../../api/audio:audio_frame_api", "../../api/audio_codecs:builtin_audio_decoder_factory", @@ -1630,10 +1631,10 @@ if (rtc_include_tests) { ] deps = [ + ":default_neteq_factory", ":neteq", ":neteq_test_tools", ":pcm16b", - "../../api:neteq_factory_with_codecs", "../../api/audio:audio_frame_api", "../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:builtin_audio_decoder_factory", @@ -1655,11 +1656,10 @@ if (rtc_include_tests) { ] deps = [ + ":default_neteq_factory", ":neteq", ":neteq_test_tools", "../../api/audio_codecs:builtin_audio_decoder_factory", - "../../api/neteq:custom_neteq_factory", - "../../api/neteq:default_neteq_controller_factory", "../../api/neteq:neteq_api", "../../rtc_base:checks", "../../system_wrappers", @@ -2072,6 +2072,7 @@ if (rtc_include_tests) { ":audio_coding_opus_common", ":audio_encoder_cng", ":audio_network_adaptor", + ":default_neteq_factory", ":g711", ":ilbc", ":isac", @@ -2088,7 +2089,6 @@ if (rtc_include_tests) { ":webrtc_opus", "..:module_api", "..:module_api_public", - "../../api:neteq_factory_with_codecs", "../../api/audio:audio_frame_api", "../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:builtin_audio_decoder_factory", @@ -2097,7 +2097,6 @@ if (rtc_include_tests) { "../../api/audio_codecs/opus:audio_decoder_opus", "../../api/audio_codecs/opus:audio_encoder_multiopus", "../../api/audio_codecs/opus:audio_encoder_opus", - "../../api/neteq:custom_neteq_factory", "../../api/neteq:default_neteq_controller_factory", "../../api/neteq:neteq_api", "../../api/neteq:neteq_controller_api", diff --git a/modules/audio_coding/neteq/default_neteq_factory.cc b/modules/audio_coding/neteq/default_neteq_factory.cc index ca19b08480..487450fe0f 100644 --- a/modules/audio_coding/neteq/default_neteq_factory.cc +++ b/modules/audio_coding/neteq/default_neteq_factory.cc @@ -28,12 +28,4 @@ std::unique_ptr DefaultNetEqFactory::CreateNetEq( controller_factory_)); } -std::unique_ptr DefaultNetEqFactory::CreateNetEq( - const NetEq::Config& /*config*/, - Clock* /*clock*/) const { - RTC_NOTREACHED() << "Calling CreateNetEq without an AudioDecoderFactory on " - "DefaultNetEqFactory is not supported."; - return nullptr; -} - } // namespace webrtc diff --git a/modules/audio_coding/neteq/default_neteq_factory.h b/modules/audio_coding/neteq/default_neteq_factory.h index 4c5ee9b73e..24d2bae419 100644 --- a/modules/audio_coding/neteq/default_neteq_factory.h +++ b/modules/audio_coding/neteq/default_neteq_factory.h @@ -32,8 +32,6 @@ class DefaultNetEqFactory : public NetEqFactory { const NetEq::Config& config, const rtc::scoped_refptr& decoder_factory, Clock* clock) const override; - std::unique_ptr CreateNetEq(const NetEq::Config& config, - Clock* clock) const override; private: const DefaultNetEqControllerFactory controller_factory_; diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc index 1731282fdc..33e3d8d2d2 100644 --- a/modules/audio_coding/neteq/neteq_impl_unittest.cc +++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc @@ -18,9 +18,9 @@ #include "api/neteq/default_neteq_controller_factory.h" #include "api/neteq/neteq.h" #include "api/neteq/neteq_controller.h" -#include "api/test/neteq_factory_with_codecs.h" #include "modules/audio_coding/neteq/accelerate.h" #include "modules/audio_coding/neteq/decision_logic.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/expand.h" #include "modules/audio_coding/neteq/histogram.h" #include "modules/audio_coding/neteq/mock/mock_decoder_database.h" @@ -252,8 +252,9 @@ class NetEqImplTest : public ::testing::Test { TEST(NetEq, CreateAndDestroy) { NetEq::Config config; SimulatedClock clock(0); - std::unique_ptr neteq_factory = CreateNetEqFactoryWithCodecs(); - std::unique_ptr neteq = neteq_factory->CreateNetEq(config, &clock); + auto decoder_factory = CreateBuiltinAudioDecoderFactory(); + std::unique_ptr neteq = + DefaultNetEqFactory().CreateNetEq(config, decoder_factory, &clock); } TEST_F(NetEqImplTest, RegisterPayloadType) { diff --git a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc index 0e24f689ca..d35c44c4c2 100644 --- a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc +++ b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc @@ -13,9 +13,9 @@ #include "absl/memory/memory.h" #include "api/audio/audio_frame.h" #include "api/audio_codecs/audio_decoder.h" -#include "api/neteq/custom_neteq_factory.h" -#include "api/neteq/default_neteq_controller_factory.h" +#include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/neteq/neteq.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/tools/rtp_generator.h" #include "rtc_base/ref_counted_object.h" #include "system_wrappers/include/clock.h" @@ -31,9 +31,7 @@ std::unique_ptr CreateNetEq( const NetEq::Config& config, Clock* clock, const rtc::scoped_refptr& decoder_factory) { - CustomNetEqFactory neteq_factory( - decoder_factory, std::make_unique()); - return neteq_factory.CreateNetEq(config, clock); + return DefaultNetEqFactory().CreateNetEq(config, decoder_factory, clock); } } // namespace diff --git a/modules/audio_coding/neteq/neteq_stereo_unittest.cc b/modules/audio_coding/neteq/neteq_stereo_unittest.cc index 14979aeb32..515fd9b1a1 100644 --- a/modules/audio_coding/neteq/neteq_stereo_unittest.cc +++ b/modules/audio_coding/neteq/neteq_stereo_unittest.cc @@ -18,8 +18,8 @@ #include "api/audio/audio_frame.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/neteq/neteq.h" -#include "api/test/neteq_factory_with_codecs.h" #include "modules/audio_coding/codecs/pcm16b/pcm16b.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/tools/input_audio_file.h" #include "modules/audio_coding/neteq/tools/rtp_generator.h" #include "rtc_base/strings/string_builder.h" @@ -68,10 +68,10 @@ class NetEqStereoTest : public ::testing::TestWithParam { last_arrival_time_(0) { NetEq::Config config; config.sample_rate_hz = sample_rate_hz_; - std::unique_ptr neteq_factory = - CreateNetEqFactoryWithCodecs(); - neteq_mono_ = neteq_factory->CreateNetEq(config, &clock_); - neteq_ = neteq_factory->CreateNetEq(config, &clock_); + DefaultNetEqFactory neteq_factory; + auto decoder_factory = CreateBuiltinAudioDecoderFactory(); + neteq_mono_ = neteq_factory.CreateNetEq(config, decoder_factory, &clock_); + neteq_ = neteq_factory.CreateNetEq(config, decoder_factory, &clock_); input_ = new int16_t[frame_size_samples_]; encoded_ = new uint8_t[2 * frame_size_samples_]; input_multi_channel_ = new int16_t[frame_size_samples_ * num_channels_]; diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc index a96812c3d4..098bcc2865 100644 --- a/modules/audio_coding/neteq/neteq_unittest.cc +++ b/modules/audio_coding/neteq/neteq_unittest.cc @@ -23,7 +23,6 @@ #include "absl/flags/flag.h" #include "api/audio/audio_frame.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" -#include "api/test/neteq_factory_with_codecs.h" #include "modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "modules/audio_coding/neteq/test/neteq_decoding_test.h" #include "modules/audio_coding/neteq/tools/audio_loop.h" diff --git a/modules/audio_coding/neteq/test/neteq_decoding_test.cc b/modules/audio_coding/neteq/test/neteq_decoding_test.cc index 24f10cd6ba..11b1b1a532 100644 --- a/modules/audio_coding/neteq/test/neteq_decoding_test.cc +++ b/modules/audio_coding/neteq/test/neteq_decoding_test.cc @@ -10,8 +10,9 @@ #include "modules/audio_coding/neteq/test/neteq_decoding_test.h" +#include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/rtp_headers.h" -#include "api/test/neteq_factory_with_codecs.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/test/result_sink.h" #include "rtc_base/strings/string_builder.h" #include "test/testsupport/file_utils.h" @@ -81,8 +82,8 @@ NetEqDecodingTest::NetEqDecodingTest() } void NetEqDecodingTest::SetUp() { - std::unique_ptr neteq_factory = CreateNetEqFactoryWithCodecs(); - neteq_ = neteq_factory->CreateNetEq(config_, &clock_); + auto decoder_factory = CreateBuiltinAudioDecoderFactory(); + neteq_ = DefaultNetEqFactory().CreateNetEq(config_, decoder_factory, &clock_); NetEqNetworkStatistics stat; ASSERT_EQ(0, neteq_->NetworkStatistics(&stat)); algorithmic_delay_ms_ = stat.current_buffer_size_ms; @@ -421,8 +422,9 @@ void NetEqDecodingTestTwoInstances::SetUp() { } void NetEqDecodingTestTwoInstances::CreateSecondInstance() { - std::unique_ptr neteq_factory = CreateNetEqFactoryWithCodecs(); - neteq2_ = neteq_factory->CreateNetEq(config2_, &clock_); + auto decoder_factory = CreateBuiltinAudioDecoderFactory(); + neteq2_ = + DefaultNetEqFactory().CreateNetEq(config2_, decoder_factory, &clock_); ASSERT_TRUE(neteq2_); LoadDecoders(neteq2_.get()); } diff --git a/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/modules/audio_coding/neteq/tools/neteq_performance_test.cc index d963903076..1fb853ccb7 100644 --- a/modules/audio_coding/neteq/tools/neteq_performance_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_performance_test.cc @@ -11,9 +11,10 @@ #include "modules/audio_coding/neteq/tools/neteq_performance_test.h" #include "api/audio/audio_frame.h" +#include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/neteq/neteq.h" -#include "api/test/neteq_factory_with_codecs.h" #include "modules/audio_coding/codecs/pcm16b/pcm16b.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/tools/audio_loop.h" #include "modules/audio_coding/neteq/tools/rtp_generator.h" #include "rtc_base/checks.h" @@ -40,8 +41,9 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms, NetEq::Config config; config.sample_rate_hz = kSampRateHz; webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock(); - std::unique_ptr neteq_factory = CreateNetEqFactoryWithCodecs(); - auto neteq = neteq_factory->CreateNetEq(config, clock); + auto audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); + auto neteq = + DefaultNetEqFactory().CreateNetEq(config, audio_decoder_factory, clock); // Register decoder in |neteq|. if (!neteq->RegisterPayloadType(kPayloadType, SdpAudioFormat("l16", kSampRateHz, 1))) diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/modules/audio_coding/neteq/tools/neteq_quality_test.cc index ba539548d1..80e3be2f3f 100644 --- a/modules/audio_coding/neteq/tools/neteq_quality_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_quality_test.cc @@ -15,8 +15,7 @@ #include #include "absl/flags/flag.h" -#include "api/neteq/custom_neteq_factory.h" -#include "api/neteq/default_neteq_controller_factory.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/tools/neteq_quality_test.h" #include "modules/audio_coding/neteq/tools/output_audio_file.h" #include "modules/audio_coding/neteq/tools/output_wav_file.h" @@ -95,9 +94,7 @@ std::unique_ptr CreateNetEq( const NetEq::Config& config, Clock* clock, const rtc::scoped_refptr& decoder_factory) { - CustomNetEqFactory neteq_factory( - decoder_factory, std::make_unique()); - return neteq_factory.CreateNetEq(config, clock); + return DefaultNetEqFactory().CreateNetEq(config, decoder_factory, clock); } } // namespace diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc index 50d8ba1a18..a7754531e7 100644 --- a/modules/audio_coding/neteq/tools/neteq_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_test.cc @@ -13,8 +13,7 @@ #include #include -#include "api/neteq/custom_neteq_factory.h" -#include "api/neteq/default_neteq_controller_factory.h" +#include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/rtp_rtcp/source/byte_io.h" #include "system_wrappers/include/clock.h" @@ -43,9 +42,7 @@ std::unique_ptr CreateNetEq( const NetEq::Config& config, Clock* clock, const rtc::scoped_refptr& decoder_factory) { - CustomNetEqFactory neteq_factory( - decoder_factory, std::make_unique()); - return neteq_factory.CreateNetEq(config, clock); + return DefaultNetEqFactory().CreateNetEq(config, decoder_factory, clock); } } // namespace