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 #ifdef HAVE_MEDIA | |
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 #ifdef HAVE_MEDIA | |
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 return worker_thread_; | 394 return worker_thread_; |
383 } | 395 } |
384 | 396 |
385 rtc::Thread* PeerConnectionFactory::network_thread() { | 397 rtc::Thread* PeerConnectionFactory::network_thread() { |
386 return network_thread_; | 398 return network_thread_; |
387 } | 399 } |
388 | 400 |
389 std::unique_ptr<cricket::MediaEngineInterface> | 401 std::unique_ptr<cricket::MediaEngineInterface> |
390 PeerConnectionFactory::CreateMediaEngine_w() { | 402 PeerConnectionFactory::CreateMediaEngine_w() { |
391 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 403 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
404 #ifdef HAVE_MEDIA | |
392 return std::unique_ptr<cricket::MediaEngineInterface>( | 405 return std::unique_ptr<cricket::MediaEngineInterface>( |
393 cricket::WebRtcMediaEngineFactory::Create( | 406 cricket::WebRtcMediaEngineFactory::Create( |
394 default_adm_.get(), audio_encoder_factory_, | 407 default_adm_.get(), audio_encoder_factory_, audio_decoder_factory_, |
395 audio_decoder_factory_, | |
396 video_encoder_factory_.get(), video_decoder_factory_.get(), | 408 video_encoder_factory_.get(), video_decoder_factory_.get(), |
397 external_audio_mixer_)); | 409 external_audio_mixer_)); |
410 #else | |
411 return std::unique_ptr<cricket::MediaEngineInterface>(); | |
412 #endif | |
pthatcher1
2017/05/03 18:05:53
Why not just not call CreateMediaEngine_w from Pee
Zhi Huang
2017/05/04 01:08:03
The idea here is trying to avoid compiling and lin
pthatcher1
2017/05/05 01:45:12
Ah, duh. You're right.
| |
398 } | 413 } |
399 | 414 |
400 } // namespace webrtc | 415 } // namespace webrtc |
OLD | NEW |