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

Unified Diff: webrtc/modules/video_coding/frame_buffer2.cc

Issue 2898763005: More gracefully handle timing errors, such as unexpected changes in the rtp timestamp. (Closed)
Patch Set: Comments addressed. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | 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 584c2f03c4c2af81505023e2c70fa5d4b66bf232..5a7e16edc11cb76f42540a908fa88494193f0f0b 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -141,6 +141,13 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms);
}
+ // Gracefully handle bad RTP timestamps and render time issues.
+ if (HasBadRenderTiming(*frame, now_ms)) {
+ jitter_estimator_->Reset();
+ timing_->Reset();
+ frame->SetRenderTime(timing_->RenderTimeMs(frame->timestamp, now_ms));
+ }
+
UpdateJitterDelay();
PropagateDecodability(next_frame_it_->second);
@@ -189,6 +196,27 @@ FrameBuffer::ReturnReason FrameBuffer::NextFrame(
return kTimeout;
}
+bool FrameBuffer::HasBadRenderTiming(const FrameObject& frame, int64_t now_ms) {
+ // Assume that render timing errors are due to changes in the video stream.
+ int64_t render_time_ms = frame.RenderTimeMs();
+ const int64_t kMaxVideoDelayMs = 10000;
+ if (render_time_ms < 0) {
+ return true;
+ } else if (std::abs(render_time_ms - now_ms) > kMaxVideoDelayMs) {
philipel 2017/05/23 16:11:48 Now we don't need the "else if" any more :)
stefan-webrtc 2017/05/23 16:33:43 Done.
+ int frame_delay = static_cast<int>(std::abs(render_time_ms - now_ms));
+ LOG(LS_WARNING) << "A frame about to be decoded is out of the configured "
+ << "delay bounds (" << frame_delay << " > "
+ << kMaxVideoDelayMs
+ << "). Resetting the video jitter buffer.";
+ return true;
+ } else if (static_cast<int>(timing_->TargetVideoDelay()) > kMaxVideoDelayMs) {
philipel 2017/05/23 16:11:48 same here
stefan-webrtc 2017/05/23 16:33:42 Done.
+ LOG(LS_WARNING) << "The video target delay has grown larger than "
+ << kMaxVideoDelayMs << " ms.";
+ return true;
+ }
+ return false;
+}
+
void FrameBuffer::SetProtectionMode(VCMVideoProtection mode) {
TRACE_EVENT0("webrtc", "FrameBuffer::SetProtectionMode");
rtc::CritScope lock(&crit_);
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698