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 |
11 #include "webrtc/pc/peerconnectionfactory.h" | 11 #include "webrtc/pc/peerconnectionfactory.h" |
12 | 12 |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 15 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
| 16 #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" |
16 #include "webrtc/api/mediaconstraintsinterface.h" | 17 #include "webrtc/api/mediaconstraintsinterface.h" |
17 #include "webrtc/api/mediastreamproxy.h" | 18 #include "webrtc/api/mediastreamproxy.h" |
18 #include "webrtc/api/mediastreamtrackproxy.h" | 19 #include "webrtc/api/mediastreamtrackproxy.h" |
19 #include "webrtc/api/peerconnectionfactoryproxy.h" | 20 #include "webrtc/api/peerconnectionfactoryproxy.h" |
20 #include "webrtc/api/peerconnectionproxy.h" | 21 #include "webrtc/api/peerconnectionproxy.h" |
21 #include "webrtc/api/videosourceproxy.h" | 22 #include "webrtc/api/videosourceproxy.h" |
22 #include "webrtc/base/bind.h" | 23 #include "webrtc/base/bind.h" |
23 #include "webrtc/base/checks.h" | 24 #include "webrtc/base/checks.h" |
24 #include "webrtc/media/engine/webrtcmediaengine.h" | 25 #include "webrtc/media/engine/webrtcmediaengine.h" |
25 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" | 26 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" |
26 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" | 27 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
27 #include "webrtc/modules/audio_coding/codecs/builtin_audio_encoder_factory.h" | |
28 #include "webrtc/modules/audio_device/include/audio_device.h" | 28 #include "webrtc/modules/audio_device/include/audio_device.h" |
29 #include "webrtc/p2p/base/basicpacketsocketfactory.h" | 29 #include "webrtc/p2p/base/basicpacketsocketfactory.h" |
30 #include "webrtc/p2p/client/basicportallocator.h" | 30 #include "webrtc/p2p/client/basicportallocator.h" |
31 #include "webrtc/pc/audiotrack.h" | 31 #include "webrtc/pc/audiotrack.h" |
32 #include "webrtc/pc/localaudiosource.h" | 32 #include "webrtc/pc/localaudiosource.h" |
33 #include "webrtc/pc/mediastream.h" | 33 #include "webrtc/pc/mediastream.h" |
34 #include "webrtc/pc/peerconnection.h" | 34 #include "webrtc/pc/peerconnection.h" |
35 #include "webrtc/pc/videocapturertracksource.h" | 35 #include "webrtc/pc/videocapturertracksource.h" |
36 #include "webrtc/pc/videotrack.h" | 36 #include "webrtc/pc/videotrack.h" |
37 | 37 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 PeerConnectionFactory::PeerConnectionFactory( | 134 PeerConnectionFactory::PeerConnectionFactory( |
135 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, | 135 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, |
136 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) | 136 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory) |
137 : owns_ptrs_(true), | 137 : owns_ptrs_(true), |
138 wraps_current_thread_(false), | 138 wraps_current_thread_(false), |
139 network_thread_(rtc::Thread::CreateWithSocketServer().release()), | 139 network_thread_(rtc::Thread::CreateWithSocketServer().release()), |
140 worker_thread_(rtc::Thread::Create().release()), | 140 worker_thread_(rtc::Thread::Create().release()), |
141 signaling_thread_(rtc::Thread::Current()), | 141 signaling_thread_(rtc::Thread::Current()), |
142 // TODO(ossu): Take care of audio_encoder_factory (see bug 5806). | 142 audio_encoder_factory_(audio_encoder_factory), |
143 audio_decoder_factory_(audio_decoder_factory) { | 143 audio_decoder_factory_(audio_decoder_factory) { |
144 if (!signaling_thread_) { | 144 if (!signaling_thread_) { |
145 signaling_thread_ = rtc::ThreadManager::Instance()->WrapCurrentThread(); | 145 signaling_thread_ = rtc::ThreadManager::Instance()->WrapCurrentThread(); |
146 wraps_current_thread_ = true; | 146 wraps_current_thread_ = true; |
147 } | 147 } |
148 network_thread_->Start(); | 148 network_thread_->Start(); |
149 worker_thread_->Start(); | 149 worker_thread_->Start(); |
150 } | 150 } |
151 | 151 |
152 PeerConnectionFactory::PeerConnectionFactory( | 152 PeerConnectionFactory::PeerConnectionFactory( |
153 rtc::Thread* network_thread, | 153 rtc::Thread* network_thread, |
154 rtc::Thread* worker_thread, | 154 rtc::Thread* worker_thread, |
155 rtc::Thread* signaling_thread, | 155 rtc::Thread* signaling_thread, |
156 AudioDeviceModule* default_adm, | 156 AudioDeviceModule* default_adm, |
157 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, | 157 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory, |
158 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory, | 158 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory, |
159 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 159 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
160 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, | 160 cricket::WebRtcVideoDecoderFactory* video_decoder_factory, |
161 rtc::scoped_refptr<AudioMixer> audio_mixer) | 161 rtc::scoped_refptr<AudioMixer> audio_mixer) |
162 : owns_ptrs_(false), | 162 : owns_ptrs_(false), |
163 wraps_current_thread_(false), | 163 wraps_current_thread_(false), |
164 network_thread_(network_thread), | 164 network_thread_(network_thread), |
165 worker_thread_(worker_thread), | 165 worker_thread_(worker_thread), |
166 signaling_thread_(signaling_thread), | 166 signaling_thread_(signaling_thread), |
167 default_adm_(default_adm), | 167 default_adm_(default_adm), |
168 // TODO(ossu): Take care of audio_encoder_factory (see bug 5806). | 168 audio_encoder_factory_(audio_encoder_factory), |
169 audio_decoder_factory_(audio_decoder_factory), | 169 audio_decoder_factory_(audio_decoder_factory), |
170 video_encoder_factory_(video_encoder_factory), | 170 video_encoder_factory_(video_encoder_factory), |
171 video_decoder_factory_(video_decoder_factory), | 171 video_decoder_factory_(video_decoder_factory), |
172 external_audio_mixer_(audio_mixer) { | 172 external_audio_mixer_(audio_mixer) { |
173 RTC_DCHECK(network_thread); | 173 RTC_DCHECK(network_thread); |
174 RTC_DCHECK(worker_thread); | 174 RTC_DCHECK(worker_thread); |
175 RTC_DCHECK(signaling_thread); | 175 RTC_DCHECK(signaling_thread); |
176 // TODO: Currently there is no way creating an external adm in | 176 // TODO: Currently there is no way creating an external adm in |
177 // libjingle source tree. So we can 't currently assert if this is NULL. | 177 // libjingle source tree. So we can 't currently assert if this is NULL. |
178 // RTC_DCHECK(default_adm != NULL); | 178 // RTC_DCHECK(default_adm != NULL); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 rtc::Thread* PeerConnectionFactory::network_thread() { | 385 rtc::Thread* PeerConnectionFactory::network_thread() { |
386 return network_thread_; | 386 return network_thread_; |
387 } | 387 } |
388 | 388 |
389 std::unique_ptr<cricket::MediaEngineInterface> | 389 std::unique_ptr<cricket::MediaEngineInterface> |
390 PeerConnectionFactory::CreateMediaEngine_w() { | 390 PeerConnectionFactory::CreateMediaEngine_w() { |
391 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 391 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
392 return std::unique_ptr<cricket::MediaEngineInterface>( | 392 return std::unique_ptr<cricket::MediaEngineInterface>( |
393 cricket::WebRtcMediaEngineFactory::Create( | 393 cricket::WebRtcMediaEngineFactory::Create( |
394 default_adm_.get(), audio_decoder_factory_, | 394 default_adm_.get(), audio_encoder_factory_, |
| 395 audio_decoder_factory_, |
395 video_encoder_factory_.get(), video_decoder_factory_.get(), | 396 video_encoder_factory_.get(), video_decoder_factory_.get(), |
396 external_audio_mixer_)); | 397 external_audio_mixer_)); |
397 } | 398 } |
398 | 399 |
399 } // namespace webrtc | 400 } // namespace webrtc |
OLD | NEW |