From d0aec913d674f3264cc5ff77a0ae0f35a610e9f5 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Wed, 17 Apr 2019 13:22:27 +0200 Subject: [PATCH] Never match a decoded frame with a smaller capture. Bug: webrtc:10365 Change-Id: I9fa25e15a2495f5d48aa7b415fff9a741d637c71 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133345 Reviewed-by: Rasmus Brandt Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#27710} --- test/scenario/video_frame_matcher.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/scenario/video_frame_matcher.cc b/test/scenario/video_frame_matcher.cc index c0d7925db4..82b3b3e3ee 100644 --- a/test/scenario/video_frame_matcher.cc +++ b/test/scenario/video_frame_matcher.cc @@ -46,7 +46,8 @@ void VideoFrameMatcher::OnCapturedFrame(const VideoFrame& frame, task_queue_.PostTask([this, captured]() { for (auto& layer : layers_) { CapturedFrame copy = captured; - if (layer.second.last_decode) { + if (layer.second.last_decode && + layer.second.last_decode->frame->width() <= captured.frame->width()) { copy.best_score = I420SSE(*captured.thumb->GetI420(), *layer.second.last_decode->thumb->GetI420()); copy.best_decode = layer.second.last_decode; @@ -71,6 +72,11 @@ void VideoFrameMatcher::OnDecodedFrame(const VideoFrame& frame, decoded->id = layer.next_decoded_id++; layer.last_decode = decoded; for (auto& captured : layer.captured_frames) { + // We can't match with a smaller capture. + if (captured.frame->width() < decoded->frame->width()) { + captured.matched = true; + continue; + } double score = I420SSE(*captured.thumb->GetI420(), *decoded->thumb->GetI420()); if (score < captured.best_score) {