Skip to content

Commit

Permalink
Reland "Delete TestAudioDeviceModule factory which uses GlobalTaskQue…
Browse files Browse the repository at this point in the history
…ueFactory"

This reverts commit fd5166c.

Reason for revert: Stop using CreateTestAudioDeviceModule in downstream

Original change's description:
> Revert "Delete TestAudioDeviceModule factory which uses GlobalTaskQueueFactory"
> 
> This reverts commit fc96135.
> 
> 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 <[email protected]>
> > Commit-Queue: Danil Chapovalov <[email protected]>
> > Cr-Commit-Position: refs/heads/master@{#28227}
> 
> [email protected],[email protected]
> 
> 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 <[email protected]>
> Commit-Queue: Philip Eliasson <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#28228}

[email protected],[email protected],[email protected]

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 <[email protected]>
Commit-Queue: Danil Chapovalov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#28254}
  • Loading branch information
DanilChapovalov authored and Commit Bot committed Jun 12, 2019
1 parent 65d9c4d commit 08fa953
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 24 deletions.
7 changes: 4 additions & 3 deletions audio/test/media_transport_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ class TestRenderer : public TestAudioDeviceModule::Renderer {
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;
RtcEventLogNull null_event_log;
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,
Expand Down Expand Up @@ -125,8 +128,6 @@ TEST(AudioWithMediaTransport, DeliversAudio) {
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"),
Expand Down
3 changes: 2 additions & 1 deletion call/call_perf_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
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);
Expand Down
1 change: 0 additions & 1 deletion modules/audio_device/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ rtc_source_set("audio_device_impl") {
"../../api:refcountedbase",
"../../api:scoped_refptr",
"../../api/task_queue",
"../../api/task_queue:global_task_queue_factory",
"../../common_audio",
"../../common_audio:common_audio_c",
"../../rtc_base",
Expand Down
10 changes: 0 additions & 10 deletions modules/audio_device/include/test_audio_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -474,15 +473,6 @@ size_t TestAudioDeviceModule::SamplesPerFrame(int sampling_frequency_in_hz) {
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,
Expand Down
4 changes: 0 additions & 4 deletions modules/audio_device/include/test_audio_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ class TestAudioDeviceModule : public AudioDeviceModule {
// |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,
Expand Down
8 changes: 4 additions & 4 deletions test/call_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ void CallTest::CreateFrameGeneratorCapturer(int framerate,
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() {
Expand Down
3 changes: 2 additions & 1 deletion video/video_quality_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,8 @@ void VideoQualityTest::InitializeAudioDevice(Call::Config* send_call_config,
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);
}
Expand Down

0 comments on commit 08fa953

Please sign in to comment.