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

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

Issue 1929313002: Removed all RTP dependencies from ViEChannel and renamed class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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 (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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 remb_(remb), 164 remb_(remb),
165 video_receiver_(clock_, nullptr, this, this, this), 165 video_receiver_(clock_, nullptr, this, this, this),
166 incoming_video_stream_(0, config.disable_prerenderer_smoothing), 166 incoming_video_stream_(0, config.disable_prerenderer_smoothing),
167 stats_proxy_(config_, clock_), 167 stats_proxy_(config_, clock_),
168 rtp_stream_receiver_(&video_receiver_, 168 rtp_stream_receiver_(&video_receiver_,
169 congestion_controller_->GetRemoteBitrateEstimator( 169 congestion_controller_->GetRemoteBitrateEstimator(
170 UseSendSideBwe(config_)), 170 UseSendSideBwe(config_)),
171 &transport_adapter_, 171 &transport_adapter_,
172 call_stats_->rtcp_rtt_stats(), 172 call_stats_->rtcp_rtt_stats(),
173 congestion_controller_->pacer(), 173 congestion_controller_->pacer(),
174 congestion_controller_->packet_router()), 174 congestion_controller_->packet_router(),
175 vie_channel_(&video_receiver_, 175 config,
176 &rtp_stream_receiver_), 176 &stats_proxy_,
pbos-webrtc 2016/05/02 00:59:02 Can you make the RtpStreamReceiver take a stats pr
mflodman 2016/05/02 19:01:27 Done.
177 &stats_proxy_,
178 &stats_proxy_),
179 video_stream_decoder_(&video_receiver_,
180 &rtp_stream_receiver_,
pbos-webrtc 2016/05/02 00:59:02 Same here, can this take rtp_stream_receiver_ as o
mflodman 2016/05/02 19:01:27 This will very likely change to be signalled to Vi
pbos-webrtc 2016/05/02 20:30:30 Gotcha, that's fine.
181 &rtp_stream_receiver_,
182 config.rtp.nack.rtp_history_ms > 0,
183 &stats_proxy_),
177 vie_sync_(&video_receiver_), 184 vie_sync_(&video_receiver_),
178 rtp_rtcp_(vie_channel_.rtp_rtcp()) { 185 rtp_rtcp_(rtp_stream_receiver_.rtp_rtcp()) {
179 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); 186 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
180 187
181 RTC_DCHECK(process_thread_); 188 RTC_DCHECK(process_thread_);
182 RTC_DCHECK(congestion_controller_); 189 RTC_DCHECK(congestion_controller_);
183 RTC_DCHECK(call_stats_); 190 RTC_DCHECK(call_stats_);
184 RTC_DCHECK(remb_); 191 RTC_DCHECK(remb_);
185 RTC_CHECK(vie_channel_.Init() == 0);
186
187 // Register the channel to receive stats updates.
188 call_stats_->RegisterStatsObserver(vie_channel_.GetStatsObserver());
189
190 // TODO(pbos): This is not fine grained enough...
191 vie_channel_.SetProtectionMode(config_.rtp.nack.rtp_history_ms > 0, false, -1,
192 -1);
193 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff) 192 RTC_DCHECK(config_.rtp.rtcp_mode != RtcpMode::kOff)
194 << "A stream should not be configured with RTCP disabled. This value is " 193 << "A stream should not be configured with RTCP disabled. This value is "
195 "reserved for internal usage."; 194 "reserved for internal usage.";
196 rtp_rtcp_->SetRTCPStatus(config_.rtp.rtcp_mode); 195
196 // Register the channel to receive stats updates.
197 call_stats_->RegisterStatsObserver(video_stream_decoder_.GetStatsObserver());
197 198
198 RTC_DCHECK(config_.rtp.remote_ssrc != 0); 199 RTC_DCHECK(config_.rtp.remote_ssrc != 0);
199 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams? 200 // TODO(pbos): What's an appropriate local_ssrc for receive-only streams?
200 RTC_DCHECK(config_.rtp.local_ssrc != 0); 201 RTC_DCHECK(config_.rtp.local_ssrc != 0);
201 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc); 202 RTC_DCHECK(config_.rtp.remote_ssrc != config_.rtp.local_ssrc);
202 rtp_rtcp_->SetSSRC(config_.rtp.local_ssrc); 203 rtp_rtcp_->SetSSRC(config_.rtp.local_ssrc);
203 204
204 // TODO(pbos): Support multiple RTX, per video payload. 205 // TODO(pbos): Support multiple RTX, per video payload.
205 for (const auto& kv : config_.rtp.rtx) { 206 for (const auto& kv : config_.rtp.rtx) {
206 RTC_DCHECK(kv.second.ssrc != 0); 207 RTC_DCHECK(kv.second.ssrc != 0);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 if (config_.rtp.fec.red_rtx_payload_type != -1) { 249 if (config_.rtp.fec.red_rtx_payload_type != -1) {
249 rtp_stream_receiver_.SetRtxPayloadType( 250 rtp_stream_receiver_.SetRtxPayloadType(
250 config_.rtp.fec.red_rtx_payload_type, 251 config_.rtp.fec.red_rtx_payload_type,
251 config_.rtp.fec.red_payload_type); 252 config_.rtp.fec.red_payload_type);
252 } 253 }
253 } 254 }
254 255
255 if (config.rtp.rtcp_xr.receiver_reference_time_report) 256 if (config.rtp.rtcp_xr.receiver_reference_time_report)
256 rtp_rtcp_->SetRtcpXrRrtrStatus(true); 257 rtp_rtcp_->SetRtcpXrRrtrStatus(true);
257 258
258 vie_channel_.RegisterReceiveStatisticsProxy(&stats_proxy_);
259 rtp_stream_receiver_.GetReceiveStatistics()->RegisterRtpStatisticsCallback(
260 &stats_proxy_);
261 rtp_stream_receiver_.GetReceiveStatistics()->RegisterRtcpStatisticsCallback(
262 &stats_proxy_);
263 // Stats callback for CNAME changes. 259 // Stats callback for CNAME changes.
264 rtp_rtcp_->RegisterRtcpStatisticsCallback(&stats_proxy_); 260 rtp_rtcp_->RegisterRtcpStatisticsCallback(&stats_proxy_);
265 vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_);
266 261
267 RTC_DCHECK(!config_.decoders.empty()); 262 RTC_DCHECK(!config_.decoders.empty());
268 std::set<int> decoder_payload_types; 263 std::set<int> decoder_payload_types;
269 for (const Decoder& decoder : config_.decoders) { 264 for (const Decoder& decoder : config_.decoders) {
270 RTC_CHECK(decoder.decoder); 265 RTC_CHECK(decoder.decoder);
271 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) == 266 RTC_CHECK(decoder_payload_types.find(decoder.payload_type) ==
272 decoder_payload_types.end()) 267 decoder_payload_types.end())
273 << "Duplicate payload type (" << decoder.payload_type 268 << "Duplicate payload type (" << decoder.payload_type
274 << ") for different decoders."; 269 << ") for different decoders.";
275 decoder_payload_types.insert(decoder.payload_type); 270 decoder_payload_types.insert(decoder.payload_type);
276 video_receiver_.RegisterExternalDecoder(decoder.decoder, 271 video_receiver_.RegisterExternalDecoder(decoder.decoder,
277 decoder.payload_type); 272 decoder.payload_type);
278 273
279 VideoCodec codec = CreateDecoderVideoCodec(decoder); 274 VideoCodec codec = CreateDecoderVideoCodec(decoder);
280 275
281 RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec)); 276 RTC_CHECK(rtp_stream_receiver_.SetReceiveCodec(codec));
282 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec( 277 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec(
283 &codec, num_cpu_cores, false)); 278 &codec, num_cpu_cores, false));
284 } 279 }
285 280
286 video_receiver_.SetRenderDelay(config.render_delay_ms); 281 video_receiver_.SetRenderDelay(config.render_delay_ms);
287 incoming_video_stream_.SetExpectedRenderDelay(config.render_delay_ms); 282 incoming_video_stream_.SetExpectedRenderDelay(config.render_delay_ms);
288 incoming_video_stream_.SetExternalCallback(this); 283 incoming_video_stream_.SetExternalCallback(this);
289 vie_channel_.SetIncomingVideoStream(&incoming_video_stream_); 284 video_stream_decoder_.SetIncomingVideoStream(&incoming_video_stream_);
290 vie_channel_.RegisterPreRenderCallback(this); 285 video_stream_decoder_.RegisterPreRenderCallback(this);
291 286
292 process_thread_->RegisterModule(rtp_stream_receiver_.GetReceiveStatistics()); 287 process_thread_->RegisterModule(rtp_stream_receiver_.GetReceiveStatistics());
293 process_thread_->RegisterModule(rtp_stream_receiver_.rtp_rtcp()); 288 process_thread_->RegisterModule(rtp_stream_receiver_.rtp_rtcp());
294 process_thread_->RegisterModule(&video_receiver_); 289 process_thread_->RegisterModule(&video_receiver_);
295 process_thread_->RegisterModule(&vie_sync_); 290 process_thread_->RegisterModule(&vie_sync_);
296 } 291 }
297 292
298 VideoReceiveStream::~VideoReceiveStream() { 293 VideoReceiveStream::~VideoReceiveStream() {
299 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString(); 294 LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
300 Stop(); 295 Stop();
301 296
302 process_thread_->DeRegisterModule(&vie_sync_); 297 process_thread_->DeRegisterModule(&vie_sync_);
303 process_thread_->DeRegisterModule(&video_receiver_); 298 process_thread_->DeRegisterModule(&video_receiver_);
304 process_thread_->DeRegisterModule(rtp_stream_receiver_.rtp_rtcp()); 299 process_thread_->DeRegisterModule(rtp_stream_receiver_.rtp_rtcp());
305 process_thread_->DeRegisterModule( 300 process_thread_->DeRegisterModule(
306 rtp_stream_receiver_.GetReceiveStatistics()); 301 rtp_stream_receiver_.GetReceiveStatistics());
307 302
308 // Deregister external decoders so that they are no longer running during 303 // Deregister external decoders so they are no longer running during
309 // destruction. This effectively stops the VCM since the decoder thread is 304 // destruction. This effectively stops the VCM since the decoder thread is
310 // stopped, the VCM is deregistered and no asynchronous decoder threads are 305 // stopped, the VCM is deregistered and no asynchronous decoder threads are
311 // running. 306 // running.
312 for (const Decoder& decoder : config_.decoders) 307 for (const Decoder& decoder : config_.decoders)
313 video_receiver_.RegisterExternalDecoder(nullptr, decoder.payload_type); 308 video_receiver_.RegisterExternalDecoder(nullptr, decoder.payload_type);
314 309
315 vie_channel_.RegisterPreRenderCallback(nullptr); 310 video_stream_decoder_.RegisterPreRenderCallback(nullptr);
316 311
317 call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver()); 312 call_stats_->DeregisterStatsObserver(
313 video_stream_decoder_.GetStatsObserver());
318 rtp_rtcp_->SetREMBStatus(false); 314 rtp_rtcp_->SetREMBStatus(false);
319 remb_->RemoveReceiveChannel(rtp_rtcp_); 315 remb_->RemoveReceiveChannel(rtp_rtcp_);
320 316
321 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config_)) 317 congestion_controller_->GetRemoteBitrateEstimator(UseSendSideBwe(config_))
322 ->RemoveStream(rtp_stream_receiver_.GetRemoteSsrc()); 318 ->RemoveStream(rtp_stream_receiver_.GetRemoteSsrc());
323 } 319 }
324 320
325 void VideoReceiveStream::Start() { 321 void VideoReceiveStream::Start() {
326 if (decode_thread_.IsRunning()) 322 if (decode_thread_.IsRunning())
327 return; 323 return;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 const std::vector<uint16_t>& sequence_numbers) { 436 const std::vector<uint16_t>& sequence_numbers) {
441 rtp_rtcp_->SendNack(sequence_numbers); 437 rtp_rtcp_->SendNack(sequence_numbers);
442 } 438 }
443 439
444 void VideoReceiveStream::RequestKeyFrame() { 440 void VideoReceiveStream::RequestKeyFrame() {
445 rtp_rtcp_->RequestKeyFrame(); 441 rtp_rtcp_->RequestKeyFrame();
446 } 442 }
447 443
448 } // namespace internal 444 } // namespace internal
449 } // namespace webrtc 445 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698