Reland "Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory"
This reverts commit fd5166c305068772d00ad7edf50151bba215400b.
Reason for revert: Stop using CreateTestAudioDeviceModule in downstream
Original change's description:
> Revert "Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory"
>
> This reverts commit fc961357a721cd87dcd45ed409c66cb8cda6f4a2.
>
> Reason for revert: Breaks downstream importer.
>
> Original change's description:
> > Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory
> >
> > Bug: webrtc:10284
> > Change-Id: Ic92f6ff31b40c48a3362745a0a81179af0595fe0
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141409
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#28227}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org
>
> Change-Id: Id6d7571f48771646ddce0f05139a7ea0107759fb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:10284
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141414
> Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> Commit-Queue: Philip Eliasson <philipel@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28228}
TBR=danilchap@webrtc.org,kwiberg@webrtc.org,philipel@webrtc.org
Change-Id: I42bc19793d48350ca45b751d7e1b26124ac7fbb9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10284
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/141670
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28254}
diff --git a/audio/test/media_transport_test.cc b/audio/test/media_transport_test.cc
index 5b2c554..b06d46d 100644
--- a/audio/test/media_transport_test.cc
+++ b/audio/test/media_transport_test.cc
@@ -72,6 +72,8 @@
TEST(AudioWithMediaTransport, DeliversAudio) {
std::unique_ptr<rtc::Thread> transport_thread = rtc::Thread::Create();
transport_thread->Start();
+ std::unique_ptr<TaskQueueFactory> task_queue_factory =
+ CreateDefaultTaskQueueFactory();
MediaTransportPair transport_pair(transport_thread.get());
NiceMock<MockTransport> rtcp_send_transport;
NiceMock<MockTransport> send_transport;
@@ -79,7 +81,8 @@
NiceMock<MockBitrateAllocator> bitrate_allocator;
rtc::scoped_refptr<TestAudioDeviceModule> audio_device =
- TestAudioDeviceModule::CreateTestAudioDeviceModule(
+ TestAudioDeviceModule::Create(
+ task_queue_factory.get(),
TestAudioDeviceModule::CreatePulsedNoiseCapturer(
/* max_amplitude= */ 10000, kSamplingFrequency, kNumChannels),
absl::make_unique<TestRenderer>(kSamplingFrequency, kNumChannels,
@@ -125,8 +128,6 @@
send_config.encoder_factory = CreateAudioEncoderFactory<AudioEncoderOpus>();
std::unique_ptr<ProcessThread> send_process_thread =
ProcessThread::Create("audio send thread");
- std::unique_ptr<TaskQueueFactory> task_queue_factory =
- CreateDefaultTaskQueueFactory();
RtpTransportControllerSend rtp_transport(
Clock::GetRealTimeClock(), &null_event_log, nullptr, nullptr,
BitrateConstraints(), ProcessThread::Create("Pacer"),
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index d869c87..46913b8 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -186,7 +186,8 @@
task_queue_.SendTask([&]() {
metrics::Reset();
rtc::scoped_refptr<TestAudioDeviceModule> fake_audio_device =
- TestAudioDeviceModule::CreateTestAudioDeviceModule(
+ TestAudioDeviceModule::Create(
+ task_queue_factory_.get(),
TestAudioDeviceModule::CreatePulsedNoiseCapturer(256, 48000),
TestAudioDeviceModule::CreateDiscardRenderer(48000),
audio_rtp_speed);
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index c42f862..943b0ed 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -167,7 +167,6 @@
"../../api:refcountedbase",
"../../api:scoped_refptr",
"../../api/task_queue",
- "../../api/task_queue:global_task_queue_factory",
"../../common_audio",
"../../common_audio:common_audio_c",
"../../rtc_base",
diff --git a/modules/audio_device/include/test_audio_device.cc b/modules/audio_device/include/test_audio_device.cc
index 5ff5387..08ce8ad 100644
--- a/modules/audio_device/include/test_audio_device.cc
+++ b/modules/audio_device/include/test_audio_device.cc
@@ -18,7 +18,6 @@
#include "absl/memory/memory.h"
#include "api/array_view.h"
-#include "api/task_queue/global_task_queue_factory.h"
#include "common_audio/wav_file.h"
#include "modules/audio_device/include/audio_device_default.h"
#include "modules/audio_device/include/test_audio_device.h"
@@ -474,15 +473,6 @@
return rtc::CheckedDivExact(sampling_frequency_in_hz, kFramesPerSecond);
}
-rtc::scoped_refptr<TestAudioDeviceModule>
-TestAudioDeviceModule::CreateTestAudioDeviceModule(
- std::unique_ptr<Capturer> capturer,
- std::unique_ptr<Renderer> renderer,
- float speed) {
- return Create(&GlobalTaskQueueFactory(), std::move(capturer),
- std::move(renderer), speed);
-}
-
rtc::scoped_refptr<TestAudioDeviceModule> TestAudioDeviceModule::Create(
TaskQueueFactory* task_queue_factory,
std::unique_ptr<TestAudioDeviceModule::Capturer> capturer,
diff --git a/modules/audio_device/include/test_audio_device.h b/modules/audio_device/include/test_audio_device.h
index 586996e..a3b1b3a 100644
--- a/modules/audio_device/include/test_audio_device.h
+++ b/modules/audio_device/include/test_audio_device.h
@@ -79,10 +79,6 @@
// |renderer| is an object that receives audio data that would have been
// played out. Can be nullptr if this device is never used for playing.
// Use one of the Create... functions to get these instances.
- static rtc::scoped_refptr<TestAudioDeviceModule> CreateTestAudioDeviceModule(
- std::unique_ptr<Capturer> capturer,
- std::unique_ptr<Renderer> renderer,
- float speed = 1);
static rtc::scoped_refptr<TestAudioDeviceModule> Create(
TaskQueueFactory* task_queue_factory,
std::unique_ptr<Capturer> capturer,
diff --git a/test/call_test.cc b/test/call_test.cc
index 1dd4c80..5d551a5 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -492,10 +492,10 @@
void CallTest::CreateFakeAudioDevices(
std::unique_ptr<TestAudioDeviceModule::Capturer> capturer,
std::unique_ptr<TestAudioDeviceModule::Renderer> renderer) {
- fake_send_audio_device_ = TestAudioDeviceModule::CreateTestAudioDeviceModule(
- std::move(capturer), nullptr, 1.f);
- fake_recv_audio_device_ = TestAudioDeviceModule::CreateTestAudioDeviceModule(
- nullptr, std::move(renderer), 1.f);
+ fake_send_audio_device_ = TestAudioDeviceModule::Create(
+ task_queue_factory_.get(), std::move(capturer), nullptr, 1.f);
+ fake_recv_audio_device_ = TestAudioDeviceModule::Create(
+ task_queue_factory_.get(), nullptr, std::move(renderer), 1.f);
}
void CallTest::CreateVideoStreams() {
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index 4a45357..fea9cac 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -1355,7 +1355,8 @@
audio_device = CreateAudioDevice();
} else {
// By default, create a test ADM which fakes audio.
- audio_device = TestAudioDeviceModule::CreateTestAudioDeviceModule(
+ audio_device = TestAudioDeviceModule::Create(
+ task_queue_factory_.get(),
TestAudioDeviceModule::CreatePulsedNoiseCapturer(32000, 48000),
TestAudioDeviceModule::CreateDiscardRenderer(48000), 1.f);
}