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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 RTC_CHECK(rtc::Thread::Current() == pc_factory->signaling_thread()); | 47 RTC_CHECK(rtc::Thread::Current() == pc_factory->signaling_thread()); |
48 // The signaling thread is the current thread so we can | 48 // The signaling thread is the current thread so we can |
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> | |
58 CreatePeerConnectionFactory() { | |
59 return CreatePeerConnectionFactory(CreateBuiltinAudioEncoderFactory(), | |
60 CreateBuiltinAudioDecoderFactory()); | |
61 } | |
62 | |
63 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( | 57 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
64 rtc::Thread* network_thread, | 58 rtc::Thread* network_thread, |
65 rtc::Thread* worker_thread, | 59 rtc::Thread* worker_thread, |
66 rtc::Thread* signaling_thread, | 60 rtc::Thread* signaling_thread, |
67 AudioDeviceModule* default_adm, | 61 AudioDeviceModule* default_adm, |
68 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, | 62 rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory, |
69 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, | 63 rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory, |
70 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 64 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
71 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) { | 65 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) { |
72 return CreatePeerConnectionFactoryWithAudioMixer( | 66 return CreatePeerConnectionFactoryWithAudioMixer( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 MethodCall0<PeerConnectionFactory, bool> call( | 103 MethodCall0<PeerConnectionFactory, bool> call( |
110 pc_factory.get(), &PeerConnectionFactory::Initialize); | 104 pc_factory.get(), &PeerConnectionFactory::Initialize); |
111 bool result = call.Marshal(RTC_FROM_HERE, signaling_thread); | 105 bool result = call.Marshal(RTC_FROM_HERE, signaling_thread); |
112 | 106 |
113 if (!result) { | 107 if (!result) { |
114 return nullptr; | 108 return nullptr; |
115 } | 109 } |
116 return PeerConnectionFactoryProxy::Create(signaling_thread, pc_factory); | 110 return PeerConnectionFactoryProxy::Create(signaling_thread, pc_factory); |
117 } | 111 } |
118 | 112 |
119 rtc::scoped_refptr<PeerConnectionFactoryInterface> | |
120 CreatePeerConnectionFactoryWithAudioMixer( | |
121 rtc::Thread* network_thread, | |
122 rtc::Thread* worker_thread, | |
123 rtc::Thread* signaling_thread, | |
124 AudioDeviceModule* default_adm, | |
125 cricket::WebRtcVideoEncoderFactory* encoder_factory, | |
126 cricket::WebRtcVideoDecoderFactory* decoder_factory, | |
127 rtc::scoped_refptr<AudioMixer> audio_mixer) { | |
128 return CreatePeerConnectionFactoryWithAudioMixer( | |
129 network_thread, worker_thread, signaling_thread, default_adm, | |
130 CreateBuiltinAudioEncoderFactory(), CreateBuiltinAudioDecoderFactory(), | |
131 encoder_factory, decoder_factory, audio_mixer); | |
132 } | |
133 | |
134 PeerConnectionFactory::PeerConnectionFactory( | 113 PeerConnectionFactory::PeerConnectionFactory( |
135 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, | 114 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, |
136 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) | 115 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) |
137 : owns_ptrs_(true), | 116 : owns_ptrs_(true), |
138 wraps_current_thread_(false), | 117 wraps_current_thread_(false), |
139 network_thread_(rtc::Thread::CreateWithSocketServer().release()), | 118 network_thread_(rtc::Thread::CreateWithSocketServer().release()), |
140 worker_thread_(rtc::Thread::Create().release()), | 119 worker_thread_(rtc::Thread::Create().release()), |
141 signaling_thread_(rtc::Thread::Current()), | 120 signaling_thread_(rtc::Thread::Current()), |
142 audio_encoder_factory_(audio_encoder_factory), | 121 audio_encoder_factory_(audio_encoder_factory), |
143 audio_decoder_factory_(audio_decoder_factory) { | 122 audio_decoder_factory_(audio_decoder_factory) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 366 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
388 return std::unique_ptr<cricket::MediaEngineInterface>( | 367 return std::unique_ptr<cricket::MediaEngineInterface>( |
389 cricket::WebRtcMediaEngineFactory::Create( | 368 cricket::WebRtcMediaEngineFactory::Create( |
390 default_adm_.get(), audio_encoder_factory_, | 369 default_adm_.get(), audio_encoder_factory_, |
391 audio_decoder_factory_, | 370 audio_decoder_factory_, |
392 video_encoder_factory_.get(), video_decoder_factory_.get(), | 371 video_encoder_factory_.get(), video_decoder_factory_.get(), |
393 external_audio_mixer_)); | 372 external_audio_mixer_)); |
394 } | 373 } |
395 | 374 |
396 } // namespace webrtc | 375 } // namespace webrtc |
OLD | NEW |