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

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

Issue 2980413002: Fix the video buffer size should take rtt into consideration (Closed)
Patch Set: MODIFY to follow coding guidelines Created 3 years, 4 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 void VideoReceiveStream::Start() { 260 void VideoReceiveStream::Start() {
261 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 261 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
262 if (decode_thread_.IsRunning()) 262 if (decode_thread_.IsRunning())
263 return; 263 return;
264 264
265 bool protected_by_fec = config_.rtp.protected_by_flexfec || 265 bool protected_by_fec = config_.rtp.protected_by_flexfec ||
266 rtp_video_stream_receiver_.IsUlpfecEnabled(); 266 rtp_video_stream_receiver_.IsUlpfecEnabled();
267 267
268 frame_buffer_->Start(); 268 frame_buffer_->Start();
269 call_stats_->RegisterStatsObserver(&rtp_video_stream_receiver_); 269 call_stats_->RegisterStatsObserver(&rtp_video_stream_receiver_);
270 call_stats_->RegisterStatsObserver(this);
270 271
271 if (rtp_video_stream_receiver_.IsRetransmissionsEnabled() && 272 if (rtp_video_stream_receiver_.IsRetransmissionsEnabled() &&
272 protected_by_fec) { 273 protected_by_fec) {
273 frame_buffer_->SetProtectionMode(kProtectionNackFEC); 274 frame_buffer_->SetProtectionMode(kProtectionNackFEC);
274 } 275 }
275 276
276 transport_adapter_.Enable(); 277 transport_adapter_.Enable();
277 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr; 278 rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr;
278 if (config_.renderer) { 279 if (config_.renderer) {
279 if (config_.disable_prerenderer_smoothing) { 280 if (config_.disable_prerenderer_smoothing) {
(...skipping 29 matching lines...) Expand all
309 // Start the decode thread 310 // Start the decode thread
310 decode_thread_.Start(); 311 decode_thread_.Start();
311 rtp_video_stream_receiver_.StartReceive(); 312 rtp_video_stream_receiver_.StartReceive();
312 } 313 }
313 314
314 void VideoReceiveStream::Stop() { 315 void VideoReceiveStream::Stop() {
315 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 316 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
316 rtp_video_stream_receiver_.StopReceive(); 317 rtp_video_stream_receiver_.StopReceive();
317 318
318 frame_buffer_->Stop(); 319 frame_buffer_->Stop();
320 call_stats_->DeregisterStatsObserver(this);
319 call_stats_->DeregisterStatsObserver(&rtp_video_stream_receiver_); 321 call_stats_->DeregisterStatsObserver(&rtp_video_stream_receiver_);
320 process_thread_->DeRegisterModule(&video_receiver_); 322 process_thread_->DeRegisterModule(&video_receiver_);
321 323
322 if (decode_thread_.IsRunning()) { 324 if (decode_thread_.IsRunning()) {
323 // TriggerDecoderShutdown will release any waiting decoder thread and make 325 // TriggerDecoderShutdown will release any waiting decoder thread and make
324 // it stop immediately, instead of waiting for a timeout. Needs to be called 326 // it stop immediately, instead of waiting for a timeout. Needs to be called
325 // before joining the decoder thread. 327 // before joining the decoder thread.
326 video_receiver_.TriggerDecoderShutdown(); 328 video_receiver_.TriggerDecoderShutdown();
327 329
328 decode_thread_.Stop(); 330 decode_thread_.Stop();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 rtp_video_stream_receiver_.RequestKeyFrame(); 429 rtp_video_stream_receiver_.RequestKeyFrame();
428 } 430 }
429 431
430 void VideoReceiveStream::OnCompleteFrame( 432 void VideoReceiveStream::OnCompleteFrame(
431 std::unique_ptr<video_coding::FrameObject> frame) { 433 std::unique_ptr<video_coding::FrameObject> frame) {
432 int last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame)); 434 int last_continuous_pid = frame_buffer_->InsertFrame(std::move(frame));
433 if (last_continuous_pid != -1) 435 if (last_continuous_pid != -1)
434 rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid); 436 rtp_video_stream_receiver_.FrameContinuous(last_continuous_pid);
435 } 437 }
436 438
439 void VideoReceiveStream::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
440 frame_buffer_->UpdateRtt(max_rtt_ms);
441 }
442
437 int VideoReceiveStream::id() const { 443 int VideoReceiveStream::id() const {
438 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 444 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
439 return config_.rtp.remote_ssrc; 445 return config_.rtp.remote_ssrc;
440 } 446 }
441 447
442 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const { 448 rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
443 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); 449 RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
444 Syncable::Info info; 450 Syncable::Info info;
445 451
446 RtpReceiver* rtp_receiver = rtp_video_stream_receiver_.GetRtpReceiver(); 452 RtpReceiver* rtp_receiver = rtp_video_stream_receiver_.GetRtpReceiver();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 if (stream_is_active && !receiving_keyframe) { 523 if (stream_is_active && !receiving_keyframe) {
518 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs 524 LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
519 << " ms, requesting keyframe."; 525 << " ms, requesting keyframe.";
520 RequestKeyFrame(); 526 RequestKeyFrame();
521 } 527 }
522 } 528 }
523 return true; 529 return true;
524 } 530 }
525 } // namespace internal 531 } // namespace internal
526 } // namespace webrtc 532 } // 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