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

Side by Side Diff: webrtc/modules/video_coding/frame_buffer2.cc

Issue 2844643002: Add warning about timestamp non-monotonicity in the frame buffer. (Closed)
Patch Set: Log before we advance |last_decoded_frame_it_|. Created 3 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
« no previous file with comments | « no previous file | 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) 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 frame->ReceivedTime())) { 134 frame->ReceivedTime())) {
135 jitter_estimator_->UpdateEstimate(frame_delay, frame->size()); 135 jitter_estimator_->UpdateEstimate(frame_delay, frame->size());
136 } 136 }
137 137
138 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; 138 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
139 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); 139 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult));
140 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); 140 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms);
141 } 141 }
142 142
143 UpdateJitterDelay(); 143 UpdateJitterDelay();
144 PropagateDecodability(next_frame_it_->second);
144 145
145 PropagateDecodability(next_frame_it_->second); 146 // Sanity check for RTP timestamp monotonicity.
147 if (last_decoded_frame_it_ != frames_.end()) {
148 const FrameKey& last_decoded_frame_key = last_decoded_frame_it_->first;
149 const FrameKey& frame_key = next_frame_it_->first;
150
151 const bool frame_is_higher_spatial_layer_of_last_decoded_frame =
152 last_decoded_frame_timestamp_ == frame->timestamp &&
153 last_decoded_frame_key.picture_id == frame_key.picture_id &&
154 last_decoded_frame_key.spatial_layer < frame_key.spatial_layer;
155
156 if (AheadOrAt(last_decoded_frame_timestamp_, frame->timestamp) &&
157 !frame_is_higher_spatial_layer_of_last_decoded_frame) {
158 // TODO(brandtr): Consider clearing the entire buffer when we hit
159 // these conditions.
160 LOG(LS_WARNING) << "Frame with (timestamp:picture_id:spatial_id) ("
161 << frame->timestamp << ":" << frame->picture_id << ":"
162 << static_cast<int>(frame->spatial_layer) << ")"
163 << " sent to decoder after frame with"
164 << " (timestamp:picture_id:spatial_id) ("
165 << last_decoded_frame_timestamp_ << ":"
166 << last_decoded_frame_key.picture_id << ":"
167 << static_cast<int>(
168 last_decoded_frame_key.spatial_layer)
169 << ").";
170 }
171 }
172
146 AdvanceLastDecodedFrame(next_frame_it_); 173 AdvanceLastDecodedFrame(next_frame_it_);
147 last_decoded_frame_timestamp_ = frame->timestamp; 174 last_decoded_frame_timestamp_ = frame->timestamp;
148 *frame_out = std::move(frame); 175 *frame_out = std::move(frame);
149 return kFrameFound; 176 return kFrameFound;
150 } 177 }
151 } 178 }
152 179
153 if (latest_return_time_ms - now_ms > 0) { 180 if (latest_return_time_ms - now_ms > 0) {
154 // If |next_frame_it_ == frames_.end()| and there is still time left, it 181 // If |next_frame_it_ == frames_.end()| and there is still time left, it
155 // means that the frame buffer was cleared as the thread in this function 182 // means that the frame buffer was cleared as the thread in this function
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 frames_.clear(); 467 frames_.clear();
441 last_decoded_frame_it_ = frames_.end(); 468 last_decoded_frame_it_ = frames_.end();
442 last_continuous_frame_it_ = frames_.end(); 469 last_continuous_frame_it_ = frames_.end();
443 next_frame_it_ = frames_.end(); 470 next_frame_it_ = frames_.end();
444 num_frames_history_ = 0; 471 num_frames_history_ = 0;
445 num_frames_buffered_ = 0; 472 num_frames_buffered_ = 0;
446 } 473 }
447 474
448 } // namespace video_coding 475 } // namespace video_coding
449 } // namespace webrtc 476 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698