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

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

Issue 2649973005: Inform jitter buffer about FlexFEC protection. (Closed)
Patch Set: Rebase + git cl format. Created 3 years, 10 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/video_receive_stream.h ('k') | no next file » | 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 kDefaultStartBitrate; 179 kDefaultStartBitrate;
180 180
181 return codec; 181 return codec;
182 } 182 }
183 } // namespace 183 } // namespace
184 184
185 namespace internal { 185 namespace internal {
186 186
187 VideoReceiveStream::VideoReceiveStream( 187 VideoReceiveStream::VideoReceiveStream(
188 int num_cpu_cores, 188 int num_cpu_cores,
189 bool protected_by_flexfec,
189 CongestionController* congestion_controller, 190 CongestionController* congestion_controller,
190 PacketRouter* packet_router, 191 PacketRouter* packet_router,
191 VideoReceiveStream::Config config, 192 VideoReceiveStream::Config config,
192 webrtc::VoiceEngine* voice_engine, 193 webrtc::VoiceEngine* voice_engine,
193 ProcessThread* process_thread, 194 ProcessThread* process_thread,
194 CallStats* call_stats, 195 CallStats* call_stats,
195 VieRemb* remb) 196 VieRemb* remb)
196 : transport_adapter_(config.rtcp_send_transport), 197 : transport_adapter_(config.rtcp_send_transport),
197 config_(std::move(config)), 198 config_(std::move(config)),
198 num_cpu_cores_(num_cpu_cores), 199 num_cpu_cores_(num_cpu_cores),
200 protected_by_flexfec_(protected_by_flexfec),
199 process_thread_(process_thread), 201 process_thread_(process_thread),
200 clock_(Clock::GetRealTimeClock()), 202 clock_(Clock::GetRealTimeClock()),
201 decode_thread_(DecodeThreadFunction, this, "DecodingThread"), 203 decode_thread_(DecodeThreadFunction, this, "DecodingThread"),
202 congestion_controller_(congestion_controller), 204 congestion_controller_(congestion_controller),
203 call_stats_(call_stats), 205 call_stats_(call_stats),
204 timing_(new VCMTiming(clock_)), 206 timing_(new VCMTiming(clock_)),
205 video_receiver_(clock_, nullptr, this, timing_.get(), this, this), 207 video_receiver_(clock_, nullptr, this, timing_.get(), this, this),
206 stats_proxy_(&config_, clock_), 208 stats_proxy_(&config_, clock_),
207 rtp_stream_receiver_( 209 rtp_stream_receiver_(&video_receiver_,
208 &video_receiver_, 210 congestion_controller_->GetRemoteBitrateEstimator(
209 congestion_controller_->GetRemoteBitrateEstimator( 211 UseSendSideBwe(config_)),
210 UseSendSideBwe(config_)), 212 &transport_adapter_,
211 &transport_adapter_, 213 call_stats_->rtcp_rtt_stats(),
212 call_stats_->rtcp_rtt_stats(), 214 packet_router,
213 packet_router, 215 remb,
214 remb, 216 &config_,
215 &config_, 217 &stats_proxy_,
216 &stats_proxy_, 218 process_thread_,
217 process_thread_, 219 this, // NackSender
218 this, // NackSender 220 this, // KeyFrameRequestSender
219 this, // KeyFrameRequestSender 221 this, // OnCompleteFrameCallback
220 this, // OnCompleteFrameCallback 222 timing_.get()),
221 timing_.get()),
222 rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_), 223 rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_),
223 jitter_buffer_experiment_( 224 jitter_buffer_experiment_(
224 field_trial::FindFullName("WebRTC-NewVideoJitterBuffer") == 225 field_trial::FindFullName("WebRTC-NewVideoJitterBuffer") ==
225 "Enabled") { 226 "Enabled") {
226 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString(); 227 LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
227 228
228 RTC_DCHECK(process_thread_); 229 RTC_DCHECK(process_thread_);
229 RTC_DCHECK(congestion_controller_); 230 RTC_DCHECK(congestion_controller_);
230 RTC_DCHECK(call_stats_); 231 RTC_DCHECK(call_stats_);
231 232
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 rtp_stream_sync_.ConfigureSync(audio_channel_id, voe_sync_interface); 291 rtp_stream_sync_.ConfigureSync(audio_channel_id, voe_sync_interface);
291 voe_sync_interface->Release(); 292 voe_sync_interface->Release();
292 } else { 293 } else {
293 rtp_stream_sync_.ConfigureSync(-1, nullptr); 294 rtp_stream_sync_.ConfigureSync(-1, nullptr);
294 } 295 }
295 } 296 }
296 297
297 void VideoReceiveStream::Start() { 298 void VideoReceiveStream::Start() {
298 if (decode_thread_.IsRunning()) 299 if (decode_thread_.IsRunning())
299 return; 300 return;
301
302 bool protected_by_fec =
303 protected_by_flexfec_ || rtp_stream_receiver_.IsUlpfecEnabled();
304
300 if (jitter_buffer_experiment_) { 305 if (jitter_buffer_experiment_) {
301 frame_buffer_->Start(); 306 frame_buffer_->Start();
302 call_stats_->RegisterStatsObserver(&rtp_stream_receiver_); 307 call_stats_->RegisterStatsObserver(&rtp_stream_receiver_);
303 308
304 if (rtp_stream_receiver_.IsRetransmissionsEnabled() && 309 if (rtp_stream_receiver_.IsRetransmissionsEnabled() && protected_by_fec) {
305 rtp_stream_receiver_.IsUlpfecEnabled()) {
306 frame_buffer_->SetProtectionMode(kProtectionNackFEC); 310 frame_buffer_->SetProtectionMode(kProtectionNackFEC);
307 } 311 }
308 } 312 }
309 transport_adapter_.Enable(); 313 transport_adapter_.Enable();
310 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr; 314 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr;
311 if (config_.renderer) { 315 if (config_.renderer) {
312 if (config_.disable_prerenderer_smoothing) { 316 if (config_.disable_prerenderer_smoothing) {
313 renderer = this; 317 renderer = this;
314 } else { 318 } else {
315 incoming_video_stream_.reset( 319 incoming_video_stream_.reset(
316 new IncomingVideoStream(config_.render_delay_ms, this)); 320 new IncomingVideoStream(config_.render_delay_ms, this));
317 renderer = incoming_video_stream_.get(); 321 renderer = incoming_video_stream_.get();
318 } 322 }
319 } 323 }
320 RTC_DCHECK(renderer != nullptr); 324 RTC_DCHECK(renderer != nullptr);
321 325
322 for (const Decoder& decoder : config_.decoders) { 326 for (const Decoder& decoder : config_.decoders) {
323 video_receiver_.RegisterExternalDecoder(decoder.decoder, 327 video_receiver_.RegisterExternalDecoder(decoder.decoder,
324 decoder.payload_type); 328 decoder.payload_type);
325 VideoCodec codec = CreateDecoderVideoCodec(decoder); 329 VideoCodec codec = CreateDecoderVideoCodec(decoder);
326 RTC_CHECK( 330 RTC_CHECK(
327 rtp_stream_receiver_.AddReceiveCodec(codec, decoder.codec_params)); 331 rtp_stream_receiver_.AddReceiveCodec(codec, decoder.codec_params));
328 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec( 332 RTC_CHECK_EQ(VCM_OK, video_receiver_.RegisterReceiveCodec(
329 &codec, num_cpu_cores_, false)); 333 &codec, num_cpu_cores_, false));
330 } 334 }
331 335
332 video_stream_decoder_.reset(new VideoStreamDecoder( 336 video_stream_decoder_.reset(new VideoStreamDecoder(
333 &video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_, 337 &video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_,
334 rtp_stream_receiver_.IsRetransmissionsEnabled(), 338 rtp_stream_receiver_.IsRetransmissionsEnabled(), protected_by_fec,
335 rtp_stream_receiver_.IsUlpfecEnabled(), &stats_proxy_, renderer, 339 &stats_proxy_, renderer, config_.pre_render_callback));
336 config_.pre_render_callback));
337 // Register the channel to receive stats updates. 340 // Register the channel to receive stats updates.
338 call_stats_->RegisterStatsObserver(video_stream_decoder_.get()); 341 call_stats_->RegisterStatsObserver(video_stream_decoder_.get());
339 // Start the decode thread 342 // Start the decode thread
340 decode_thread_.Start(); 343 decode_thread_.Start();
341 decode_thread_.SetPriority(rtc::kHighestPriority); 344 decode_thread_.SetPriority(rtc::kHighestPriority);
342 rtp_stream_receiver_.StartReceive(); 345 rtp_stream_receiver_.StartReceive();
343 } 346 }
344 347
345 void VideoReceiveStream::Stop() { 348 void VideoReceiveStream::Stop() {
346 rtp_stream_receiver_.StopReceive(); 349 rtp_stream_receiver_.StopReceive();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 << " ms, requesting keyframe."; 485 << " ms, requesting keyframe.";
483 RequestKeyFrame(); 486 RequestKeyFrame();
484 } 487 }
485 } else { 488 } else {
486 video_receiver_.Decode(kMaxDecodeWaitTimeMs); 489 video_receiver_.Decode(kMaxDecodeWaitTimeMs);
487 } 490 }
488 } 491 }
489 492
490 } // namespace internal 493 } // namespace internal
491 } // namespace webrtc 494 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698