From 50ca701e68451c33c53e348d3727f86667c4b1fa Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 2 Aug 2023 11:28:58 +0200 Subject: [PATCH] Mitigate scenario when VP9 HW encoder uses less spatial layers than configured log an error and reset chain instead of propagating oversized chain diff, thus avoid DCHECK in RtpDependencyDescriptorWriter. Bug: webrtc:11999, chromium:1467865 Change-Id: If0d186ce7d3a108799ef2b42dd4a3791db33f1a7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/314501 Commit-Queue: Danil Chapovalov Reviewed-by: Sergey Silkin Cr-Commit-Position: refs/heads/main@{#40503} --- call/rtp_payload_params.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/call/rtp_payload_params.cc b/call/rtp_payload_params.cc index f0347bc74e..ed7620e06c 100644 --- a/call/rtp_payload_params.cc +++ b/call/rtp_payload_params.cc @@ -657,7 +657,15 @@ void RtpPayloadParams::Vp9ToGeneric(const CodecSpecificInfoVP9& vp9_info, result.chain_diffs[sid] = 0; continue; } - result.chain_diffs[sid] = shared_frame_id - chain_last_frame_id_[sid]; + int64_t chain_diff = shared_frame_id - chain_last_frame_id_[sid]; + if (chain_diff >= 256) { + RTC_LOG(LS_ERROR) + << "Too many frames since last VP9 T0 frame for spatial layer #" + << sid << " at frame#" << shared_frame_id; + chain_last_frame_id_[sid] = -1; + chain_diff = 0; + } + result.chain_diffs[sid] = chain_diff; } if (temporal_index == 0) {