Fix frame not found error when encoder is paused.

The problem occurs when a frame is sent again because the encoder was paused but the frame has already been received by all participants:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/video/video_stream_encoder.cc;l=2322

Change-Id: If8890986301c44a472db9bc4750d23761c150669
Bug: b/328175783
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343560
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Cr-Commit-Position: refs/heads/main@{#41931}
This commit is contained in:
Jeremy Leconte 2024-03-19 17:42:46 +01:00 committed by WebRTC LUCI CQ
parent 8746e9a921
commit 1a37aa197e

View File

@ -285,8 +285,12 @@ void DefaultVideoQualityAnalyzer::OnFramePreEncode(
<< "DefaultVideoQualityAnalyzer has to be started before use";
auto it = captured_frames_in_flight_.find(frame.id());
RTC_CHECK(it != captured_frames_in_flight_.end())
<< "Frame id=" << frame.id() << " not found";
if (it == captured_frames_in_flight_.end()) {
// If the frame is not found, it is possible that it has been encoded twice
// and that it was received by all the participants the first time.
RTC_LOG(LS_WARNING) << "Frame id=" << frame.id() << " not found.";
return;
}
FrameInFlight& frame_in_flight = it->second;
frame_counters_.pre_encoded++;
size_t peer_index = peers_->index(peer_name);