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

@ -587,6 +587,7 @@ if (rtc_include_tests) {
"../media:rtc_media_engine_defaults",
"../modules/audio_device:audio_device_api",
"../modules/audio_processing:audio_processing_statistics",
"../modules/audio_processing:audioproc_test_utils",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../p2p:fake_ice_transport",
"../p2p:fake_port_allocator",

View File

@ -36,6 +36,7 @@
#include "media/engine/fake_webrtc_video_engine.h"
#include "media/engine/webrtc_media_engine.h"
#include "media/engine/webrtc_media_engine_defaults.h"
#include "modules/audio_processing/test/audio_processing_builder_for_testing.h"
#include "p2p/base/fake_ice_transport.h"
#include "p2p/base/mock_async_resolver.h"
#include "p2p/base/p2p_constants.h"
@ -648,6 +649,12 @@ class PeerConnectionWrapper : public webrtc::PeerConnectionObserver,
media_deps.video_decoder_factory.reset();
}
if (!media_deps.audio_processing) {
// If the standard Creation method for APM returns a null pointer, instead
// use the builder for testing to create an APM object.
media_deps.audio_processing = AudioProcessingBuilderForTesting().Create();
}
pc_factory_dependencies.media_engine =
cricket::CreateMediaEngine(std::move(media_deps));
pc_factory_dependencies.call_factory = webrtc::CreateCallFactory();