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

Side by Side Diff: webrtc/modules/video_coding/frame_buffer2.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/modules/video_coding/frame_buffer2.h ('k') | webrtc/video/video_receive_stream.h » ('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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 int64_t frame_delay; 135 int64_t frame_delay;
136 136
137 if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay, 137 if (inter_frame_delay_.CalculateDelay(frame->timestamp, &frame_delay,
138 frame->ReceivedTime())) { 138 frame->ReceivedTime())) {
139 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); 139 jitter_estimator_->UpdateEstimate(frame_delay, frame->size());
140 } 140 }
141 141
142 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; 142 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
143 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); 143 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult));
144 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); 144 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms);
145 } else {
146 jitter_estimator_->FrameNacked();
145 } 147 }
146 148
147 // Gracefully handle bad RTP timestamps and render time issues. 149 // Gracefully handle bad RTP timestamps and render time issues.
148 if (HasBadRenderTiming(*frame, now_ms)) { 150 if (HasBadRenderTiming(*frame, now_ms)) {
149 jitter_estimator_->Reset(); 151 jitter_estimator_->Reset();
150 timing_->Reset(); 152 timing_->Reset();
151 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms)); 153 frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms));
152 } 154 }
153 155
154 UpdateJitterDelay(); 156 UpdateJitterDelay();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 stopped_ = false; 237 stopped_ = false;
236 } 238 }
237 239
238 void FrameBuffer::Stop() { 240 void FrameBuffer::Stop() {
239 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); 241 TRACE_EVENT0("webrtc", "FrameBuffer::Stop");
240 rtc::CritScope lock(&crit_); 242 rtc::CritScope lock(&crit_);
241 stopped_ = true; 243 stopped_ = true;
242 new_continuous_frame_event_.Set(); 244 new_continuous_frame_event_.Set();
243 } 245 }
244 246
247 void FrameBuffer::UpdateRtt(int64_t rtt_ms) {
248 rtc::CritScope lock(&crit_);
249 jitter_estimator_->UpdateRtt(rtt_ms);
250 }
251
245 bool FrameBuffer::ValidReferences(const FrameObject& frame) const { 252 bool FrameBuffer::ValidReferences(const FrameObject& frame) const {
246 for (size_t i = 0; i < frame.num_references; ++i) { 253 for (size_t i = 0; i < frame.num_references; ++i) {
247 if (AheadOrAt(frame.references[i], frame.picture_id)) 254 if (AheadOrAt(frame.references[i], frame.picture_id))
248 return false; 255 return false;
249 for (size_t j = i + 1; j < frame.num_references; ++j) { 256 for (size_t j = i + 1; j < frame.num_references; ++j) {
250 if (frame.references[i] == frame.references[j]) 257 if (frame.references[i] == frame.references[j])
251 return false; 258 return false;
252 } 259 }
253 } 260 }
254 261
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 frames_.clear(); 561 frames_.clear();
555 last_decoded_frame_it_ = frames_.end(); 562 last_decoded_frame_it_ = frames_.end();
556 last_continuous_frame_it_ = frames_.end(); 563 last_continuous_frame_it_ = frames_.end();
557 next_frame_it_ = frames_.end(); 564 next_frame_it_ = frames_.end();
558 num_frames_history_ = 0; 565 num_frames_history_ = 0;
559 num_frames_buffered_ = 0; 566 num_frames_buffered_ = 0;
560 } 567 }
561 568
562 } // namespace video_coding 569 } // namespace video_coding
563 } // namespace webrtc 570 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698