Skip to content

Commit

Permalink
[M108] media/gpu: Add visible rect validation to LibYUV image processor
Browse files Browse the repository at this point in the history
Add a check to the LibYUV image processor backend to make sure the
visible rect is no larger than the input resolution. This check was
already present in the V4L2 image processor, and its absence was causing
issues with the GTS test "GtsMediaTestCases
com.google.android.media.gts.MediaDrmStressTest#testL1H264PlaybackRecovery"

(cherry picked from commit 9a2ec9f)

Bug: b:258077770
Test: Tested on Corsola
Change-Id: I1e7b9025f445b8d382c12227d980d4cee68321aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4065500
Commit-Queue: Justin Green <greenjustin@google.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1077318}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4065622
Reviewed-by: Miguel Casas-Sanchez <mcasas@chromium.org>
Auto-Submit: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Justin Green <greenjustin@google.com>
Cr-Commit-Position: refs/branch-heads/5359@{#1046}
Cr-Branched-From: 27d3765-refs/heads/main@{#1058933}
  • Loading branch information
greenjustin authored and Chromium LUCI CQ committed Nov 30, 2022
1 parent 534cacb commit 6650466
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions media/gpu/chromeos/libyuv_image_processor_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ std::unique_ptr<ImageProcessorBackend> LibYUVImageProcessorBackend::Create(
DCHECK_EQ(output_mode, OutputMode::IMPORT)
<< "Only OutputMode::IMPORT supported";

if (!gfx::Rect(input_config.size).Contains(input_config.visible_rect)) {
VLOGF(1) << "Input size should contain input visible rect.";
return nullptr;
}
if (!gfx::Rect(output_config.size).Contains(output_config.visible_rect)) {
VLOGF(1) << "Output size should contain output visible rect.";
return nullptr;
}

std::unique_ptr<VideoFrameMapper> input_frame_mapper;
// LibYUVImageProcessorBackend supports only memory-based video frame for
// input.
Expand Down

0 comments on commit 6650466

Please sign in to comment.