OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 // safely call Initialize directly. | 49 // safely call Initialize directly. |
50 if (!pc_factory->Initialize()) { | 50 if (!pc_factory->Initialize()) { |
51 return nullptr; | 51 return nullptr; |
52 } | 52 } |
53 return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(), | 53 return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(), |
54 pc_factory); | 54 pc_factory); |
55 } | 55 } |
56 | 56 |
57 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 57 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
58 CreatePeerConnectionFactory() { | 58 CreatePeerConnectionFactory() { |
59 return CreatePeerConnectionFactory(CreateBuiltinAudioEncoderFactory(), | 59 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory; |
60 CreateBuiltinAudioDecoderFactory()); | 60 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory; |
61 #if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) | |
Taylor Brandstetter
2017/05/11 04:43:11
Only need HAVE_WEBRC_VOICE here and below
Zhi Huang
2017/05/12 20:05:33
Done.
| |
62 audio_encoder_factory = CreateBuiltinAudioEncoderFactory(); | |
63 audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); | |
64 #endif | |
65 return CreatePeerConnectionFactory(audio_encoder_factory, | |
66 audio_decoder_factory); | |
61 } | 67 } |
62 | 68 |
63 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( | 69 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
64 rtc::Thread* network_thread, | 70 rtc::Thread* network_thread, |
65 rtc::Thread* worker_thread, | 71 rtc::Thread* worker_thread, |
66 rtc::Thread* signaling_thread, | 72 rtc::Thread* signaling_thread, |
67 AudioDeviceModule* default_adm, | 73 AudioDeviceModule* default_adm, |
68 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | 74 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
69 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, | 75 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
70 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 76 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 | 124 |
119 rtc::scoped_refptr<PeerConnectionFactoryInterface> | 125 rtc::scoped_refptr<PeerConnectionFactoryInterface> |
120 CreatePeerConnectionFactoryWithAudioMixer( | 126 CreatePeerConnectionFactoryWithAudioMixer( |
121 rtc::Thread* network_thread, | 127 rtc::Thread* network_thread, |
122 rtc::Thread* worker_thread, | 128 rtc::Thread* worker_thread, |
123 rtc::Thread* signaling_thread, | 129 rtc::Thread* signaling_thread, |
124 AudioDeviceModule* default_adm, | 130 AudioDeviceModule* default_adm, |
125 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 131 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
126 cricket::WebRtcVideoDecoderFactory* decoder_factory, | 132 cricket::WebRtcVideoDecoderFactory* decoder_factory, |
127 rtc::scoped_refptr<AudioMixer> audio_mixer) { | 133 rtc::scoped_refptr<AudioMixer> audio_mixer) { |
134 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory; | |
135 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory; | |
136 #if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) | |
137 audio_encoder_factory = CreateBuiltinAudioEncoderFactory(); | |
138 audio_decoder_factory = CreateBuiltinAudioDecoderFactory(); | |
139 #endif | |
128 return CreatePeerConnectionFactoryWithAudioMixer( | 140 return CreatePeerConnectionFactoryWithAudioMixer( |
129 network_thread, worker_thread, signaling_thread, default_adm, | 141 network_thread, worker_thread, signaling_thread, default_adm, |
130 CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(), | 142 audio_encoder_factory, audio_decoder_factory, encoder_factory, |
131 encoder_factory, decoder_factory, audio_mixer); | 143 decoder_factory, audio_mixer); |
132 } | 144 } |
133 | 145 |
134 PeerConnectionFactory::PeerConnectionFactory( | 146 PeerConnectionFactory::PeerConnectionFactory( |
135 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, | 147 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, |
136 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) | 148 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) |
137 : owns_ptrs_(true), | 149 : owns_ptrs_(true), |
138 wraps_current_thread_(false), | 150 wraps_current_thread_(false), |
139 network_thread_(rtc::Thread::CreateWithSocketServer().release()), | 151 network_thread_(rtc::Thread::CreateWithSocketServer().release()), |
140 worker_thread_(rtc::Thread::Create().release()), | 152 worker_thread_(rtc::Thread::Create().release()), |
141 signaling_thread_(rtc::Thread::Current()), | 153 signaling_thread_(rtc::Thread::Current()), |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 return worker_thread_; | 390 return worker_thread_; |
379 } | 391 } |
380 | 392 |
381 rtc::Thread* PeerConnectionFactory::network_thread() { | 393 rtc::Thread* PeerConnectionFactory::network_thread() { |
382 return network_thread_; | 394 return network_thread_; |
383 } | 395 } |
384 | 396 |
385 std::unique_ptr<cricket::MediaEngineInterface> | 397 std::unique_ptr<cricket::MediaEngineInterface> |
386 PeerConnectionFactory::CreateMediaEngine_w() { | 398 PeerConnectionFactory::CreateMediaEngine_w() { |
387 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 399 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
400 #if defined(HAVE_WEBRTC_VOICE) && defined(HAVE_WEBRTC_VIDEO) | |
Taylor Brandstetter
2017/05/11 04:43:11
||?
Zhi Huang
2017/05/12 20:05:33
Done.
| |
388 return std::unique_ptr<cricket::MediaEngineInterface>( | 401 return std::unique_ptr<cricket::MediaEngineInterface>( |
389 cricket::WebRtcMediaEngineFactory::Create( | 402 cricket::WebRtcMediaEngineFactory::Create( |
390 default_adm_.get(), audio_encoder_factory_, | 403 default_adm_.get(), audio_encoder_factory_, audio_decoder_factory_, |
391 audio_decoder_factory_, | |
392 video_encoder_factory_.get(), video_decoder_factory_.get(), | 404 video_encoder_factory_.get(), video_decoder_factory_.get(), |
393 external_audio_mixer_)); | 405 external_audio_mixer_)); |
406 #else | |
407 return std::unique_ptr<cricket::MediaEngineInterface>(); | |
408 #endif | |
394 } | 409 } |
395 | 410 |
396 } // namespace webrtc | 411 } // namespace webrtc |
OLD | NEW |