OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (mediastream_signaling_) | 342 if (mediastream_signaling_) |
343 mediastream_signaling_->TearDown(); | 343 mediastream_signaling_->TearDown(); |
344 if (stream_handler_container_) | 344 if (stream_handler_container_) |
345 stream_handler_container_->TearDown(); | 345 stream_handler_container_->TearDown(); |
346 } | 346 } |
347 | 347 |
348 bool PeerConnection::Initialize( | 348 bool PeerConnection::Initialize( |
349 const PeerConnectionInterface::RTCConfiguration& configuration, | 349 const PeerConnectionInterface::RTCConfiguration& configuration, |
350 const MediaConstraintsInterface* constraints, | 350 const MediaConstraintsInterface* constraints, |
351 PortAllocatorFactoryInterface* allocator_factory, | 351 PortAllocatorFactoryInterface* allocator_factory, |
352 DTLSIdentityServiceInterface* dtls_identity_service, | 352 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
353 PeerConnectionObserver* observer) { | 353 PeerConnectionObserver* observer) { |
354 ASSERT(observer != NULL); | 354 ASSERT(observer != NULL); |
355 if (!observer) | 355 if (!observer) |
356 return false; | 356 return false; |
357 observer_ = observer; | 357 observer_ = observer; |
358 | 358 |
359 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config; | 359 std::vector<PortAllocatorFactoryInterface::StunConfiguration> stun_config; |
360 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config; | 360 std::vector<PortAllocatorFactoryInterface::TurnConfiguration> turn_config; |
361 if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) { | 361 if (!ParseIceServers(configuration.servers, &stun_config, &turn_config)) { |
362 return false; | 362 return false; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 factory_->signaling_thread(), | 398 factory_->signaling_thread(), |
399 factory_->worker_thread(), | 399 factory_->worker_thread(), |
400 port_allocator_.get(), | 400 port_allocator_.get(), |
401 mediastream_signaling_.get())); | 401 mediastream_signaling_.get())); |
402 stream_handler_container_.reset(new MediaStreamHandlerContainer( | 402 stream_handler_container_.reset(new MediaStreamHandlerContainer( |
403 session_.get(), session_.get())); | 403 session_.get(), session_.get())); |
404 stats_.reset(new StatsCollector(session_.get())); | 404 stats_.reset(new StatsCollector(session_.get())); |
405 | 405 |
406 // Initialize the WebRtcSession. It creates transport channels etc. | 406 // Initialize the WebRtcSession. It creates transport channels etc. |
407 if (!session_->Initialize(factory_->options(), constraints, | 407 if (!session_->Initialize(factory_->options(), constraints, |
408 dtls_identity_service, configuration)) | 408 dtls_identity_store.Pass(), configuration)) |
409 return false; | 409 return false; |
410 | 410 |
411 // Register PeerConnection as receiver of local ice candidates. | 411 // Register PeerConnection as receiver of local ice candidates. |
412 // All the callbacks will be posted to the application from PeerConnection. | 412 // All the callbacks will be posted to the application from PeerConnection. |
413 session_->RegisterIceObserver(this); | 413 session_->RegisterIceObserver(this); |
414 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); | 414 session_->SignalState.connect(this, &PeerConnection::OnSessionStateChange); |
415 return true; | 415 return true; |
416 } | 416 } |
417 | 417 |
418 rtc::scoped_refptr<StreamCollectionInterface> | 418 rtc::scoped_refptr<StreamCollectionInterface> |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 if (ice_gathering_state_ != kIceGatheringComplete) { | 905 if (ice_gathering_state_ != kIceGatheringComplete) { |
906 ice_gathering_state_ = kIceGatheringComplete; | 906 ice_gathering_state_ = kIceGatheringComplete; |
907 observer_->OnIceGatheringChange(ice_gathering_state_); | 907 observer_->OnIceGatheringChange(ice_gathering_state_); |
908 } | 908 } |
909 } | 909 } |
910 observer_->OnSignalingChange(signaling_state_); | 910 observer_->OnSignalingChange(signaling_state_); |
911 observer_->OnStateChange(PeerConnectionObserver::kSignalingState); | 911 observer_->OnStateChange(PeerConnectionObserver::kSignalingState); |
912 } | 912 } |
913 | 913 |
914 } // namespace webrtc | 914 } // namespace webrtc |
OLD | NEW |