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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 Close(); | 46 Close(); |
47 } | 47 } |
48 | 48 |
49 // webrtc::MediaControllerInterface implementation. | 49 // webrtc::MediaControllerInterface implementation. |
50 void Close() override { | 50 void Close() override { |
51 worker_thread_->Invoke<void>(RTC_FROM_HERE, | 51 worker_thread_->Invoke<void>(RTC_FROM_HERE, |
52 rtc::Bind(&MediaController::Close_w, this)); | 52 rtc::Bind(&MediaController::Close_w, this)); |
53 } | 53 } |
54 webrtc::Call* call_w() override { | 54 webrtc::Call* call_w() override { |
55 RTC_DCHECK(worker_thread_->IsCurrent()); | 55 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 56 #ifdef HAVE_MEDIA |
56 if (!call_) { | 57 if (!call_) { |
57 call_.reset(webrtc::Call::Create(call_config_)); | 58 call_.reset(webrtc::Call::Create(call_config_)); |
58 } | 59 } |
| 60 #endif |
59 return call_.get(); | 61 return call_.get(); |
60 } | 62 } |
61 cricket::ChannelManager* channel_manager() const override { | 63 cricket::ChannelManager* channel_manager() const override { |
62 return channel_manager_; | 64 return channel_manager_; |
63 } | 65 } |
64 const cricket::MediaConfig& config() const override { return media_config_; } | 66 const cricket::MediaConfig& config() const override { return media_config_; } |
65 | 67 |
66 private: | 68 private: |
67 void Construct_w(cricket::MediaEngineInterface* media_engine) { | 69 void Construct_w(cricket::MediaEngineInterface* media_engine) { |
68 RTC_DCHECK(worker_thread_->IsCurrent()); | 70 RTC_DCHECK(worker_thread_->IsCurrent()); |
| 71 #ifdef HAVE_MEDIA |
69 RTC_DCHECK(media_engine); | 72 RTC_DCHECK(media_engine); |
70 call_config_.audio_state = media_engine->GetAudioState(); | 73 call_config_.audio_state = media_engine->GetAudioState(); |
| 74 #endif |
71 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; | 75 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; |
72 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; | 76 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; |
73 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; | 77 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; |
74 } | 78 } |
75 void Close_w() { | 79 void Close_w() { |
76 RTC_DCHECK(worker_thread_->IsCurrent()); | 80 RTC_DCHECK(worker_thread_->IsCurrent()); |
77 call_.reset(); | 81 call_.reset(); |
78 } | 82 } |
79 | 83 |
80 rtc::Thread* const worker_thread_; | 84 rtc::Thread* const worker_thread_; |
81 const cricket::MediaConfig media_config_; | 85 const cricket::MediaConfig media_config_; |
82 cricket::ChannelManager* const channel_manager_; | 86 cricket::ChannelManager* const channel_manager_; |
83 webrtc::Call::Config call_config_; | 87 webrtc::Call::Config call_config_; |
84 std::unique_ptr<webrtc::Call> call_; | 88 std::unique_ptr<webrtc::Call> call_; |
85 | 89 |
86 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); | 90 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); |
87 }; | 91 }; |
88 } // namespace { | 92 } // namespace { |
89 | 93 |
90 namespace webrtc { | 94 namespace webrtc { |
91 | 95 |
92 MediaControllerInterface* MediaControllerInterface::Create( | 96 MediaControllerInterface* MediaControllerInterface::Create( |
93 const cricket::MediaConfig& config, | 97 const cricket::MediaConfig& config, |
94 rtc::Thread* worker_thread, | 98 rtc::Thread* worker_thread, |
95 cricket::ChannelManager* channel_manager, | 99 cricket::ChannelManager* channel_manager, |
96 webrtc::RtcEventLog* event_log) { | 100 webrtc::RtcEventLog* event_log) { |
97 return new MediaController(config, worker_thread, channel_manager, event_log); | 101 return new MediaController(config, worker_thread, channel_manager, event_log); |
98 } | 102 } |
99 } // namespace webrtc | 103 } // namespace webrtc |
OLD | NEW |