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