Enable the injection of an APM into a peerconnection

This CL finalizes the support for allowing an external
audio processing module to be used in a peerconnection.

BUG=webrtc:7775

Review-Url: https://codereview.webrtc.org/2965703002
Cr-Commit-Position: refs/heads/master@{#18864}
This commit is contained in:
peah 2017-06-30 07:24:04 -07:00 committed by Commit Bot
parent fa8567868e
commit 17675ceb13
2 changed files with 44 additions and 4 deletions

View File

@ -1080,6 +1080,24 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
cricket::WebRtcVideoEncoderFactory* encoder_factory,
cricket::WebRtcVideoDecoderFactory* decoder_factory);
// Create a new instance of PeerConnectionFactoryInterface with optional
// external audio mixed and audio processing modules.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
// If |audio_processing| is null, an internal audio processing module will be
// created and used.
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing);
// Create a new instance of PeerConnectionFactoryInterface with external audio
// mixer.
//

View File

@ -40,8 +40,7 @@ CreatePeerConnectionFactory() {
// Note: all the other CreatePeerConnectionFactory variants just end up calling
// this, ultimately.
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
@ -50,12 +49,18 @@ CreatePeerConnectionFactoryWithAudioMixer(
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer) {
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing) {
rtc::scoped_refptr<AudioProcessing> audio_processing_use = audio_processing;
if (!audio_processing_use) {
audio_processing_use = AudioProcessing::Create();
}
std::unique_ptr<cricket::MediaEngineInterface> media_engine(
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory, audio_mixer,
AudioProcessing::Create()));
audio_processing_use));
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
@ -69,6 +74,23 @@ CreatePeerConnectionFactoryWithAudioMixer(
std::move(call_factory), std::move(event_log_factory));
}
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer) {
return CreatePeerConnectionFactory(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, audio_mixer, nullptr);
}
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::Thread* network_thread,