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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 std::unique_ptr<cricket::MediaEngineInterface> media_engine = | 213 std::unique_ptr<cricket::MediaEngineInterface> media_engine = |
214 worker_thread_->Invoke<std::unique_ptr<cricket::MediaEngineInterface>>( | 214 worker_thread_->Invoke<std::unique_ptr<cricket::MediaEngineInterface>>( |
215 RTC_FROM_HERE, | 215 RTC_FROM_HERE, |
216 rtc::Bind(&PeerConnectionFactory::CreateMediaEngine_w, this)); | 216 rtc::Bind(&PeerConnectionFactory::CreateMediaEngine_w, this)); |
217 | 217 |
218 channel_manager_.reset(new cricket::ChannelManager( | 218 channel_manager_.reset(new cricket::ChannelManager( |
219 std::move(media_engine), worker_thread_, network_thread_)); | 219 std::move(media_engine), worker_thread_, network_thread_)); |
220 | 220 |
221 channel_manager_->SetVideoRtxEnabled(true); | 221 channel_manager_->SetVideoRtxEnabled(true); |
222 channel_manager_->SetCryptoOptions(options_.crypto_options); | |
223 if (!channel_manager_->Init()) { | 222 if (!channel_manager_->Init()) { |
224 return false; | 223 return false; |
225 } | 224 } |
226 | 225 |
227 return true; | 226 return true; |
228 } | 227 } |
229 | 228 |
230 void PeerConnectionFactory::SetOptions(const Options& options) { | 229 void PeerConnectionFactory::SetOptions(const Options& options) { |
231 options_ = options; | 230 options_ = options; |
232 if (channel_manager_) { | |
233 channel_manager_->SetCryptoOptions(options.crypto_options); | |
234 } | |
235 } | 231 } |
236 | 232 |
237 rtc::scoped_refptr<AudioSourceInterface> | 233 rtc::scoped_refptr<AudioSourceInterface> |
238 PeerConnectionFactory::CreateAudioSource( | 234 PeerConnectionFactory::CreateAudioSource( |
239 const MediaConstraintsInterface* constraints) { | 235 const MediaConstraintsInterface* constraints) { |
240 RTC_DCHECK(signaling_thread_->IsCurrent()); | 236 RTC_DCHECK(signaling_thread_->IsCurrent()); |
241 rtc::scoped_refptr<LocalAudioSource> source( | 237 rtc::scoped_refptr<LocalAudioSource> source( |
242 LocalAudioSource::Create(constraints)); | 238 LocalAudioSource::Create(constraints)); |
243 return source; | 239 return source; |
244 } | 240 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 webrtc::RtcEventLog* event_log) const { | 359 webrtc::RtcEventLog* event_log) const { |
364 RTC_DCHECK(signaling_thread_->IsCurrent()); | 360 RTC_DCHECK(signaling_thread_->IsCurrent()); |
365 return MediaControllerInterface::Create(config, worker_thread_, | 361 return MediaControllerInterface::Create(config, worker_thread_, |
366 channel_manager_.get(), event_log); | 362 channel_manager_.get(), event_log); |
367 } | 363 } |
368 | 364 |
369 cricket::TransportController* PeerConnectionFactory::CreateTransportController( | 365 cricket::TransportController* PeerConnectionFactory::CreateTransportController( |
370 cricket::PortAllocator* port_allocator, | 366 cricket::PortAllocator* port_allocator, |
371 bool redetermine_role_on_ice_restart) { | 367 bool redetermine_role_on_ice_restart) { |
372 RTC_DCHECK(signaling_thread_->IsCurrent()); | 368 RTC_DCHECK(signaling_thread_->IsCurrent()); |
373 return new cricket::TransportController(signaling_thread_, network_thread_, | 369 return new cricket::TransportController( |
374 port_allocator, | 370 signaling_thread_, network_thread_, port_allocator, |
375 redetermine_role_on_ice_restart); | 371 redetermine_role_on_ice_restart, options_.crypto_options); |
376 } | 372 } |
377 | 373 |
378 rtc::Thread* PeerConnectionFactory::signaling_thread() { | 374 rtc::Thread* PeerConnectionFactory::signaling_thread() { |
379 // This method can be called on a different thread when the factory is | 375 // This method can be called on a different thread when the factory is |
380 // created in CreatePeerConnectionFactory(). | 376 // created in CreatePeerConnectionFactory(). |
381 return signaling_thread_; | 377 return signaling_thread_; |
382 } | 378 } |
383 | 379 |
384 rtc::Thread* PeerConnectionFactory::worker_thread() { | 380 rtc::Thread* PeerConnectionFactory::worker_thread() { |
385 RTC_DCHECK(signaling_thread_->IsCurrent()); | 381 RTC_DCHECK(signaling_thread_->IsCurrent()); |
386 return worker_thread_; | 382 return worker_thread_; |
387 } | 383 } |
388 | 384 |
389 rtc::Thread* PeerConnectionFactory::network_thread() { | 385 rtc::Thread* PeerConnectionFactory::network_thread() { |
390 return network_thread_; | 386 return network_thread_; |
391 } | 387 } |
392 | 388 |
393 std::unique_ptr<cricket::MediaEngineInterface> | 389 std::unique_ptr<cricket::MediaEngineInterface> |
394 PeerConnectionFactory::CreateMediaEngine_w() { | 390 PeerConnectionFactory::CreateMediaEngine_w() { |
395 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); | 391 RTC_DCHECK(worker_thread_ == rtc::Thread::Current()); |
396 return std::unique_ptr<cricket::MediaEngineInterface>( | 392 return std::unique_ptr<cricket::MediaEngineInterface>( |
397 cricket::WebRtcMediaEngineFactory::Create( | 393 cricket::WebRtcMediaEngineFactory::Create( |
398 default_adm_.get(), audio_decoder_factory_, | 394 default_adm_.get(), audio_decoder_factory_, |
399 video_encoder_factory_.get(), video_decoder_factory_.get(), | 395 video_encoder_factory_.get(), video_decoder_factory_.get(), |
400 external_audio_mixer_)); | 396 external_audio_mixer_)); |
401 } | 397 } |
402 | 398 |
403 } // namespace webrtc | 399 } // namespace webrtc |
OLD | NEW |