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