| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 29 matching lines...) Expand all Loading... |
| 40 channel_manager_->media_engine())); | 40 channel_manager_->media_engine())); |
| 41 } | 41 } |
| 42 ~MediaController() override { | 42 ~MediaController() override { |
| 43 Close(); | 43 Close(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // webrtc::MediaControllerInterface implementation. | 46 // webrtc::MediaControllerInterface implementation. |
| 47 void Close() override { | 47 void Close() override { |
| 48 worker_thread_->Invoke<void>(rtc::Bind(&MediaController::Close_w, this)); | 48 worker_thread_->Invoke<void>(rtc::Bind(&MediaController::Close_w, this)); |
| 49 } | 49 } |
| 50 webrtc::Call* call_w() override { | 50 webrtc::Call* call() override { |
| 51 RTC_DCHECK(worker_thread_->IsCurrent()); | 51 RTC_DCHECK(call_); |
| 52 if (!call_) { | |
| 53 call_.reset(webrtc::Call::Create(call_config_)); | |
| 54 } | |
| 55 return call_.get(); | 52 return call_.get(); |
| 56 } | 53 } |
| 57 cricket::ChannelManager* channel_manager() const override { | 54 cricket::ChannelManager* channel_manager() const override { |
| 58 return channel_manager_; | 55 return channel_manager_; |
| 59 } | 56 } |
| 60 const cricket::MediaConfig& config() const override { return media_config_; } | 57 const cricket::MediaConfig& config() const override { return media_config_; } |
| 61 | 58 |
| 62 private: | 59 private: |
| 63 void Construct_w(cricket::MediaEngineInterface* media_engine) { | 60 void Construct_w(cricket::MediaEngineInterface* media_engine) { |
| 64 RTC_DCHECK(worker_thread_->IsCurrent()); | 61 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 65 RTC_DCHECK(media_engine); | 62 RTC_DCHECK(media_engine); |
| 66 call_config_.audio_state = media_engine->GetAudioState(); | 63 call_config_.audio_state = media_engine->GetAudioState(); |
| 67 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 64 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
| 68 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 65 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
| 69 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 66 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
| 67 call_.reset(webrtc::Call::Create(call_config_)); |
| 70 } | 68 } |
| 71 void Close_w() { | 69 void Close_w() { |
| 72 RTC_DCHECK(worker_thread_->IsCurrent()); | 70 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 73 call_.reset(); | 71 call_.reset(); |
| 74 } | 72 } |
| 75 | 73 |
| 76 rtc::Thread* const worker_thread_; | 74 rtc::Thread* const worker_thread_; |
| 77 const cricket::MediaConfig media_config_; | 75 const cricket::MediaConfig media_config_; |
| 78 cricket::ChannelManager* const channel_manager_; | 76 cricket::ChannelManager* const channel_manager_; |
| 79 webrtc::Call::Config call_config_; | 77 webrtc::Call::Config call_config_; |
| 80 std::unique_ptr<webrtc::Call> call_; | 78 std::unique_ptr<webrtc::Call> call_; |
| 81 | 79 |
| 82 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); | 80 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); |
| 83 }; | 81 }; |
| 84 } // namespace { | 82 } // namespace { |
| 85 | 83 |
| 86 namespace webrtc { | 84 namespace webrtc { |
| 87 | 85 |
| 88 MediaControllerInterface* MediaControllerInterface::Create( | 86 MediaControllerInterface* MediaControllerInterface::Create( |
| 89 const cricket::MediaConfig& config, | 87 const cricket::MediaConfig& config, |
| 90 rtc::Thread* worker_thread, | 88 rtc::Thread* worker_thread, |
| 91 cricket::ChannelManager* channel_manager) { | 89 cricket::ChannelManager* channel_manager) { |
| 92 return new MediaController(config, worker_thread, channel_manager); | 90 return new MediaController(config, worker_thread, channel_manager); |
| 93 } | 91 } |
| 94 } // namespace webrtc | 92 } // namespace webrtc |
| OLD | NEW |