| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004--2011 Google Inc. | 3 * Copyright 2004--2011 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "talk/app/webrtc/peerconnectionfactory.h" | 28 #include "talk/app/webrtc/peerconnectionfactory.h" |
| 29 | 29 |
| 30 #include "talk/app/webrtc/audiotrack.h" | 30 #include "talk/app/webrtc/audiotrack.h" |
| 31 #include "talk/app/webrtc/dtlsidentityservice.h" | |
| 32 #include "talk/app/webrtc/dtlsidentitystore.h" | 31 #include "talk/app/webrtc/dtlsidentitystore.h" |
| 33 #include "talk/app/webrtc/localaudiosource.h" | 32 #include "talk/app/webrtc/localaudiosource.h" |
| 34 #include "talk/app/webrtc/mediastreamproxy.h" | 33 #include "talk/app/webrtc/mediastreamproxy.h" |
| 35 #include "talk/app/webrtc/mediastreamtrackproxy.h" | 34 #include "talk/app/webrtc/mediastreamtrackproxy.h" |
| 36 #include "talk/app/webrtc/peerconnection.h" | 35 #include "talk/app/webrtc/peerconnection.h" |
| 37 #include "talk/app/webrtc/peerconnectionfactoryproxy.h" | 36 #include "talk/app/webrtc/peerconnectionfactoryproxy.h" |
| 38 #include "talk/app/webrtc/peerconnectionproxy.h" | 37 #include "talk/app/webrtc/peerconnectionproxy.h" |
| 39 #include "talk/app/webrtc/portallocatorfactory.h" | 38 #include "talk/app/webrtc/portallocatorfactory.h" |
| 40 #include "talk/app/webrtc/videosource.h" | 39 #include "talk/app/webrtc/videosource.h" |
| 41 #include "talk/app/webrtc/videosourceproxy.h" | 40 #include "talk/app/webrtc/videosourceproxy.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 162 |
| 164 channel_manager_.reset(new cricket::ChannelManager( | 163 channel_manager_.reset(new cricket::ChannelManager( |
| 165 media_engine, device_manager, worker_thread_)); | 164 media_engine, device_manager, worker_thread_)); |
| 166 | 165 |
| 167 channel_manager_->SetVideoRtxEnabled(true); | 166 channel_manager_->SetVideoRtxEnabled(true); |
| 168 if (!channel_manager_->Init()) { | 167 if (!channel_manager_->Init()) { |
| 169 return false; | 168 return false; |
| 170 } | 169 } |
| 171 | 170 |
| 172 dtls_identity_store_.reset( | 171 dtls_identity_store_.reset( |
| 173 new DtlsIdentityStore(signaling_thread_, worker_thread_)); | 172 new DtlsIdentityStoreImpl(signaling_thread_, worker_thread_)); |
| 174 dtls_identity_store_->Initialize(); | 173 dtls_identity_store_->Initialize(); |
| 175 | 174 |
| 176 return true; | 175 return true; |
| 177 } | 176 } |
| 178 | 177 |
| 179 rtc::scoped_refptr<AudioSourceInterface> | 178 rtc::scoped_refptr<AudioSourceInterface> |
| 180 PeerConnectionFactory::CreateAudioSource( | 179 PeerConnectionFactory::CreateAudioSource( |
| 181 const MediaConstraintsInterface* constraints) { | 180 const MediaConstraintsInterface* constraints) { |
| 182 DCHECK(signaling_thread_->IsCurrent()); | 181 DCHECK(signaling_thread_->IsCurrent()); |
| 183 rtc::scoped_refptr<LocalAudioSource> source( | 182 rtc::scoped_refptr<LocalAudioSource> source( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 198 bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file) { | 197 bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file) { |
| 199 DCHECK(signaling_thread_->IsCurrent()); | 198 DCHECK(signaling_thread_->IsCurrent()); |
| 200 return channel_manager_->StartAecDump(file); | 199 return channel_manager_->StartAecDump(file); |
| 201 } | 200 } |
| 202 | 201 |
| 203 rtc::scoped_refptr<PeerConnectionInterface> | 202 rtc::scoped_refptr<PeerConnectionInterface> |
| 204 PeerConnectionFactory::CreatePeerConnection( | 203 PeerConnectionFactory::CreatePeerConnection( |
| 205 const PeerConnectionInterface::RTCConfiguration& configuration, | 204 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 206 const MediaConstraintsInterface* constraints, | 205 const MediaConstraintsInterface* constraints, |
| 207 PortAllocatorFactoryInterface* allocator_factory, | 206 PortAllocatorFactoryInterface* allocator_factory, |
| 208 DTLSIdentityServiceInterface* dtls_identity_service, | 207 PeerConnectionObserver* observer, |
| 209 PeerConnectionObserver* observer) { | 208 DtlsIdentityStoreInterface* dtls_identity_store, |
| 209 rtc::KeyType key_type) { |
| 210 DCHECK(signaling_thread_->IsCurrent()); | 210 DCHECK(signaling_thread_->IsCurrent()); |
| 211 DCHECK(allocator_factory || default_allocator_factory_); | 211 DCHECK(allocator_factory || default_allocator_factory_); |
| 212 | 212 |
| 213 if (!dtls_identity_service) { | 213 // TODO(hbos): Clarify that the API does "use parameter store, or if null use |
| 214 dtls_identity_service = new DtlsIdentityService(dtls_identity_store_.get()); | 214 // a default DtlsIdentityStoreImpl". Or nuke parameter? (Probably needed in |
| 215 // unittest.) Or put it in the end and default it to null. |
| 216 if (!dtls_identity_store) { |
| 217 dtls_identity_store = dtls_identity_store_.get(); |
| 215 } | 218 } |
| 219 DCHECK(dtls_identity_store); |
| 216 | 220 |
| 217 PortAllocatorFactoryInterface* chosen_allocator_factory = | 221 PortAllocatorFactoryInterface* chosen_allocator_factory = |
| 218 allocator_factory ? allocator_factory : default_allocator_factory_.get(); | 222 allocator_factory ? allocator_factory : default_allocator_factory_.get(); |
| 219 chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask); | 223 chosen_allocator_factory->SetNetworkIgnoreMask(options_.network_ignore_mask); |
| 220 | 224 |
| 221 rtc::scoped_refptr<PeerConnection> pc( | 225 rtc::scoped_refptr<PeerConnection> pc( |
| 222 new rtc::RefCountedObject<PeerConnection>(this)); | 226 new rtc::RefCountedObject<PeerConnection>(this)); |
| 223 if (!pc->Initialize( | 227 if (!pc->Initialize( |
| 224 configuration, | 228 configuration, |
| 225 constraints, | 229 constraints, |
| 226 chosen_allocator_factory, | 230 chosen_allocator_factory, |
| 227 dtls_identity_service, | 231 observer, |
| 228 observer)) { | 232 dtls_identity_store, |
| 233 key_type)) { |
| 229 return NULL; | 234 return NULL; |
| 230 } | 235 } |
| 231 return PeerConnectionProxy::Create(signaling_thread(), pc); | 236 return PeerConnectionProxy::Create(signaling_thread(), pc); |
| 232 } | 237 } |
| 233 | 238 |
| 234 rtc::scoped_refptr<MediaStreamInterface> | 239 rtc::scoped_refptr<MediaStreamInterface> |
| 235 PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) { | 240 PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) { |
| 236 DCHECK(signaling_thread_->IsCurrent()); | 241 DCHECK(signaling_thread_->IsCurrent()); |
| 237 return MediaStreamProxy::Create(signaling_thread_, | 242 return MediaStreamProxy::Create(signaling_thread_, |
| 238 MediaStream::Create(label)); | 243 MediaStream::Create(label)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 279 } |
| 275 | 280 |
| 276 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { | 281 cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() { |
| 277 ASSERT(worker_thread_ == rtc::Thread::Current()); | 282 ASSERT(worker_thread_ == rtc::Thread::Current()); |
| 278 return cricket::WebRtcMediaEngineFactory::Create( | 283 return cricket::WebRtcMediaEngineFactory::Create( |
| 279 default_adm_.get(), video_encoder_factory_.get(), | 284 default_adm_.get(), video_encoder_factory_.get(), |
| 280 video_decoder_factory_.get()); | 285 video_decoder_factory_.get()); |
| 281 } | 286 } |
| 282 | 287 |
| 283 } // namespace webrtc | 288 } // namespace webrtc |
| OLD | NEW |