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

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

Issue 1273363005: Add send transports to individual webrtc::Call streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase+comment Created 5 years, 3 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 | « webrtc/video/bitrate_estimator_tests.cc ('k') | webrtc/video/call_perf_tests.cc » ('j') | no next file with comments »
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 volatile int next_channel_id_; 118 volatile int next_channel_id_;
119 Call::Config config_; 119 Call::Config config_;
120 120
121 // 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
122 // 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
123 // and receivers. 123 // and receivers.
124 rtc::CriticalSection network_enabled_crit_; 124 rtc::CriticalSection network_enabled_crit_;
125 bool network_enabled_ GUARDED_BY(network_enabled_crit_); 125 bool network_enabled_ GUARDED_BY(network_enabled_crit_);
126 TransportAdapter transport_adapter_;
127 126
128 rtc::scoped_ptr<RWLockWrapper> receive_crit_; 127 rtc::scoped_ptr<RWLockWrapper> receive_crit_;
129 std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_ 128 std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_
130 GUARDED_BY(receive_crit_); 129 GUARDED_BY(receive_crit_);
131 std::map<uint32_t, VideoReceiveStream*> video_receive_ssrcs_ 130 std::map<uint32_t, VideoReceiveStream*> video_receive_ssrcs_
132 GUARDED_BY(receive_crit_); 131 GUARDED_BY(receive_crit_);
133 std::set<VideoReceiveStream*> video_receive_streams_ 132 std::set<VideoReceiveStream*> video_receive_streams_
134 GUARDED_BY(receive_crit_); 133 GUARDED_BY(receive_crit_);
135 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ 134 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_
136 GUARDED_BY(receive_crit_); 135 GUARDED_BY(receive_crit_);
(...skipping 16 matching lines...) Expand all
153 152
154 namespace internal { 153 namespace internal {
155 154
156 Call::Call(const Call::Config& config) 155 Call::Call(const Call::Config& config)
157 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()), 156 : num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
158 module_process_thread_(ProcessThread::Create()), 157 module_process_thread_(ProcessThread::Create()),
159 channel_group_(new ChannelGroup(module_process_thread_.get())), 158 channel_group_(new ChannelGroup(module_process_thread_.get())),
160 next_channel_id_(0), 159 next_channel_id_(0),
161 config_(config), 160 config_(config),
162 network_enabled_(true), 161 network_enabled_(true),
163 transport_adapter_(nullptr),
164 receive_crit_(RWLockWrapper::CreateRWLock()), 162 receive_crit_(RWLockWrapper::CreateRWLock()),
165 send_crit_(RWLockWrapper::CreateRWLock()) { 163 send_crit_(RWLockWrapper::CreateRWLock()) {
166 DCHECK(config.send_transport != nullptr);
167
168 DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 164 DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
169 DCHECK_GE(config.bitrate_config.start_bitrate_bps, 165 DCHECK_GE(config.bitrate_config.start_bitrate_bps,
170 config.bitrate_config.min_bitrate_bps); 166 config.bitrate_config.min_bitrate_bps);
171 if (config.bitrate_config.max_bitrate_bps != -1) { 167 if (config.bitrate_config.max_bitrate_bps != -1) {
172 DCHECK_GE(config.bitrate_config.max_bitrate_bps, 168 DCHECK_GE(config.bitrate_config.max_bitrate_bps,
173 config.bitrate_config.start_bitrate_bps); 169 config.bitrate_config.start_bitrate_bps);
174 } 170 }
175 171
176 Trace::CreateTrace(); 172 Trace::CreateTrace();
177 module_process_thread_->Start(); 173 module_process_thread_->Start();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 webrtc::VideoSendStream* Call::CreateVideoSendStream( 242 webrtc::VideoSendStream* Call::CreateVideoSendStream(
247 const webrtc::VideoSendStream::Config& config, 243 const webrtc::VideoSendStream::Config& config,
248 const VideoEncoderConfig& encoder_config) { 244 const VideoEncoderConfig& encoder_config) {
249 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream"); 245 TRACE_EVENT0("webrtc", "Call::CreateVideoSendStream");
250 LOG(LS_INFO) << "CreateVideoSendStream: " << config.ToString(); 246 LOG(LS_INFO) << "CreateVideoSendStream: " << config.ToString();
251 DCHECK(!config.rtp.ssrcs.empty()); 247 DCHECK(!config.rtp.ssrcs.empty());
252 248
253 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if 249 // TODO(mflodman): Base the start bitrate on a current bandwidth estimate, if
254 // the call has already started. 250 // the call has already started.
255 VideoSendStream* send_stream = new VideoSendStream( 251 VideoSendStream* send_stream = new VideoSendStream(
256 config_.send_transport, overuse_observer_proxy_.get(), num_cpu_cores_, 252 overuse_observer_proxy_.get(), num_cpu_cores_,
257 module_process_thread_.get(), channel_group_.get(), 253 module_process_thread_.get(), channel_group_.get(),
258 rtc::AtomicOps::Increment(&next_channel_id_), config, encoder_config, 254 rtc::AtomicOps::Increment(&next_channel_id_), config, encoder_config,
259 suspended_video_send_ssrcs_); 255 suspended_video_send_ssrcs_);
260 256
261 // This needs to be taken before send_crit_ as both locks need to be held 257 // This needs to be taken before send_crit_ as both locks need to be held
262 // while changing network state. 258 // while changing network state.
263 rtc::CritScope lock(&network_enabled_crit_); 259 rtc::CritScope lock(&network_enabled_crit_);
264 WriteLockScoped write_lock(*send_crit_); 260 WriteLockScoped write_lock(*send_crit_);
265 for (uint32_t ssrc : config.rtp.ssrcs) { 261 for (uint32_t ssrc : config.rtp.ssrcs) {
266 DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end()); 262 DCHECK(video_send_ssrcs_.find(ssrc) == video_send_ssrcs_.end());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 delete send_stream_impl; 302 delete send_stream_impl;
307 } 303 }
308 304
309 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream( 305 webrtc::VideoReceiveStream* Call::CreateVideoReceiveStream(
310 const webrtc::VideoReceiveStream::Config& config) { 306 const webrtc::VideoReceiveStream::Config& config) {
311 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream"); 307 TRACE_EVENT0("webrtc", "Call::CreateVideoReceiveStream");
312 LOG(LS_INFO) << "CreateVideoReceiveStream: " << config.ToString(); 308 LOG(LS_INFO) << "CreateVideoReceiveStream: " << config.ToString();
313 VideoReceiveStream* receive_stream = new VideoReceiveStream( 309 VideoReceiveStream* receive_stream = new VideoReceiveStream(
314 num_cpu_cores_, channel_group_.get(), 310 num_cpu_cores_, channel_group_.get(),
315 rtc::AtomicOps::Increment(&next_channel_id_), config, 311 rtc::AtomicOps::Increment(&next_channel_id_), config,
316 config_.send_transport, config_.voice_engine); 312 config_.voice_engine);
317 313
318 // This needs to be taken before receive_crit_ as both locks need to be held 314 // This needs to be taken before receive_crit_ as both locks need to be held
319 // while changing network state. 315 // while changing network state.
320 rtc::CritScope lock(&network_enabled_crit_); 316 rtc::CritScope lock(&network_enabled_crit_);
321 WriteLockScoped write_lock(*receive_crit_); 317 WriteLockScoped write_lock(*receive_crit_);
322 DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) == 318 DCHECK(video_receive_ssrcs_.find(config.rtp.remote_ssrc) ==
323 video_receive_ssrcs_.end()); 319 video_receive_ssrcs_.end());
324 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream; 320 video_receive_ssrcs_[config.rtp.remote_ssrc] = receive_stream;
325 // TODO(pbos): Configure different RTX payloads per receive payload. 321 // TODO(pbos): Configure different RTX payloads per receive payload.
326 VideoReceiveStream::Config::Rtp::RtxMap::const_iterator it = 322 VideoReceiveStream::Config::Rtp::RtxMap::const_iterator it =
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 const uint8_t* packet, 536 const uint8_t* packet,
541 size_t length) { 537 size_t length) {
542 if (RtpHeaderParser::IsRtcp(packet, length)) 538 if (RtpHeaderParser::IsRtcp(packet, length))
543 return DeliverRtcp(media_type, packet, length); 539 return DeliverRtcp(media_type, packet, length);
544 540
545 return DeliverRtp(media_type, packet, length); 541 return DeliverRtp(media_type, packet, length);
546 } 542 }
547 543
548 } // namespace internal 544 } // namespace internal
549 } // namespace webrtc 545 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/bitrate_estimator_tests.cc ('k') | webrtc/video/call_perf_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698