| 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 10 matching lines...) Expand all Loading... |
| 21 #include "webrtc/api/peerconnection.h" | 21 #include "webrtc/api/peerconnection.h" |
| 22 #include "webrtc/api/peerconnectionfactoryproxy.h" | 22 #include "webrtc/api/peerconnectionfactoryproxy.h" |
| 23 #include "webrtc/api/peerconnectionproxy.h" | 23 #include "webrtc/api/peerconnectionproxy.h" |
| 24 #include "webrtc/api/videocapturertracksource.h" | 24 #include "webrtc/api/videocapturertracksource.h" |
| 25 #include "webrtc/api/videosourceproxy.h" | 25 #include "webrtc/api/videosourceproxy.h" |
| 26 #include "webrtc/api/videotrack.h" | 26 #include "webrtc/api/videotrack.h" |
| 27 #include "webrtc/base/bind.h" | 27 #include "webrtc/base/bind.h" |
| 28 #include "webrtc/media/engine/webrtcmediaengine.h" | 28 #include "webrtc/media/engine/webrtcmediaengine.h" |
| 29 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" | 29 #include "webrtc/media/engine/webrtcvideodecoderfactory.h" |
| 30 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" | 30 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" |
| 31 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
| 31 #include "webrtc/modules/audio_device/include/audio_device.h" | 32 #include "webrtc/modules/audio_device/include/audio_device.h" |
| 32 #include "webrtc/p2p/base/basicpacketsocketfactory.h" | 33 #include "webrtc/p2p/base/basicpacketsocketfactory.h" |
| 33 #include "webrtc/p2p/client/basicportallocator.h" | 34 #include "webrtc/p2p/client/basicportallocator.h" |
| 34 | 35 |
| 35 namespace webrtc { | 36 namespace webrtc { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 // Passes down the calls to |store_|. See usage in CreatePeerConnection. | 40 // Passes down the calls to |store_|. See usage in CreatePeerConnection. |
| 40 class DtlsIdentityStoreWrapper : public DtlsIdentityStoreInterface { | 41 class DtlsIdentityStoreWrapper : public DtlsIdentityStoreInterface { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 77 |
| 77 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( | 78 rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory( |
| 78 rtc::Thread* network_thread, | 79 rtc::Thread* network_thread, |
| 79 rtc::Thread* worker_thread, | 80 rtc::Thread* worker_thread, |
| 80 rtc::Thread* signaling_thread, | 81 rtc::Thread* signaling_thread, |
| 81 AudioDeviceModule* default_adm, | 82 AudioDeviceModule* default_adm, |
| 82 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 83 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 83 cricket::WebRtcVideoDecoderFactory* decoder_factory) { | 84 cricket::WebRtcVideoDecoderFactory* decoder_factory) { |
| 84 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( | 85 rtc::scoped_refptr<PeerConnectionFactory> pc_factory( |
| 85 new rtc::RefCountedObject<PeerConnectionFactory>( | 86 new rtc::RefCountedObject<PeerConnectionFactory>( |
| 86 network_thread, worker_thread, signaling_thread, default_adm, | 87 network_thread, |
| 87 encoder_factory, decoder_factory)); | 88 worker_thread, |
| 89 signaling_thread, |
| 90 default_adm, |
| 91 CreateBuiltinAudioDecoderFactory(), |
| 92 encoder_factory, |
| 93 decoder_factory)); |
| 88 | 94 |
| 89 // Call Initialize synchronously but make sure its executed on | 95 // Call Initialize synchronously but make sure its executed on |
| 90 // |signaling_thread|. | 96 // |signaling_thread|. |
| 91 MethodCall0<PeerConnectionFactory, bool> call( | 97 MethodCall0<PeerConnectionFactory, bool> call( |
| 92 pc_factory.get(), | 98 pc_factory.get(), |
| 93 &PeerConnectionFactory::Initialize); | 99 &PeerConnectionFactory::Initialize); |
| 94 bool result = call.Marshal(signaling_thread); | 100 bool result = call.Marshal(signaling_thread); |
| 95 | 101 |
| 96 if (!result) { | 102 if (!result) { |
| 97 return nullptr; | 103 return nullptr; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 111 } | 117 } |
| 112 network_thread_->Start(); | 118 network_thread_->Start(); |
| 113 worker_thread_->Start(); | 119 worker_thread_->Start(); |
| 114 } | 120 } |
| 115 | 121 |
| 116 PeerConnectionFactory::PeerConnectionFactory( | 122 PeerConnectionFactory::PeerConnectionFactory( |
| 117 rtc::Thread* network_thread, | 123 rtc::Thread* network_thread, |
| 118 rtc::Thread* worker_thread, | 124 rtc::Thread* worker_thread, |
| 119 rtc::Thread* signaling_thread, | 125 rtc::Thread* signaling_thread, |
| 120 AudioDeviceModule* default_adm, | 126 AudioDeviceModule* default_adm, |
| 127 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& |
| 128 audio_decoder_factory, |
| 121 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, | 129 cricket::WebRtcVideoEncoderFactory* video_encoder_factory, |
| 122 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) | 130 cricket::WebRtcVideoDecoderFactory* video_decoder_factory) |
| 123 : owns_ptrs_(false), | 131 : owns_ptrs_(false), |
| 124 wraps_current_thread_(false), | 132 wraps_current_thread_(false), |
| 125 network_thread_(network_thread), | 133 network_thread_(network_thread), |
| 126 worker_thread_(worker_thread), | 134 worker_thread_(worker_thread), |
| 127 signaling_thread_(signaling_thread), | 135 signaling_thread_(signaling_thread), |
| 128 default_adm_(default_adm), | 136 default_adm_(default_adm), |
| 137 audio_decoder_factory_(audio_decoder_factory), |
| 129 video_encoder_factory_(video_encoder_factory), | 138 video_encoder_factory_(video_encoder_factory), |
| 130 video_decoder_factory_(video_decoder_factory) { | 139 video_decoder_factory_(video_decoder_factory) { |
| 131 RTC_DCHECK(network_thread); | 140 RTC_DCHECK(network_thread); |
| 132 RTC_DCHECK(worker_thread); | 141 RTC_DCHECK(worker_thread); |
| 133 RTC_DCHECK(signaling_thread); | 142 RTC_DCHECK(signaling_thread); |
| 134 // TODO: Currently there is no way creating an external adm in | 143 // TODO: Currently there is no way creating an external adm in |
| 135 // libjingle source tree. So we can 't currently assert if this is NULL. | 144 // libjingle source tree. So we can 't currently assert if this is NULL. |
| 136 // ASSERT(default_adm != NULL); | 145 // ASSERT(default_adm != NULL); |
| 137 } | 146 } |
| 138 | 147 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 return worker_thread_; | 352 return worker_thread_; |
| 344 } | 353 } |
| 345 | 354 |
| 346 rtc::Thread* PeerConnectionFactory::network_thread() { | 355 rtc::Thread* PeerConnectionFactory::network_thread() { |
| 347 return network_thread_; | 356 return network_thread_; |
| 348 } | 357 } |
| 349 | 358 |
| 350 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { | 359 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
| 351 ASSERT(worker_thread_ == rtc::Thread::Current()); | 360 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 352 return cricket::WebRtcMediaEngineFactory::Create( | 361 return cricket::WebRtcMediaEngineFactory::Create( |
| 353 default_adm_.get(), video_encoder_factory_.get(), | 362 default_adm_.get(), |
| 363 audio_decoder_factory_, |
| 364 video_encoder_factory_.get(), |
| 354 video_decoder_factory_.get()); | 365 video_decoder_factory_.get()); |
| 355 } | 366 } |
| 356 | 367 |
| 357 } // namespace webrtc | 368 } // namespace webrtc |
| OLD | NEW |