Commit 4c71cdc7 authored by David Staessens's avatar David Staessens Committed by Commit Bot

media/gpu/test: Fix video decoder tests failing on allocate-only platforms.

This CL fixes the new video decoder tests failing on platforms that don't
support import mode. Even if no actual rendering is done in the tests, we still
need to create a video frame object as this is the expected output format.

TEST=./video_decode_accelerator_tests on nyan_big

BUG=981714

Change-Id: I4c9dc33516a76f2b0b87589b0682ec15e150f319
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688770
Commit-Queue: David Staessens <dstaessens@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676216}
parent 3ba4fe76
......@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h"
#include "media/gpu/macros.h"
#include "media/gpu/test/video_frame_helpers.h"
namespace media {
namespace test {
......@@ -130,7 +131,16 @@ scoped_refptr<VideoFrame> FrameRendererDummy::CreateVideoFrame(
const gfx::Size& size,
uint32_t texture_target,
uint32_t* texture_id) {
return nullptr;
*texture_id = 0;
// Create a dummy video frame. No actual rendering will be done but the video
// frame's properties such as timestamp will be used.
// TODO(dstaessens): Remove this function when allocate mode is deprecated.
base::Optional<VideoFrameLayout> layout =
CreateVideoFrameLayout(pixel_format, size);
DCHECK(layout);
return VideoFrame::WrapExternalDataWithLayout(*layout, gfx::Rect(size), size,
nullptr, 0, base::TimeDelta());
}
uint64_t FrameRendererDummy::FramesDropped() const {
......
......@@ -192,12 +192,16 @@ void TestVDAVideoDecoder::ProvidePictureBuffersWithVisibleRect(
const gfx::Rect& visible_rect,
uint32_t texture_target) {
DCHECK_CALLED_ON_VALID_SEQUENCE(vda_wrapper_sequence_checker_);
ASSERT_NE(format, PIXEL_FORMAT_UNKNOWN);
ASSERT_EQ(textures_per_buffer, 1u);
DVLOGF(4) << "Requested " << requested_num_of_buffers
<< " picture buffers with size " << dimensions.height() << "x"
<< dimensions.height();
// If using allocate mode the format requested here might be
// PIXEL_FORMAT_UNKNOWN.
if (format == PIXEL_FORMAT_UNKNOWN)
format = PIXEL_FORMAT_ARGB;
std::vector<PictureBuffer> picture_buffers;
switch (output_mode_) {
......
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