Commit 76f22124 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

VideoFrameLayout: Add offsets and aggregate strides and offsets as Plane

VideoFrameLayout should have information about offset per plane, not only
stride. The number of stride should be the same as the number of offsets. To
guarantee this, they are stored in the vector of struct, Plane.

BUG=chromium:876986, chromium:856562
TEST=VDA unittest and media_unittest

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: Ie9d9afa5db7dabaee2f48fbcd355c13d29be8035
Reviewed-on: https://chromium-review.googlesource.com/1188730
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590242}
parent 364d0305
......@@ -382,13 +382,14 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvaData(
#if defined(OS_LINUX)
// static
scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
VideoPixelFormat format,
const gfx::Size& coded_size,
const VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
std::vector<base::ScopedFD> dmabuf_fds,
base::TimeDelta timestamp) {
const StorageType storage = STORAGE_DMABUFS;
const VideoPixelFormat format = layout.format();
const gfx::Size& coded_size = layout.coded_size();
if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
DLOG(ERROR) << __func__ << " Invalid config."
<< ConfigToString(format, storage, coded_size, visible_rect,
......@@ -403,8 +404,8 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
}
gpu::MailboxHolder mailbox_holders[kMaxPlanes];
scoped_refptr<VideoFrame> frame = new VideoFrame(
format, storage, coded_size, visible_rect, natural_size, timestamp);
scoped_refptr<VideoFrame> frame =
new VideoFrame(layout, storage, visible_rect, natural_size, timestamp);
if (!frame) {
DLOG(ERROR) << __func__ << " Couldn't create VideoFrame instance.";
return nullptr;
......
......@@ -250,8 +250,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// mapped via mmap() for CPU access.
// Returns NULL on failure.
static scoped_refptr<VideoFrame> WrapExternalDmabufs(
VideoPixelFormat format,
const gfx::Size& coded_size,
const VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
std::vector<base::ScopedFD> dmabuf_fds,
......@@ -367,8 +366,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
int stride(size_t plane) const {
DCHECK(IsValidPlane(plane, format()));
DCHECK_LT(plane, layout_.num_strides());
return layout_.strides()[plane];
DCHECK_LT(plane, layout_.num_planes());
return layout_.planes()[plane].stride;
}
// Returns the number of bytes per row and number of rows for a given plane.
......
......@@ -7,15 +7,24 @@
#include <numeric>
#include <sstream>
namespace media {
namespace {
std::ostringstream& operator<<(std::ostringstream& ostrm,
const media::VideoFrameLayout::Plane& plane) {
ostrm << "(" << plane.stride << ", " << plane.offset << ")";
return ostrm;
}
template <class T>
std::string VectorToString(const std::vector<T>& vec) {
std::ostringstream result;
std::string delim;
result << "[";
for (auto v : vec) {
result << delim << v;
result << delim;
result << v;
if (delim.size() == 0)
delim = ", ";
}
......@@ -23,9 +32,16 @@ std::string VectorToString(const std::vector<T>& vec) {
return result.str();
}
} // namespace
std::vector<VideoFrameLayout::Plane> PlanesFromStrides(
const std::vector<int32_t> strides) {
std::vector<VideoFrameLayout::Plane> planes(strides.size());
for (size_t i = 0; i < strides.size(); i++) {
planes[i].stride = strides[i];
}
return planes;
}
namespace media {
} // namespace
VideoFrameLayout::VideoFrameLayout(VideoPixelFormat format,
const gfx::Size& coded_size,
......@@ -33,14 +49,22 @@ VideoFrameLayout::VideoFrameLayout(VideoPixelFormat format,
std::vector<size_t> buffer_sizes)
: format_(format),
coded_size_(coded_size),
strides_(std::move(strides)),
planes_(PlanesFromStrides(strides)),
buffer_sizes_(std::move(buffer_sizes)) {}
VideoFrameLayout::VideoFrameLayout(VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<Plane> planes,
std::vector<size_t> buffer_sizes)
: format_(format),
coded_size_(coded_size),
planes_(std::move(planes)),
buffer_sizes_(std::move(buffer_sizes)) {}
VideoFrameLayout::VideoFrameLayout()
: format_(PIXEL_FORMAT_UNKNOWN),
coded_size_(),
strides_({0, 0, 0, 0}),
buffer_sizes_({0, 0, 0, 0}) {}
planes_(kDefaultPlaneCount),
buffer_sizes_(kDefaultBufferCount, 0) {}
VideoFrameLayout::~VideoFrameLayout() = default;
VideoFrameLayout::VideoFrameLayout(const VideoFrameLayout&) = default;
......@@ -54,12 +78,12 @@ size_t VideoFrameLayout::GetTotalBufferSize() const {
std::string VideoFrameLayout::ToString() const {
std::ostringstream s;
s << "VideoFrameLayout format:" << VideoPixelFormatToString(format_)
<< " coded_size:" << coded_size_.ToString()
<< " num_buffers:" << num_buffers()
<< " buffer_sizes:" << VectorToString(buffer_sizes_)
<< " num_strides:" << num_strides()
<< " strides:" << VectorToString(strides_);
s << "VideoFrameLayout format: " << VideoPixelFormatToString(format_)
<< ", coded_size: " << coded_size_.ToString()
<< ", num_buffers: " << num_buffers()
<< ", buffer_sizes: " << VectorToString(buffer_sizes_)
<< ", num_planes: " << num_planes()
<< ", planes (stride, offset): " << VectorToString(planes_);
return s.str();
}
......
......@@ -21,18 +21,46 @@ namespace media {
// A class to describes how physical buffer is allocated for video frame.
// In stores format, coded size of the frame and size of physical buffers
// which can be used to allocate buffer(s) hardware expected.
// Also, it stores stride (bytes per line) per color plane to calculate each
// color plane's size (note that a buffer may contains multiple color planes.)
// It also stores stride (bytes per line) and offset per color plane as Plane.
// stride is to calculate each color plane's size (note that a buffer may
// contains multiple color planes.)
// offset is to describe a start point of each plane from buffer's dmabuf fd.
// Note that it is copyable.
class MEDIA_EXPORT VideoFrameLayout {
public:
struct Plane {
// Strides of a plane, typically greater or equal to the
// width of the surface divided by the horizontal sampling period. Note that
// strides can be negative if the image layout is bottom-up.
int32_t stride = 0;
// Offset of a plane, which stands for the offset of a start point of a
// color plane from a buffer fd.
size_t offset = 0;
};
enum {
kDefaultPlaneCount = 4,
kDefaultBufferCount = 4,
};
// Constructor with strides and buffers' size.
// If strides and buffer_sizes are not assigned, their default value are
// {0, 0, 0, 0} for compatibility with video_frame.cc's original behavior.
// If strides and buffer_sizes are not assigned, strides, offsets and
// buffer_sizes are {0, 0, 0, 0}.
VideoFrameLayout(VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<int32_t> strides =
std::vector<int32_t>(kDefaultPlaneCount, 0),
std::vector<size_t> buffer_sizes =
std::vector<size_t>(kDefaultBufferCount, 0));
// Constructor with plane's stride/offset, and buffers' size.
// If buffer_sizes are not assigned, it is {0, 0, 0, 0}.
VideoFrameLayout(VideoPixelFormat format,
const gfx::Size& coded_size,
std::vector<int32_t> strides = {0, 0, 0, 0},
std::vector<size_t> buffer_sizes = {0, 0, 0, 0});
std::vector<Plane> planes,
std::vector<size_t> buffer_sizes =
std::vector<size_t>(kDefaultBufferCount));
VideoFrameLayout();
~VideoFrameLayout();
......@@ -43,13 +71,13 @@ class MEDIA_EXPORT VideoFrameLayout {
VideoPixelFormat format() const { return format_; }
const gfx::Size& coded_size() const { return coded_size_; }
// Return number of buffers. Note that num_strides >= num_buffers.
// Return number of buffers. Note that num_planes >= num_buffers.
size_t num_buffers() const { return buffer_sizes_.size(); }
// Returns number of strides. Note that num_strides >= num_buffers.
size_t num_strides() const { return strides_.size(); }
// Returns number of planes. Note that num_planes >= num_buffers.
size_t num_planes() const { return planes_.size(); }
const std::vector<int32_t>& strides() const { return strides_; }
const std::vector<Plane>& planes() const { return planes_; }
const std::vector<size_t>& buffer_sizes() const { return buffer_sizes_; }
// Returns sum of bytes of all buffers.
......@@ -68,10 +96,8 @@ class MEDIA_EXPORT VideoFrameLayout {
// the pixel data provided for the odd pixels.
gfx::Size coded_size_;
// Vector of strides for each buffer, typically greater or equal to the
// width of the surface divided by the horizontal sampling period. Note that
// strides can be negative if the image layout is bottom-up.
std::vector<int32_t> strides_;
// Layout property for each color planes, e.g. stride and buffer offset.
std::vector<Plane> planes_;
// Vector of sizes for each buffer, typically greater or equal to the area of
// |coded_size_|.
......
......@@ -10,12 +10,29 @@
#include <string>
#include <utility>
#include "base/logging.h"
#include "media/base/video_types.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
namespace media {
namespace {
std::vector<VideoFrameLayout::Plane> CreatePlanes(
const std::vector<int32_t>& strides,
const std::vector<size_t>& offsets) {
LOG_ASSERT(strides.size() == offsets.size());
std::vector<VideoFrameLayout::Plane> planes(strides.size());
for (size_t i = 0; i < strides.size(); i++) {
planes[i].stride = strides[i];
planes[i].offset = offsets[i];
}
return planes;
}
} // namespace
TEST(VideoFrameLayout, Constructor) {
gfx::Size coded_size = gfx::Size(320, 180);
std::vector<int32_t> strides = {384, 192, 192};
......@@ -24,11 +41,32 @@ TEST(VideoFrameLayout, Constructor) {
EXPECT_EQ(layout.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout.coded_size(), coded_size);
EXPECT_EQ(layout.num_strides(), 3u);
EXPECT_EQ(layout.num_planes(), 3u);
EXPECT_EQ(layout.num_buffers(), 3u);
EXPECT_EQ(layout.GetTotalBufferSize(), 110592u);
for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(layout.strides()[i], strides[i]);
EXPECT_EQ(layout.planes()[i].stride, strides[i]);
EXPECT_EQ(layout.planes()[i].offset, 0u);
EXPECT_EQ(layout.buffer_sizes()[i], buffer_sizes[i]);
}
}
TEST(VideoFrameLayout, ConstructorWithPlanes) {
gfx::Size coded_size = gfx::Size(320, 180);
std::vector<int32_t> strides = {384, 192, 192};
std::vector<size_t> offsets = {0, 100, 200};
std::vector<size_t> buffer_sizes = {73728, 18432, 18432};
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size,
CreatePlanes(strides, offsets), buffer_sizes);
EXPECT_EQ(layout.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout.coded_size(), coded_size);
EXPECT_EQ(layout.num_planes(), 3u);
EXPECT_EQ(layout.num_buffers(), 3u);
EXPECT_EQ(layout.GetTotalBufferSize(), 110592u);
for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(layout.planes()[i].stride, strides[i]);
EXPECT_EQ(layout.planes()[i].offset, offsets[i]);
EXPECT_EQ(layout.buffer_sizes()[i], buffer_sizes[i]);
}
}
......@@ -40,10 +78,11 @@ TEST(VideoFrameLayout, ConstructorNoStrideBufferSize) {
EXPECT_EQ(layout.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout.coded_size(), coded_size);
EXPECT_EQ(layout.GetTotalBufferSize(), 0u);
EXPECT_EQ(layout.num_strides(), 4u);
EXPECT_EQ(layout.num_planes(), 4u);
EXPECT_EQ(layout.num_buffers(), 4u);
for (size_t i = 0; i < 4u; ++i) {
EXPECT_EQ(layout.strides()[i], 0);
EXPECT_EQ(layout.planes()[i].stride, 0);
EXPECT_EQ(layout.planes()[i].offset, 0u);
EXPECT_EQ(layout.buffer_sizes()[i], 0u);
}
}
......@@ -51,18 +90,21 @@ TEST(VideoFrameLayout, ConstructorNoStrideBufferSize) {
TEST(VideoFrameLayout, CopyConstructor) {
gfx::Size coded_size = gfx::Size(320, 180);
std::vector<int32_t> strides = {384, 192, 192};
std::vector<size_t> offsets = {0, 100, 200};
std::vector<size_t> buffer_sizes = {73728, 18432, 18432};
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size, strides, buffer_sizes);
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size,
CreatePlanes(strides, offsets), buffer_sizes);
VideoFrameLayout layout_clone(layout);
EXPECT_EQ(layout_clone.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout_clone.coded_size(), coded_size);
EXPECT_EQ(layout_clone.num_strides(), 3u);
EXPECT_EQ(layout_clone.num_planes(), 3u);
EXPECT_EQ(layout_clone.num_buffers(), 3u);
EXPECT_EQ(layout_clone.GetTotalBufferSize(), 110592u);
for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(layout_clone.strides()[i], strides[i]);
EXPECT_EQ(layout.planes()[i].stride, strides[i]);
EXPECT_EQ(layout.planes()[i].offset, offsets[i]);
EXPECT_EQ(layout_clone.buffer_sizes()[i], buffer_sizes[i]);
}
}
......@@ -70,18 +112,21 @@ TEST(VideoFrameLayout, CopyConstructor) {
TEST(VideoFrameLayout, AssignmentOperator) {
gfx::Size coded_size = gfx::Size(320, 180);
std::vector<int32_t> strides = {384, 192, 192};
std::vector<size_t> offsets = {0, 100, 200};
std::vector<size_t> buffer_sizes = {73728, 18432, 18432};
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size, strides, buffer_sizes);
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size,
CreatePlanes(strides, offsets), buffer_sizes);
VideoFrameLayout layout_clone = layout;
EXPECT_EQ(layout_clone.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout_clone.coded_size(), coded_size);
EXPECT_EQ(layout_clone.num_strides(), 3u);
EXPECT_EQ(layout_clone.num_planes(), 3u);
EXPECT_EQ(layout_clone.num_buffers(), 3u);
EXPECT_EQ(layout_clone.GetTotalBufferSize(), 110592u);
for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(layout_clone.strides()[i], strides[i]);
EXPECT_EQ(layout_clone.planes()[i].stride, strides[i]);
EXPECT_EQ(layout_clone.planes()[i].offset, offsets[i]);
EXPECT_EQ(layout_clone.buffer_sizes()[i], buffer_sizes[i]);
}
}
......@@ -89,25 +134,28 @@ TEST(VideoFrameLayout, AssignmentOperator) {
TEST(VideoFrameLayout, MoveConstructor) {
gfx::Size coded_size = gfx::Size(320, 180);
std::vector<int32_t> strides = {384, 192, 192};
std::vector<size_t> offsets = {0, 100, 200};
std::vector<size_t> buffer_sizes = {73728, 18432, 18432};
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size, strides, buffer_sizes);
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size,
CreatePlanes(strides, offsets), buffer_sizes);
VideoFrameLayout layout_move(std::move(layout));
EXPECT_EQ(layout_move.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout_move.coded_size(), coded_size);
EXPECT_EQ(layout_move.num_strides(), 3u);
EXPECT_EQ(layout_move.num_planes(), 3u);
EXPECT_EQ(layout_move.num_buffers(), 3u);
EXPECT_EQ(layout_move.GetTotalBufferSize(), 110592u);
for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(layout_move.strides()[i], strides[i]);
EXPECT_EQ(layout_move.planes()[i].stride, strides[i]);
EXPECT_EQ(layout_move.planes()[i].offset, offsets[i]);
EXPECT_EQ(layout_move.buffer_sizes()[i], buffer_sizes[i]);
}
// Members in object being moved are cleared except const members.
EXPECT_EQ(layout.format(), PIXEL_FORMAT_I420);
EXPECT_EQ(layout.coded_size(), coded_size);
EXPECT_EQ(layout.num_strides(), 0u);
EXPECT_EQ(layout.num_planes(), 0u);
EXPECT_EQ(layout.num_buffers(), 0u);
EXPECT_EQ(layout.GetTotalBufferSize(), 0u);
}
......@@ -119,20 +167,24 @@ TEST(VideoFrameLayout, ToString) {
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size, strides, buffer_sizes);
EXPECT_EQ(layout.ToString(),
"VideoFrameLayout format:PIXEL_FORMAT_I420 coded_size:320x180 "
"num_buffers:3 buffer_sizes:[73728, 18432, 18432] num_strides:3 "
"strides:[384, 192, 192]");
"VideoFrameLayout format: PIXEL_FORMAT_I420, coded_size: 320x180, "
"num_buffers: 3, buffer_sizes: [73728, 18432, 18432], "
"num_planes: 3, "
"planes (stride, offset): [(384, 0), (192, 0), (192, 0)]");
}
TEST(VideoFrameLayout, ToStringOneBuffer) {
gfx::Size coded_size = gfx::Size(320, 180);
std::vector<int32_t> strides = {384};
std::vector<size_t> offsets = {100};
std::vector<size_t> buffer_sizes = {122880};
VideoFrameLayout layout(PIXEL_FORMAT_NV12, coded_size, strides, buffer_sizes);
VideoFrameLayout layout(PIXEL_FORMAT_NV12, coded_size,
CreatePlanes(strides, offsets), buffer_sizes);
EXPECT_EQ(layout.ToString(),
"VideoFrameLayout format:PIXEL_FORMAT_NV12 coded_size:320x180 "
"num_buffers:1 buffer_sizes:[122880] num_strides:1 strides:[384]");
"VideoFrameLayout format: PIXEL_FORMAT_NV12, coded_size: 320x180, "
"num_buffers: 1, buffer_sizes: [122880], "
"num_planes: 1, planes (stride, offset): [(384, 100)]");
}
TEST(VideoFrameLayout, ToStringNoBufferInfo) {
......@@ -140,9 +192,9 @@ TEST(VideoFrameLayout, ToStringNoBufferInfo) {
VideoFrameLayout layout(PIXEL_FORMAT_NV12, coded_size);
EXPECT_EQ(layout.ToString(),
"VideoFrameLayout format:PIXEL_FORMAT_NV12 coded_size:320x180 "
"num_buffers:4 buffer_sizes:[0, 0, 0, 0] num_strides:4 "
"strides:[0, 0, 0, 0]");
"VideoFrameLayout format: PIXEL_FORMAT_NV12, coded_size: 320x180, "
"num_buffers: 4, buffer_sizes: [0, 0, 0, 0], num_planes: 4, "
"planes (stride, offset): [(0, 0), (0, 0), (0, 0), (0, 0)]");
}
} // namespace media
......@@ -17,6 +17,7 @@
#include "base/memory/shared_memory.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libyuv/include/libyuv.h"
......@@ -387,6 +388,52 @@ TEST(VideoFrame, WrapExternalSharedMemory) {
EXPECT_EQ(frame->data(media::VideoFrame::kYPlane)[0], 0xff);
}
#if defined(OS_LINUX)
TEST(VideoFrame, WrapExternalDmabufs) {
gfx::Size coded_size = gfx::Size(256, 256);
gfx::Rect visible_rect(coded_size);
std::vector<int32_t> strides = {384, 192, 192};
std::vector<size_t> offsets = {0, 100, 200};
std::vector<size_t> buffer_sizes = {73728, 18432, 18432};
std::vector<VideoFrameLayout::Plane> planes(strides.size());
for (size_t i = 0; i < planes.size(); i++) {
planes[i].stride = strides[i];
planes[i].offset = offsets[i];
}
auto timestamp = base::TimeDelta::FromMilliseconds(1);
VideoFrameLayout layout(PIXEL_FORMAT_I420, coded_size, planes, buffer_sizes);
std::vector<int> dummy_fds = {10, 11, 12};
std::vector<base::ScopedFD> dmabuf_fds;
for (int fd : dummy_fds) {
dmabuf_fds.emplace_back(fd);
}
auto frame =
VideoFrame::WrapExternalDmabufs(layout, visible_rect, visible_rect.size(),
std::move(dmabuf_fds), timestamp);
EXPECT_EQ(frame->layout().format(), PIXEL_FORMAT_I420);
EXPECT_EQ(frame->layout().coded_size(), coded_size);
EXPECT_EQ(frame->layout().num_planes(), 3u);
EXPECT_EQ(frame->layout().num_buffers(), 3u);
EXPECT_EQ(frame->layout().GetTotalBufferSize(), 110592u);
for (size_t i = 0; i < 3; ++i) {
EXPECT_EQ(frame->layout().planes()[i].stride, strides[i]);
EXPECT_EQ(frame->layout().planes()[i].offset, offsets[i]);
EXPECT_EQ(frame->layout().buffer_sizes()[i], buffer_sizes[i]);
}
EXPECT_TRUE(frame->HasDmaBufs());
const auto& fds = frame->DmabufFds();
EXPECT_EQ(fds.size(), dummy_fds.size());
for (size_t i = 0; i < fds.size(); i++) {
EXPECT_EQ(fds[i].get(), dummy_fds[i]);
}
EXPECT_EQ(frame->coded_size(), coded_size);
EXPECT_EQ(frame->visible_rect(), visible_rect);
EXPECT_EQ(frame->timestamp(), timestamp);
}
#endif
// Ensure each frame is properly sized and allocated. Will trigger OOB reads
// and writes as well as incorrect frame hashes otherwise.
TEST(VideoFrame, CheckFrameExtents) {
......
......@@ -69,7 +69,6 @@ void PopulateVideoFrame(VideoFrame* frame, int start_value) {
// Set Y.
const int height = frame_size.height();
VLOG(1) << "frame num_strides: " << frame->layout().num_strides();
const int stride_y = frame->stride(VideoFrame::kYPlane);
uint8_t* y_plane = frame->data(VideoFrame::kYPlane);
for (int j = 0; j < height; ++j) {
......
......@@ -292,9 +292,9 @@ bool V4L2ImageProcessor::Process(const scoped_refptr<VideoFrame>& frame,
// Create the output frame
job_record->output_frame = VideoFrame::WrapExternalDmabufs(
output_format_, output_allocated_size_, gfx::Rect(output_visible_size_),
output_visible_size_, std::move(output_dmabuf_fds),
job_record->input_frame->timestamp());
VideoFrameLayout(output_format_, output_allocated_size_),
gfx::Rect(output_visible_size_), output_visible_size_,
std::move(output_dmabuf_fds), job_record->input_frame->timestamp());
if (!job_record->output_frame)
return false;
......
......@@ -2485,8 +2485,10 @@ bool V4L2VideoDecodeAccelerator::ProcessFrame(int32_t bitstream_buffer_id,
image_processor_bitstream_buffer_ids_.push(bitstream_buffer_id);
scoped_refptr<VideoFrame> input_frame = VideoFrame::WrapExternalDmabufs(
V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_),
coded_size_, gfx::Rect(visible_size_), visible_size_,
VideoFrameLayout(
V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_),
coded_size_),
gfx::Rect(visible_size_), visible_size_,
DuplicateFDs(output_record.processor_input_fds), base::TimeDelta());
if (!input_frame) {
......
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