Commit 30e651ad authored by Francois Buergisser's avatar Francois Buergisser Committed by Commit Bot

media/gpu/v4l2: fix EBUSY error when changing resolution

When changing the resolution while decoding and using video decoder,
VIDIOC_S_FMT on the output buffer will return EBUSY.
Before changing the output buffer format, the capture buffer must be
destroyed.
This patch, moves the capture buffer destruction before changing the output
buffer's format as per specification [1].

[1] https://hverkuil.home.xs4all.nl/codec-api/uapi/v4l/dev-stateless-decoder.html#dynamic-resolution-change

BUG=b:142828922
TEST=ran tast with video.DecodeAccelVDVP8ResolutionSwitch on veyron_minnie-kernelnext.
TEST=ran tast with video.DecodeAccelVDH264ResolutionSwitch on veyron_minnie-kernelnext.
TEST=ran tast with video.DecodeAccelVDVP8 on veyron_minnie-kernelnext.
TEST=ran tast with video.DecodeAccelVDH264 on veyron_minnie-kernelnext.
Signed-off-by: default avatarFrancois Buergisser <fbuergisser@chromium.org>
Change-Id: I304cd4b7e52d95bec4dcf4bcb803439c6f8cf273
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868574
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707393}
parent efb81777
......@@ -502,6 +502,12 @@ bool V4L2SliceVideoDecoder::ChangeResolution(gfx::Size pic_size,
if (!StopStreamV4L2Queue())
return false;
if (!output_queue_->DeallocateBuffers()) {
SetState(State::kError);
return false;
}
DCHECK_GT(num_output_frames, 0u);
if (!SetCodedSizeOnInputQueue(pic_size)) {
VLOGF(1) << "Failed to set coded size on input queue";
return false;
......@@ -523,12 +529,6 @@ bool V4L2SliceVideoDecoder::ChangeResolution(gfx::Size pic_size,
return false;
}
// Allocate new output buffers.
if (!output_queue_->DeallocateBuffers()) {
SetState(State::kError);
return false;
}
DCHECK_GT(num_output_frames, 0u);
if (output_queue_->AllocateBuffers(num_output_frames, V4L2_MEMORY_DMABUF) ==
0) {
VLOGF(1) << "Failed to request output buffers.";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment