Reduce max time between repeat frame to avoid flakiness. The frame cadance adapter injects repeat frames with a ca 1s interval even if no new content has arrived, and the libaom AV1 encoder skips higher temporal layer repeat frames for up to 1s. The causes a potential race between the two that may in some edge cases result in an extra keyframe being generated. Reducing the encoder interval to 500ms avoids that condition. Bug: b/519058486 Change-Id: I3f84be1dbc5a2c160ce76afaa6034332f5429e10 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/485120 Auto-Submit: Erik Språng <sprang@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#48078}
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc index 380ff55..bedcbf1 100644 --- a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc +++ b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
@@ -802,8 +802,9 @@ it != last_encoded_timestamp_by_sid_.end()) { // Get the time since the last encoded frame for this spatial layer. // Don't drop enhancement layer repeat frame if last encode was more - // than one second ago. - if ((frame.rtp_timestamp() - it->second) > kVideoPayloadTypeFrequency) { + // than 500ms ago. + if ((frame.rtp_timestamp() - it->second) > + kVideoPayloadTypeFrequency / 2) { all_layers_droppable = false; break; }