| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 const int kMinBandwidthBps = 30000; | 24 const int kMinBandwidthBps = 30000; |
| 25 const int kStartBandwidthBps = 300000; | 25 const int kStartBandwidthBps = 300000; |
| 26 const int kMaxBandwidthBps = 2000000; | 26 const int kMaxBandwidthBps = 2000000; |
| 27 | 27 |
| 28 class MediaController : public webrtc::MediaControllerInterface, | 28 class MediaController : public webrtc::MediaControllerInterface, |
| 29 public sigslot::has_slots<> { | 29 public sigslot::has_slots<> { |
| 30 public: | 30 public: |
| 31 MediaController(const cricket::MediaConfig& media_config, | 31 MediaController(const cricket::MediaConfig& media_config, |
| 32 rtc::Thread* worker_thread, | 32 rtc::Thread* worker_thread, |
| 33 cricket::ChannelManager* channel_manager) | 33 cricket::ChannelManager* channel_manager, |
| 34 webrtc::RtcEventLog* event_log) |
| 34 : worker_thread_(worker_thread), | 35 : worker_thread_(worker_thread), |
| 35 media_config_(media_config), | 36 media_config_(media_config), |
| 36 channel_manager_(channel_manager) { | 37 channel_manager_(channel_manager), |
| 38 event_log_(event_log) { |
| 37 RTC_DCHECK(worker_thread); | 39 RTC_DCHECK(worker_thread); |
| 38 worker_thread_->Invoke<void>(RTC_FROM_HERE, | 40 worker_thread_->Invoke<void>(RTC_FROM_HERE, |
| 39 rtc::Bind(&MediaController::Construct_w, this, | 41 rtc::Bind(&MediaController::Construct_w, this, |
| 40 channel_manager_->media_engine())); | 42 channel_manager_->media_engine())); |
| 41 } | 43 } |
| 42 ~MediaController() override { | 44 ~MediaController() override { |
| 43 Close(); | 45 Close(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 // webrtc::MediaControllerInterface implementation. | 48 // webrtc::MediaControllerInterface implementation. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 const cricket::MediaConfig& config() const override { return media_config_; } | 63 const cricket::MediaConfig& config() const override { return media_config_; } |
| 62 | 64 |
| 63 private: | 65 private: |
| 64 void Construct_w(cricket::MediaEngineInterface* media_engine) { | 66 void Construct_w(cricket::MediaEngineInterface* media_engine) { |
| 65 RTC_DCHECK(worker_thread_->IsCurrent()); | 67 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 66 RTC_DCHECK(media_engine); | 68 RTC_DCHECK(media_engine); |
| 67 call_config_.audio_state = media_engine->GetAudioState(); | 69 call_config_.audio_state = media_engine->GetAudioState(); |
| 68 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 70 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
| 69 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 71 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
| 70 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 72 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
| 73 call_config_.event_log = event_log_; |
| 71 } | 74 } |
| 72 void Close_w() { | 75 void Close_w() { |
| 73 RTC_DCHECK(worker_thread_->IsCurrent()); | 76 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 74 call_.reset(); | 77 call_.reset(); |
| 75 } | 78 } |
| 76 | 79 |
| 77 rtc::Thread* const worker_thread_; | 80 rtc::Thread* const worker_thread_; |
| 78 const cricket::MediaConfig media_config_; | 81 const cricket::MediaConfig media_config_; |
| 79 cricket::ChannelManager* const channel_manager_; | 82 cricket::ChannelManager* const channel_manager_; |
| 83 webrtc::RtcEventLog* const event_log_; |
| 80 webrtc::Call::Config call_config_; | 84 webrtc::Call::Config call_config_; |
| 81 std::unique_ptr<webrtc::Call> call_; | 85 std::unique_ptr<webrtc::Call> call_; |
| 82 | 86 |
| 83 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); | 87 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); |
| 84 }; | 88 }; |
| 85 } // namespace { | 89 } // namespace { |
| 86 | 90 |
| 87 namespace webrtc { | 91 namespace webrtc { |
| 88 | 92 |
| 89 MediaControllerInterface* MediaControllerInterface::Create( | 93 MediaControllerInterface* MediaControllerInterface::Create( |
| 90 const cricket::MediaConfig& config, | 94 const cricket::MediaConfig& config, |
| 91 rtc::Thread* worker_thread, | 95 rtc::Thread* worker_thread, |
| 92 cricket::ChannelManager* channel_manager) { | 96 cricket::ChannelManager* channel_manager, |
| 93 return new MediaController(config, worker_thread, channel_manager); | 97 webrtc::RtcEventLog* event_log) { |
| 98 return new MediaController(config, worker_thread, channel_manager, event_log); |
| 94 } | 99 } |
| 95 } // namespace webrtc | 100 } // namespace webrtc |
| OLD | NEW |