Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: webrtc/pc/mediacontroller.cc

Issue 2854123003: Build WebRTC with data channel only. (Closed)
Patch Set: Address the comments. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
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 webrtc::RtcEventLog* event_log)
35 : worker_thread_(worker_thread), 35 : worker_thread_(worker_thread),
36 media_config_(media_config), 36 media_config_(media_config),
37 channel_manager_(channel_manager), 37 channel_manager_(channel_manager),
38 call_config_(event_log) { 38 call_config_(event_log) {
39 RTC_DCHECK(worker_thread); 39 RTC_DCHECK(worker_thread);
40 #ifdef HAVE_MEDIA
40 RTC_DCHECK(event_log); 41 RTC_DCHECK(event_log);
42 #endif
41 worker_thread_->Invoke<void>(RTC_FROM_HERE, 43 worker_thread_->Invoke<void>(RTC_FROM_HERE,
42 rtc::Bind(&MediaController::Construct_w, this, 44 rtc::Bind(&MediaController::Construct_w, this,
43 channel_manager_->media_engine())); 45 channel_manager_->media_engine()));
44 } 46 }
45 ~MediaController() override { 47 ~MediaController() override {
46 Close(); 48 Close();
47 } 49 }
48 50
49 // webrtc::MediaControllerInterface implementation. 51 // webrtc::MediaControllerInterface implementation.
50 void Close() override { 52 void Close() override {
51 worker_thread_->Invoke<void>(RTC_FROM_HERE, 53 worker_thread_->Invoke<void>(RTC_FROM_HERE,
52 rtc::Bind(&MediaController::Close_w, this)); 54 rtc::Bind(&MediaController::Close_w, this));
53 } 55 }
54 webrtc::Call* call_w() override { 56 webrtc::Call* call_w() override {
55 RTC_DCHECK(worker_thread_->IsCurrent()); 57 RTC_DCHECK(worker_thread_->IsCurrent());
58 #ifdef HAVE_MEDIA
56 if (!call_) { 59 if (!call_) {
57 call_.reset(webrtc::Call::Create(call_config_)); 60 call_.reset(webrtc::Call::Create(call_config_));
58 } 61 }
62 #endif
59 return call_.get(); 63 return call_.get();
60 } 64 }
61 cricket::ChannelManager* channel_manager() const override { 65 cricket::ChannelManager* channel_manager() const override {
62 return channel_manager_; 66 return channel_manager_;
63 } 67 }
64 const cricket::MediaConfig& config() const override { return media_config_; } 68 const cricket::MediaConfig& config() const override { return media_config_; }
65 69
66 private: 70 private:
67 void Construct_w(cricket::MediaEngineInterface* media_engine) { 71 void Construct_w(cricket::MediaEngineInterface* media_engine) {
68 RTC_DCHECK(worker_thread_->IsCurrent()); 72 RTC_DCHECK(worker_thread_->IsCurrent());
73 #ifdef HAVE_MEDIA
69 RTC_DCHECK(media_engine); 74 RTC_DCHECK(media_engine);
70 call_config_.audio_state = media_engine->GetAudioState(); 75 call_config_.audio_state = media_engine->GetAudioState();
76 #endif
71 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps; 77 call_config_.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
72 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps; 78 call_config_.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
73 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps; 79 call_config_.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
74 } 80 }
75 void Close_w() { 81 void Close_w() {
76 RTC_DCHECK(worker_thread_->IsCurrent()); 82 RTC_DCHECK(worker_thread_->IsCurrent());
77 call_.reset(); 83 call_.reset();
78 } 84 }
79 85
80 rtc::Thread* const worker_thread_; 86 rtc::Thread* const worker_thread_;
81 const cricket::MediaConfig media_config_; 87 const cricket::MediaConfig media_config_;
82 cricket::ChannelManager* const channel_manager_; 88 cricket::ChannelManager* const channel_manager_;
83 webrtc::Call::Config call_config_; 89 webrtc::Call::Config call_config_;
84 std::unique_ptr<webrtc::Call> call_; 90 std::unique_ptr<webrtc::Call> call_;
85 91
86 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController); 92 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MediaController);
87 }; 93 };
88 } // namespace { 94 } // namespace {
89 95
90 namespace webrtc { 96 namespace webrtc {
91 97
92 MediaControllerInterface* MediaControllerInterface::Create( 98 MediaControllerInterface* MediaControllerInterface::Create(
93 const cricket::MediaConfig& config, 99 const cricket::MediaConfig& config,
94 rtc::Thread* worker_thread, 100 rtc::Thread* worker_thread,
95 cricket::ChannelManager* channel_manager, 101 cricket::ChannelManager* channel_manager,
96 webrtc::RtcEventLog* event_log) { 102 webrtc::RtcEventLog* event_log) {
97 return new MediaController(config, worker_thread, channel_manager, event_log); 103 return new MediaController(config, worker_thread, channel_manager, event_log);
98 } 104 }
99 } // namespace webrtc 105 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698