APM: Add build flag to allow building WebRTC without APM

This CL adds a build flag to allow building the non-test parts
of WebRTC without the audio processing module.
The CL also ensures that the WebRTC code correctly handles
the case when no APM is available.

Bug: webrtc:5298
Change-Id: I5c8b5d1f7115e5cce2af4c2b5ff701fa1c54e49e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171509
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31133}
This commit is contained in:
Per Åhgren
2020-04-26 23:56:17 +02:00
committed by Commit Bot
parent 86bd33a1e7
commit cc73ed3e70
31 changed files with 1887 additions and 1403 deletions

View File

@ -453,6 +453,7 @@ webrtc_fuzzer_test("audio_processing_fuzzer") {
"../../modules/audio_processing",
"../../modules/audio_processing:api",
"../../modules/audio_processing:audio_buffer",
"../../modules/audio_processing:audioproc_test_utils",
"../../modules/audio_processing/aec3",
"../../modules/audio_processing/aec_dump",
"../../modules/audio_processing/aec_dump:aec_dump_impl",

View File

@ -16,6 +16,7 @@
#include "api/task_queue/default_task_queue_factory.h"
#include "modules/audio_processing/aec_dump/aec_dump_factory.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/test/audio_processing_builder_for_testing.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "rtc_base/task_queue.h"
@ -108,7 +109,7 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
config.Set<ExperimentalNs>(new ExperimentalNs(exp_ns));
std::unique_ptr<AudioProcessing> apm(
AudioProcessingBuilder()
AudioProcessingBuilderForTesting()
.SetEchoControlFactory(std::move(echo_control_factory))
.Create(config));

View File

@ -33,7 +33,11 @@ class TestPeer final : public PeerConnectionWrapper {
return std::move(video_generators_[i]);
}
void DetachAecDump() { audio_processing_->DetachAecDump(); }
void DetachAecDump() {
if (audio_processing_) {
audio_processing_->DetachAecDump();
}
}
// Adds provided |candidates| to the owned peer connection.
bool AddIceCandidates(

View File

@ -290,7 +290,7 @@ std::unique_ptr<TestPeer> TestPeerFactory::CreateTestPeer(
// Create peer connection factory.
rtc::scoped_refptr<AudioProcessing> audio_processing =
webrtc::AudioProcessingBuilder().Create();
if (params->aec_dump_path) {
if (params->aec_dump_path && audio_processing) {
audio_processing->AttachAecDump(
AecDumpFactory::Create(*params->aec_dump_path, -1, task_queue));
}