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

Side by Side Diff: webrtc/video/call.cc

Issue 1251163002: Remove base channel for video receivers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix data race Created 5 years, 5 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
« no previous file with comments | « no previous file | webrtc/video/video_receive_stream.h » ('j') | webrtc/video_engine/vie_channel.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 void SetBitrateControllerConfig( 109 void SetBitrateControllerConfig(
110 const webrtc::Call::Config::BitrateConfig& bitrate_config); 110 const webrtc::Call::Config::BitrateConfig& bitrate_config);
111 111
112 void ConfigureSync(const std::string& sync_group) 112 void ConfigureSync(const std::string& sync_group)
113 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); 113 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_);
114 114
115 const int num_cpu_cores_; 115 const int num_cpu_cores_;
116 const rtc::scoped_ptr<ProcessThread> module_process_thread_; 116 const rtc::scoped_ptr<ProcessThread> module_process_thread_;
117 const rtc::scoped_ptr<ChannelGroup> channel_group_; 117 const rtc::scoped_ptr<ChannelGroup> channel_group_;
118 const int base_channel_id_;
119 volatile int next_channel_id_; 118 volatile int next_channel_id_;
120 Call::Config config_; 119 Call::Config config_;
121 120
122 // Needs to be held while write-locking |receive_crit_| or |send_crit_|. This 121 // Needs to be held while write-locking |receive_crit_| or |send_crit_|. This
123 // ensures that we have a consistent network state signalled to all senders 122 // ensures that we have a consistent network state signalled to all senders
124 // and receivers. 123 // and receivers.
125 rtc::CriticalSection network_enabled_crit_; 124 rtc::CriticalSection network_enabled_crit_;
126 bool network_enabled_ GUARDED_BY(network_enabled_crit_); 125 bool network_enabled_ GUARDED_BY(network_enabled_crit_);
127 TransportAdapter transport_adapter_; 126 TransportAdapter transport_adapter_;
128 127
(...skipping 22 matching lines...) Expand all
151 Call* Call::Create(const Call::Config& config) { 150 Call* Call::Create(const Call::Config& config) {
152 return new internal::Call(config); 151 return new internal::Call(config);
153 } 152 }
154 153
155 namespace internal { 154 namespace internal {
156 155
157 Call::Call(const Call::Config& config) 156 Call::Call(const Call::Config& config)
158 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 157 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
159 module_process_thread_(ProcessThread::Create()), 158 module_process_thread_(ProcessThread::Create()),
160 channel_group_(new ChannelGroup(module_process_thread_.get())), 159 channel_group_(new ChannelGroup(module_process_thread_.get())),
161 base_channel_id_(0), 160 next_channel_id_(0),
162 next_channel_id_(base_channel_id_ + 1),
163 config_(config), 161 config_(config),
164 network_enabled_(true), 162 network_enabled_(true),
165 transport_adapter_(nullptr), 163 transport_adapter_(nullptr),
166 receive_crit_(RWLockWrapper::CreateRWLock()), 164 receive_crit_(RWLockWrapper::CreateRWLock()),
167 send_crit_(RWLockWrapper::CreateRWLock()) { 165 send_crit_(RWLockWrapper::CreateRWLock()) {
168 DCHECK(config.send_transport != nullptr); 166 DCHECK(config.send_transport != nullptr);
169 167
170 DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 168 DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
171 DCHECK_GE(config.bitrate_config.start_bitrate_bps, 169 DCHECK_GE(config.bitrate_config.start_bitrate_bps,
172 config.bitrate_config.min_bitrate_bps); 170 config.bitrate_config.min_bitrate_bps);
173 if (config.bitrate_config.max_bitrate_bps != -1) { 171 if (config.bitrate_config.max_bitrate_bps != -1) {
174 DCHECK_GE(config.bitrate_config.max_bitrate_bps, 172 DCHECK_GE(config.bitrate_config.max_bitrate_bps,
175 config.bitrate_config.start_bitrate_bps); 173 config.bitrate_config.start_bitrate_bps);
176 } 174 }
177 175
178 Trace::CreateTrace(); 176 Trace::CreateTrace();
179 module_process_thread_->Start(); 177 module_process_thread_->Start();
180 178
181 // TODO(pbos): Remove base channel when CreateReceiveChannel no longer
182 // requires one.
183 CHECK(channel_group_->CreateSendChannel(base_channel_id_, 0,
184 &transport_adapter_, num_cpu_cores_,
185 std::vector<uint32_t>(), true));
186
187 if (config.overuse_callback) { 179 if (config.overuse_callback) {
188 overuse_observer_proxy_.reset( 180 overuse_observer_proxy_.reset(
189 new CpuOveruseObserverProxy(config.overuse_callback)); 181 new CpuOveruseObserverProxy(config.overuse_callback));
190 } 182 }
191 183
192 SetBitrateControllerConfig(config_.bitrate_config); 184 SetBitrateControllerConfig(config_.bitrate_config);
193 } 185 }
194 186
195 Call::~Call() { 187 Call::~Call() {
196 CHECK_EQ(0u, video_send_ssrcs_.size()); 188 CHECK_EQ(0u, video_send_ssrcs_.size());
197 CHECK_EQ(0u, video_send_streams_.size()); 189 CHECK_EQ(0u, video_send_streams_.size());
198 CHECK_EQ(0u, audio_receive_ssrcs_.size()); 190 CHECK_EQ(0u, audio_receive_ssrcs_.size());
199 CHECK_EQ(0u, video_receive_ssrcs_.size()); 191 CHECK_EQ(0u, video_receive_ssrcs_.size());
200 CHECK_EQ(0u, video_receive_streams_.size()); 192 CHECK_EQ(0u, video_receive_streams_.size());
201 193
202 channel_group_->DeleteChannel(base_channel_id_);
203 module_process_thread_->Stop(); 194 module_process_thread_->Stop();
204 Trace::ReturnTrace(); 195 Trace::ReturnTrace();
205 } 196 }
206 197
207 PacketReceiver* Call::Receiver() { return this; } 198 PacketReceiver* Call::Receiver() { return this; }
208 199
209 webrtc::AudioSendStream* Call::CreateAudioSendStream( 200 webrtc::AudioSendStream* Call::CreateAudioSendStream(
210 const webrtc::AudioSendStream::Config& config) { 201 const webrtc::AudioSendStream::Config& config) {
211 return nullptr; 202 return nullptr;
212 } 203 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 304 }
314 305
315 delete send_stream_impl; 306 delete send_stream_impl;
316 } 307 }
317 308
318 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( 309 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
319 const webrtc::VideoReceiveStream::Config& config) { 310 const webrtc::VideoReceiveStream::Config& config) {
320 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); 311 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
321 LOG(LS_INFO) << "CreateVideoReceiveStream: " << config.ToString(); 312 LOG(LS_INFO) << "CreateVideoReceiveStream: " << config.ToString();
322 VideoReceiveStream* receive_stream = new VideoReceiveStream( 313 VideoReceiveStream* receive_stream = new VideoReceiveStream(
323 num_cpu_cores_, base_channel_id_, channel_group_.get(), 314 num_cpu_cores_, channel_group_.get(),
324 rtc::AtomicOps::Increment(&next_channel_id_), config, 315 rtc::AtomicOps::Increment(&next_channel_id_), config,
325 config_.send_transport, config_.voice_engine); 316 config_.send_transport, config_.voice_engine);
326 317
327 // This needs to be taken before receive_crit_ as both locks need to be held 318 // This needs to be taken before receive_crit_ as both locks need to be held
328 // while changing network state. 319 // while changing network state.
329 rtc::CritScope lock(&network_enabled_crit_); 320 rtc::CritScope lock(&network_enabled_crit_);
330 WriteLockScoped write_lock(*receive_crit_); 321 WriteLockScoped write_lock(*receive_crit_);
331 DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == 322 DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
332 video_receive_ssrcs_.end()); 323 video_receive_ssrcs_.end());
333 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 324 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 const uint8_t* packet, 540 const uint8_t* packet,
550 size_t length) { 541 size_t length) {
551 if (RtpHeaderParser::IsRtcp(packet, length)) 542 if (RtpHeaderParser::IsRtcp(packet, length))
552 return DeliverRtcp(media_type, packet, length); 543 return DeliverRtcp(media_type, packet, length);
553 544
554 return DeliverRtp(media_type, packet, length); 545 return DeliverRtp(media_type, packet, length);
555 } 546 }
556 547
557 } // namespace internal 548 } // namespace internal
558 } // namespace webrtc 549 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/video_receive_stream.h » ('j') | webrtc/video_engine/vie_channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698