Chromium Code Reviews| Index: webrtc/api/peerconnectionfactory.cc |
| diff --git a/webrtc/api/peerconnectionfactory.cc b/webrtc/api/peerconnectionfactory.cc |
| index e76701e4869d09a8dc6359c076469e975d8305b8..c8fa539ea1ed475110cffa33c53cd596630754cd 100644 |
| --- a/webrtc/api/peerconnectionfactory.cc |
| +++ b/webrtc/api/peerconnectionfactory.cc |
| @@ -59,15 +59,11 @@ rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| rtc::scoped_refptr<PeerConnectionFactory> pc_factory( |
|
the sun
2016/12/07 15:56:08
Call CreatePeerConnectionFactoryWithAudioMixer() t
GeorgeZ
2016/12/07 18:28:17
Good catch.
|
| new rtc::RefCountedObject<PeerConnectionFactory>( |
| - network_thread, |
| - worker_thread, |
| - signaling_thread, |
| - default_adm, |
| - CreateBuiltinAudioDecoderFactory(), |
| - encoder_factory, |
| - decoder_factory)); |
| - |
| - // Call Initialize synchronously but make sure its executed on |
| + network_thread, worker_thread, signaling_thread, default_adm, |
| + CreateBuiltinAudioDecoderFactory(), encoder_factory, decoder_factory, |
| + nullptr)); |
| + |
| + // Call Initialize synchronously but make sure it is executed on |
| // |signaling_thread|. |
| MethodCall0<PeerConnectionFactory, bool> call( |
| pc_factory.get(), |
| @@ -95,6 +91,33 @@ PeerConnectionFactory::PeerConnectionFactory() |
| worker_thread_->Start(); |
| } |
| +rtc::scoped_refptr<PeerConnectionFactoryInterface> |
| +CreatePeerConnectionFactoryWithAudioMixer( |
| + rtc::Thread* network_thread, |
| + rtc::Thread* worker_thread, |
| + rtc::Thread* signaling_thread, |
| + AudioDeviceModule* default_adm, |
| + cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| + cricket::WebRtcVideoDecoderFactory* decoder_factory, |
| + rtc::scoped_refptr<AudioMixer> audio_mixer) { |
| + rtc::scoped_refptr<PeerConnectionFactory> pc_factory( |
| + new rtc::RefCountedObject<PeerConnectionFactory>( |
| + network_thread, worker_thread, signaling_thread, default_adm, |
| + CreateBuiltinAudioDecoderFactory(), encoder_factory, decoder_factory, |
| + audio_mixer)); |
| + |
| + // Call Initialize synchronously but make sure it is executed on |
| + // |signaling_thread|. |
| + MethodCall0<PeerConnectionFactory, bool> call( |
| + pc_factory.get(), &PeerConnectionFactory::Initialize); |
| + bool result = call.Marshal(RTC_FROM_HERE, signaling_thread); |
| + |
| + if (!result) { |
| + return nullptr; |
| + } |
| + return PeerConnectionFactoryProxy::Create(signaling_thread, pc_factory); |
| +} |
| + |
| PeerConnectionFactory::PeerConnectionFactory( |
| rtc::Thread* network_thread, |
| rtc::Thread* worker_thread, |
| @@ -103,7 +126,8 @@ PeerConnectionFactory::PeerConnectionFactory( |
| const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& |
| audio_decoder_factory, |
| cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
| - cricket::WebRtcVideoDecoderFactory* video_decoder_factory) |
| + cricket::WebRtcVideoDecoderFactory* video_decoder_factory, |
| + rtc::scoped_refptr<AudioMixer> audio_mixer) |
| : owns_ptrs_(false), |
| wraps_current_thread_(false), |
| network_thread_(network_thread), |
| @@ -112,7 +136,8 @@ PeerConnectionFactory::PeerConnectionFactory( |
| default_adm_(default_adm), |
| audio_decoder_factory_(audio_decoder_factory), |
| video_encoder_factory_(video_encoder_factory), |
| - video_decoder_factory_(video_decoder_factory) { |
| + video_decoder_factory_(video_decoder_factory), |
| + external_audio_mixer_(audio_mixer) { |
| RTC_DCHECK(network_thread); |
| RTC_DCHECK(worker_thread); |
| RTC_DCHECK(signaling_thread); |
| @@ -336,10 +361,8 @@ rtc::Thread* PeerConnectionFactory::network_thread() { |
| cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
| ASSERT(worker_thread_ == rtc::Thread::Current()); |
| return cricket::WebRtcMediaEngineFactory::Create( |
| - default_adm_.get(), |
| - audio_decoder_factory_, |
| - video_encoder_factory_.get(), |
| - video_decoder_factory_.get()); |
| + default_adm_.get(), audio_decoder_factory_, video_encoder_factory_.get(), |
| + video_decoder_factory_.get(), external_audio_mixer_); |
| } |
| } // namespace webrtc |