From 7b92ceb0ee30b30c6be9608e1a85adf30d20a9c2 Mon Sep 17 00:00:00 2001 From: Rasmus Brandt Date: Tue, 26 Jun 2018 12:34:59 +0200 Subject: [PATCH] Ensure that input_frames_.size() <= kMaxBufferedInputFrames at enqueue time. Bug: webrtc:9452 Change-Id: I6d415a2cb24461d7359ff30e6499d65d88d2b2f8 Reviewed-on: https://webrtc-review.googlesource.com/85371 Reviewed-by: Sergey Silkin Commit-Queue: Rasmus Brandt Cr-Commit-Position: refs/heads/master@{#23846} --- modules/video_coding/codecs/test/videoprocessor.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc index 0cf2fa0808..24a0f016ef 100644 --- a/modules/video_coding/codecs/test/videoprocessor.cc +++ b/modules/video_coding/codecs/test/videoprocessor.cc @@ -269,6 +269,9 @@ void VideoProcessor::ProcessFrame() { webrtc::kVideoRotation_0); // Store input frame as a reference for quality calculations. if (config_.decode && !config_.measure_cpu) { + if (input_frames_.size() == kMaxBufferedInputFrames) { + input_frames_.erase(input_frames_.begin()); + } input_frames_.emplace(frame_number, input_frame); } last_inputed_timestamp_ = timestamp;