Commit f199bfbe authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Revert "media/gpu/VEA unittest: Fill plane pointer and stride with NULL and 0...

Revert "media/gpu/VEA unittest: Fill plane pointer and stride with NULL and 0 for 1- or 2- planes VideoFrame"

This reverts commit 04f8f2c0.

Reason for revert: breaks windowd compile

Original change's description:
> media/gpu/VEA unittest: Fill plane pointer and stride with NULL and 0 for 1- or 2- planes VideoFrame
> 
> When I enable VEA unittest to run any yuv format in crrev.com/c/1135106, I didn't
> realize the code assumed the I420 when creating frame. Therefore, it passes
> invalid pointer and wrong stride when the number of planes are less than 3.
> This change fixes it by creating video frame, taking into account the number of
> planes of input buffer format.
> 
> BUG=chromium:894381
> TEST=VEA unittest for NV12 and I420 on kevin
> 
> Change-Id: I31e157ce9317139e7cc42a38ba77b34c13d70d70
> Reviewed-on: https://chromium-review.googlesource.com/c/1293095
> Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
> Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#601489}

TBR=hiroh@chromium.org,acourbot@chromium.org

Change-Id: I02e53782dd3240da1dfd4548daefe275854601b4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:894381
Reviewed-on: https://chromium-review.googlesource.com/c/1293099Reviewed-by: default avatarFergal Daly <fergal@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601491}
parent ef325651
...@@ -1743,28 +1743,19 @@ void VEAClient::InputNoLongerNeededCallback(int32_t input_id) { ...@@ -1743,28 +1743,19 @@ void VEAClient::InputNoLongerNeededCallback(int32_t input_id) {
scoped_refptr<VideoFrame> VEAClient::CreateFrame(off_t position) { scoped_refptr<VideoFrame> VEAClient::CreateFrame(off_t position) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
CHECK_GT(current_framerate_, 0U);
size_t num_planes = VideoFrame::NumPlanes(test_stream_->pixel_format); uint8_t* frame_data_y =
CHECK_LE(num_planes, 3u);
uint8_t* frame_data[3] = {};
size_t plane_stride[3] = {};
frame_data[0] =
reinterpret_cast<uint8_t*>(&test_stream_->aligned_in_file_data[0]) + reinterpret_cast<uint8_t*>(&test_stream_->aligned_in_file_data[0]) +
position; position;
for (size_t i = 1; i < num_planes; i++) { uint8_t* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0];
frame_data[i] = frame_data[i - 1] + test_stream_->aligned_plane_size[i - 1]; uint8_t* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1];
} CHECK_GT(current_framerate_, 0U);
for (size_t i = 0; i < num_planes; i++) {
plane_stride[i] = VideoFrame::RowBytes(i, test_stream_->pixel_format,
input_coded_size_.width());
}
scoped_refptr<VideoFrame> video_frame = VideoFrame::WrapExternalYuvData( scoped_refptr<VideoFrame> video_frame = VideoFrame::WrapExternalYuvData(
test_stream_->pixel_format, input_coded_size_, test_stream_->pixel_format, input_coded_size_,
gfx::Rect(test_stream_->visible_size), test_stream_->visible_size, gfx::Rect(test_stream_->visible_size), test_stream_->visible_size,
plane_stride[0], plane_stride[1], plane_stride[2], frame_data[0], input_coded_size_.width(), input_coded_size_.width() / 2,
frame_data[1], frame_data[2], input_coded_size_.width() / 2, frame_data_y, frame_data_u, frame_data_v,
// Timestamp needs to avoid starting from 0. // Timestamp needs to avoid starting from 0.
base::TimeDelta().FromMilliseconds((next_input_id_ + 1) * base::TimeDelta().FromMilliseconds((next_input_id_ + 1) *
base::Time::kMillisecondsPerSecond / base::Time::kMillisecondsPerSecond /
...@@ -2288,24 +2279,22 @@ void VEACacheLineUnalignedInputClient::FeedEncoderWithOneInput( ...@@ -2288,24 +2279,22 @@ void VEACacheLineUnalignedInputClient::FeedEncoderWithOneInput(
return; return;
const VideoPixelFormat pixel_format = g_env->test_streams_[0]->pixel_format; const VideoPixelFormat pixel_format = g_env->test_streams_[0]->pixel_format;
size_t num_planes = VideoFrame::NumPlanes(pixel_format);
CHECK_LE(num_planes, 3);
std::vector<char, AlignedAllocator<char, kPlatformBufferAlignment>> std::vector<char, AlignedAllocator<char, kPlatformBufferAlignment>>
aligned_data[3]; aligned_data_y, aligned_data_u, aligned_data_v;
uint8_t* frame_data[3] = {}; aligned_data_y.resize(
uint8_t plane_stride[3] = {}; VideoFrame::PlaneSize(pixel_format, 0, input_coded_size).GetArea());
for (size_t i = 0; i < num_planes; i++) { aligned_data_u.resize(
aligned_data[i].resize( VideoFrame::PlaneSize(pixel_format, 1, input_coded_size).GetArea());
VideoFrame::PlaneSize(pixel_format, i, input_coded_size).GetArea()); aligned_data_v.resize(
frame_data[i] = reinterpret_cast<uint8_t*>(aligned_data[i].data()); VideoFrame::PlaneSize(pixel_format, 2, input_coded_size).GetArea());
plane_stride[i] = uint8_t* frame_data_y = reinterpret_cast<uint8_t*>(&aligned_data_y[0]);
VideoFrame::RowBytes(i, pixel_format, input_coded_size.width()); uint8_t* frame_data_u = reinterpret_cast<uint8_t*>(&aligned_data_u[0]);
} uint8_t* frame_data_v = reinterpret_cast<uint8_t*>(&aligned_data_v[0]);
scoped_refptr<VideoFrame> video_frame = VideoFrame::WrapExternalYuvData( scoped_refptr<VideoFrame> video_frame = VideoFrame::WrapExternalYuvData(
pixel_format, input_coded_size, gfx::Rect(input_coded_size), pixel_format, input_coded_size, gfx::Rect(input_coded_size),
input_coded_size, plane_stride[0], plane_stride[1], plane_stride[2], input_coded_size, input_coded_size.width(), input_coded_size.width() / 2,
frame_data[0], frame_data[1], frame_data[2], input_coded_size.width() / 2, frame_data_y, frame_data_u, frame_data_v,
base::TimeDelta().FromMilliseconds(base::Time::kMillisecondsPerSecond / base::TimeDelta().FromMilliseconds(base::Time::kMillisecondsPerSecond /
fps_)); fps_));
......
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