Add max pre-decode queue size threshold for pacing
When pacing is enabled for the low latency rendering path,
frames are sent to the decoder in regular intervals. In case of a
jitter, these frames intervals could add up to create a large latency.
Hence, disable frame pacing if the pre-decode queue grows beyond the
threshold. The threshold for when to disable frame pacing is set
through a field trial. The default value is high enough so that
the behavior is not changed unless the field trial is specified.
Bug: chromium:1237402
Change-Id: I901fd579f68da286eca3d654118f60d3c55e21ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228241
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34705}
diff --git a/modules/video_coding/timing.h b/modules/video_coding/timing.h
index b49911d..07c12e9 100644
--- a/modules/video_coding/timing.h
+++ b/modules/video_coding/timing.h
@@ -82,8 +82,15 @@
virtual int64_t RenderTimeMs(uint32_t frame_timestamp, int64_t now_ms) const;
// Returns the maximum time in ms that we can wait for a frame to become
- // complete before we must pass it to the decoder.
- virtual int64_t MaxWaitingTime(int64_t render_time_ms, int64_t now_ms) const;
+ // complete before we must pass it to the decoder. render_time_ms==0 indicates
+ // that the frames should be processed as quickly as possible, with possibly
+ // only a small delay added to make sure that the decoder is not overloaded.
+ // In this case, the parameter too_many_frames_queued is used to signal that
+ // the decode queue is full and that the frame should be decoded as soon as
+ // possible.
+ virtual int64_t MaxWaitingTime(int64_t render_time_ms,
+ int64_t now_ms,
+ bool too_many_frames_queued) const;
// Returns the current target delay which is required delay + decode time +
// render delay.