0

media/gpu/v4l2/test: Move ivf parser owner

IVF is a container for mainly VPx/AVx codecs.  As other
codecs are not in this container, move it out of the
VideoDecoder class and into the Vp9Decoder/Av1Decoder
classes.

BUG=b:234752983

Change-Id: Id8861b81802eced008a9ae7cafad775d9b090905
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688586
Reviewed-by: Steve Cho <stevecho@chromium.org>
Auto-Submit: Fritz Koenig <frkoenig@chromium.org>
Commit-Queue: Fritz Koenig <frkoenig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1012556}
This commit is contained in:
Fritz Koenig
2022-06-09 16:54:24 +00:00
committed by Chromium LUCI CQ
parent 462f19186c
commit 399e131ee3
6 changed files with 14 additions and 15 deletions

@ -24,10 +24,10 @@ Av1Decoder::Av1Decoder(std::unique_ptr<IvfParser> ivf_parser,
std::unique_ptr<V4L2IoctlShim> v4l2_ioctl,
std::unique_ptr<V4L2Queue> OUTPUT_queue,
std::unique_ptr<V4L2Queue> CAPTURE_queue)
: VideoDecoder::VideoDecoder(std::move(ivf_parser),
std::move(v4l2_ioctl),
: VideoDecoder::VideoDecoder(std::move(v4l2_ioctl),
std::move(OUTPUT_queue),
std::move(CAPTURE_queue)),
ivf_parser_(std::move(ivf_parser)),
buffer_pool_(std::make_unique<libgav1::BufferPool>(
/*on_frame_buffer_size_changed=*/nullptr,
/*get_frame_buffer=*/nullptr,

@ -87,6 +87,9 @@ class Av1Decoder : public VideoDecoder {
// Reference frames currently in use.
std::array<scoped_refptr<MmapedBuffer>, kAv1NumRefFrames> ref_frames_;
// Parser for the IVF stream to decode.
const std::unique_ptr<IvfParser> ivf_parser_;
IvfFrameHeader ivf_frame_header_{};
const uint8_t* ivf_frame_data_ = nullptr;

@ -108,12 +108,10 @@ uint32_t FileFourccToDriverFourcc(uint32_t header_fourcc) {
return header_fourcc;
}
VideoDecoder::VideoDecoder(std::unique_ptr<IvfParser> ivf_parser,
std::unique_ptr<V4L2IoctlShim> v4l2_ioctl,
VideoDecoder::VideoDecoder(std::unique_ptr<V4L2IoctlShim> v4l2_ioctl,
std::unique_ptr<V4L2Queue> OUTPUT_queue,
std::unique_ptr<V4L2Queue> CAPTURE_queue)
: ivf_parser_(std::move(ivf_parser)),
v4l2_ioctl_(std::move(v4l2_ioctl)),
: v4l2_ioctl_(std::move(v4l2_ioctl)),
OUTPUT_queue_(std::move(OUTPUT_queue)),
CAPTURE_queue_(std::move(CAPTURE_queue)) {}

@ -5,7 +5,6 @@
#ifndef MEDIA_GPU_V4L2_TEST_VIDEO_DECODER_H_
#define MEDIA_GPU_V4L2_TEST_VIDEO_DECODER_H_
#include "media/filters/ivf_parser.h"
#include "media/gpu/v4l2/test/v4l2_ioctl_shim.h"
namespace media {
@ -18,7 +17,7 @@ namespace v4l2_test {
// which is a format supported on driver.
uint32_t FileFourccToDriverFourcc(uint32_t header_fourcc);
// VideoDecoder decodes encoded IVF streams using v4l2 ioctl calls.
// VideoDecoder decodes encoded video streams using v4l2 ioctl calls.
class VideoDecoder {
public:
// Result of decoding the current frame.
@ -28,8 +27,7 @@ class VideoDecoder {
kEOStream,
};
VideoDecoder(std::unique_ptr<IvfParser> ivf_parser,
std::unique_ptr<V4L2IoctlShim> v4l2_ioctl,
VideoDecoder(std::unique_ptr<V4L2IoctlShim> v4l2_ioctl,
std::unique_ptr<V4L2Queue> OUTPUT_queue,
std::unique_ptr<V4L2Queue> CAPTURE_queue);
@ -60,9 +58,6 @@ class VideoDecoder {
char* src_uv,
gfx::Size size);
// Parser for the IVF stream to decode.
const std::unique_ptr<IvfParser> ivf_parser_;
// Wrapper for V4L2 ioctl requests.
const std::unique_ptr<V4L2IoctlShim> v4l2_ioctl_;

@ -99,10 +99,10 @@ Vp9Decoder::Vp9Decoder(std::unique_ptr<IvfParser> ivf_parser,
std::unique_ptr<V4L2IoctlShim> v4l2_ioctl,
std::unique_ptr<V4L2Queue> OUTPUT_queue,
std::unique_ptr<V4L2Queue> CAPTURE_queue)
: VideoDecoder::VideoDecoder(std::move(ivf_parser),
std::move(v4l2_ioctl),
: VideoDecoder::VideoDecoder(std::move(v4l2_ioctl),
std::move(OUTPUT_queue),
std::move(CAPTURE_queue)),
ivf_parser_(std::move(ivf_parser)),
vp9_parser_(
std::make_unique<Vp9Parser>(/*parsing_compressed_header=*/false)) {
DCHECK(v4l2_ioctl_);

@ -68,6 +68,9 @@ class Vp9Decoder : public VideoDecoder {
scoped_refptr<MmapedBuffer> buffer,
uint32_t last_queued_buffer_index);
// Parser for the IVF stream to decode.
const std::unique_ptr<IvfParser> ivf_parser_;
// VP9-specific data.
const std::unique_ptr<Vp9Parser> vp9_parser_;