diff --git a/webrtc/api/peerconnectioninterface.h b/webrtc/api/peerconnectioninterface.h index 1b74564d6e..609fd4aa93 100644 --- a/webrtc/api/peerconnectioninterface.h +++ b/webrtc/api/peerconnectioninterface.h @@ -1080,6 +1080,24 @@ rtc::scoped_refptr 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 CreatePeerConnectionFactory( + rtc::Thread* network_thread, + rtc::Thread* worker_thread, + rtc::Thread* signaling_thread, + AudioDeviceModule* default_adm, + rtc::scoped_refptr audio_encoder_factory, + rtc::scoped_refptr audio_decoder_factory, + cricket::WebRtcVideoEncoderFactory* video_encoder_factory, + cricket::WebRtcVideoDecoderFactory* video_decoder_factory, + rtc::scoped_refptr audio_mixer, + rtc::scoped_refptr audio_processing); + // Create a new instance of PeerConnectionFactoryInterface with external audio // mixer. // diff --git a/webrtc/pc/createpeerconnectionfactory.cc b/webrtc/pc/createpeerconnectionfactory.cc index c29ef52d31..6861d822ae 100644 --- a/webrtc/pc/createpeerconnectionfactory.cc +++ b/webrtc/pc/createpeerconnectionfactory.cc @@ -40,8 +40,7 @@ CreatePeerConnectionFactory() { // Note: all the other CreatePeerConnectionFactory variants just end up calling // this, ultimately. -rtc::scoped_refptr -CreatePeerConnectionFactoryWithAudioMixer( +rtc::scoped_refptr CreatePeerConnectionFactory( rtc::Thread* network_thread, rtc::Thread* worker_thread, rtc::Thread* signaling_thread, @@ -50,12 +49,18 @@ CreatePeerConnectionFactoryWithAudioMixer( rtc::scoped_refptr audio_decoder_factory, cricket::WebRtcVideoEncoderFactory* video_encoder_factory, cricket::WebRtcVideoDecoderFactory* video_decoder_factory, - rtc::scoped_refptr audio_mixer) { + rtc::scoped_refptr audio_mixer, + rtc::scoped_refptr audio_processing) { + rtc::scoped_refptr audio_processing_use = audio_processing; + if (!audio_processing_use) { + audio_processing_use = AudioProcessing::Create(); + } + std::unique_ptr 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 call_factory = CreateCallFactory(); @@ -69,6 +74,23 @@ CreatePeerConnectionFactoryWithAudioMixer( std::move(call_factory), std::move(event_log_factory)); } +rtc::scoped_refptr +CreatePeerConnectionFactoryWithAudioMixer( + rtc::Thread* network_thread, + rtc::Thread* worker_thread, + rtc::Thread* signaling_thread, + AudioDeviceModule* default_adm, + rtc::scoped_refptr audio_encoder_factory, + rtc::scoped_refptr audio_decoder_factory, + cricket::WebRtcVideoEncoderFactory* video_encoder_factory, + cricket::WebRtcVideoDecoderFactory* video_decoder_factory, + rtc::scoped_refptr 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 CreatePeerConnectionFactoryWithAudioMixer( rtc::Thread* network_thread,