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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/frame_buffer2.cc
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index acc1bb83c5a0e448e030d42b98eab5d25315b0a1..280dc5a0b08dee456ccfb867b5652130062f654e 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -141,8 +141,35 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
}
UpdateJitterDelay();
-
PropagateDecodability(next_frame_it_->second);
+
+ // Sanity check for RTP timestamp monotonicity.
+ if (last_decoded_frame_it_ != frames_.end()) {
+ const FrameKey& last_decoded_frame_key = last_decoded_frame_it_->first;
+ const FrameKey& frame_key = next_frame_it_->first;
+
+ const bool frame_is_higher_spatial_layer_of_last_decoded_frame =
+ last_decoded_frame_timestamp_ == frame->timestamp &&
+ last_decoded_frame_key.picture_id == frame_key.picture_id &&
+ last_decoded_frame_key.spatial_layer < frame_key.spatial_layer;
+
+ if (AheadOrAt(last_decoded_frame_timestamp_, frame->timestamp) &&
+ !frame_is_higher_spatial_layer_of_last_decoded_frame) {
+ // TODO(brandtr): Consider clearing the entire buffer when we hit
+ // these conditions.
+ LOG(LS_WARNING) << "Frame with (timestamp:picture_id:spatial_id) ("
+ << frame->timestamp << ":" << frame->picture_id << ":"
+ << static_cast<int>(frame->spatial_layer) << ")"
+ << " sent to decoder after frame with"
+ << " (timestamp:picture_id:spatial_id) ("
+ << last_decoded_frame_timestamp_ << ":"
+ << last_decoded_frame_key.picture_id << ":"
+ << static_cast<int>(
+ last_decoded_frame_key.spatial_layer)
+ << ").";
+ }
+ }
+
AdvanceLastDecodedFrame(next_frame_it_);
last_decoded_frame_timestamp_ = frame->timestamp;
*frame_out = std::move(frame);
« 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