Commit d87cc312 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2vda: Fix buffers assignment sequence.

CL 1170707 has introduced an issue when we disable rendering on the VDA
unittest: ImportBufferForPictureTask() would be called from
AssignPictureBuffersTask() while buffers were still in the free list,
resulting in EnqueueOutputRecord() trying to enqueue buffers that had
still not received a picture ID.

Fix this by first acquiring all buffers, before iterating on them and
calling ImportBufferForPictureTask().

BUG=890656
TEST=Checked the VDA unittest passed on Hana and Cheza, with rendering
both disabled and enabled.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ied75af6d4503ff5e57b1b6bc9d2a0e1d3c2fca89
Reviewed-on: https://chromium-review.googlesource.com/1252228Reviewed-by: default avatarPawel Osciak <posciak@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595383}
parent 47c5f20a
......@@ -378,14 +378,16 @@ void V4L2VideoDecodeAccelerator::AssignPictureBuffersTask(
return;
}
// Reserve all buffers until ImportBufferForPictureTask() is called
while (output_queue_->FreeBuffersCount() > 0) {
V4L2WritableBufferRef buffer(output_queue_->GetFreeBuffer());
DCHECK(buffer.IsValid());
int i = buffer.BufferId();
// Keep the buffer on our side until ImportBufferForPictureTask() is called
output_wait_map_.emplace(buffers[i].id(), std::move(buffer));
}
for (size_t i = 0; i < buffers.size(); i++) {
DCHECK(buffers[i].size() == egl_image_size_);
OutputRecord& output_record = output_buffer_map_[i];
......
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