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}
This commit is contained in:
Johannes Kron
2021-08-10 16:56:12 +02:00
committed by WebRTC LUCI CQ
parent 5653c95ca2
commit 2ddc39e2b9
7 changed files with 119 additions and 28 deletions

View File

@ -209,14 +209,19 @@ int VCMTiming::RequiredDecodeTimeMs() const {
}
int64_t VCMTiming::MaxWaitingTime(int64_t render_time_ms,
int64_t now_ms) const {
int64_t now_ms,
bool too_many_frames_queued) const {
MutexLock lock(&mutex_);
if (render_time_ms == 0 && zero_playout_delay_min_pacing_->us() > 0) {
// `render_time_ms` == 0 indicates that the frame should be decoded and
// rendered as soon as possible. However, the decoder can be choked if too
// many frames are sent at ones. Therefore, limit the interframe delay to
// `zero_playout_delay_min_pacing_`.
// many frames are sent at once. Therefore, limit the interframe delay to
// |zero_playout_delay_min_pacing_| unless too many frames are queued in
// which case the frames are sent to the decoder at once.
if (too_many_frames_queued) {
return 0;
}
int64_t earliest_next_decode_start_time =
last_decode_scheduled_ts_ + zero_playout_delay_min_pacing_->ms();
int64_t max_wait_time_ms = now_ms >= earliest_next_decode_start_time