Commit 1344c847 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/test: Remove CreatePlatformVideoFrame in video_frame_helpers.h

CreatePlatformVideoFrame in video_frame_helpers.h almost delegates
CreatePlatformVideoFrame in media/gpu/linux/platform_video_frame_utils.h.
We remove the function in media/gpu/test to reduce the code size

Bug: None
Test: video_decode_accelerator_unittest w/wo video_frame_validator
Test: video_decode_accelerator_tests w/wo video_frame_validator
Change-Id: Ice7ed5b099104d613456692c43ae8df65e67a5cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1563531Reviewed-by: default avatarDavid Staessens <dstaessens@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649791}
parent 64b722fb
......@@ -28,8 +28,8 @@ scoped_refptr<VideoFrame> CreateVideoFrameOzone(VideoPixelFormat pixel_format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
gfx::BufferUsage buffer_usage,
base::TimeDelta timestamp) {
base::TimeDelta timestamp,
gfx::BufferUsage buffer_usage) {
ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance();
DCHECK(platform);
ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone();
......@@ -88,11 +88,11 @@ scoped_refptr<VideoFrame> CreatePlatformVideoFrame(
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
gfx::BufferUsage buffer_usage,
base::TimeDelta timestamp) {
base::TimeDelta timestamp,
gfx::BufferUsage buffer_usage) {
#if defined(USE_OZONE)
return CreateVideoFrameOzone(pixel_format, coded_size, visible_rect,
natural_size, buffer_usage, timestamp);
natural_size, timestamp, buffer_usage);
#endif // defined(USE_OZONE)
NOTREACHED();
return nullptr;
......
......@@ -22,8 +22,8 @@ MEDIA_GPU_EXPORT scoped_refptr<VideoFrame> CreatePlatformVideoFrame(
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
gfx::BufferUsage buffer_usage,
base::TimeDelta timestamp);
base::TimeDelta timestamp,
gfx::BufferUsage buffer_usage);
// Create a shared GPU memory handle to the |video_frame|'s data.
MEDIA_GPU_EXPORT gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferHandle(
......
......@@ -7,12 +7,13 @@
#include <utility>
#include <vector>
#include "base/logging.h"
#include "build/build_config.h"
#include "media/gpu/test/video_frame_helpers.h"
#if defined(OS_CHROMEOS)
#if defined(OS_LINUX)
#include <libdrm/drm_fourcc.h>
#include "base/logging.h"
#include "media/gpu/linux/platform_video_frame_utils.h"
#endif
......@@ -48,8 +49,11 @@ scoped_refptr<TextureRef> TextureRef::CreatePreallocated(
#if defined(OS_CHROMEOS)
texture_ref = TextureRef::Create(texture_id, std::move(no_longer_needed_cb));
LOG_ASSERT(texture_ref);
// We set visible size to coded_size. The correct visible rectangle is set
// later in ExportVideoFrame().
texture_ref->frame_ =
CreatePlatformVideoFrame(pixel_format, size, buffer_usage);
CreatePlatformVideoFrame(pixel_format, size, gfx::Rect(size), size,
base::TimeDelta(), buffer_usage);
#endif
return texture_ref;
}
......
......@@ -155,21 +155,6 @@ scoped_refptr<VideoFrame> ConvertVideoFrame(const VideoFrame* src_frame,
return dst_frame;
}
scoped_refptr<VideoFrame> CreatePlatformVideoFrame(
VideoPixelFormat pixel_format,
const gfx::Size& size,
gfx::BufferUsage buffer_usage) {
scoped_refptr<VideoFrame> video_frame;
#if defined(OS_CHROMEOS)
gfx::Rect visible_rect(size.width(), size.height());
video_frame = media::CreatePlatformVideoFrame(
pixel_format, size, visible_rect, visible_rect.size(), buffer_usage,
base::TimeDelta());
LOG_ASSERT(video_frame) << "Failed to create Dmabuf-backed VideoFrame";
#endif
return video_frame;
}
base::Optional<VideoFrameLayout> CreateVideoFrameLayout(VideoPixelFormat format,
const gfx::Size& size,
bool single_buffer) {
......
......@@ -50,13 +50,6 @@ bool ConvertVideoFrame(const VideoFrame* src_frame, VideoFrame* dst_frame);
scoped_refptr<VideoFrame> ConvertVideoFrame(const VideoFrame* src_frame,
VideoPixelFormat dst_pixel_format);
// Create a platform-specific DMA-buffer-backed video frame with specified
// |pixel_format|, |size| and |buffer_usage|.
scoped_refptr<VideoFrame> CreatePlatformVideoFrame(
VideoPixelFormat pixel_format,
const gfx::Size& size,
gfx::BufferUsage buffer_usage = gfx::BufferUsage::SCANOUT_VDA_WRITE);
// Create a video frame layout for the specified |pixel_format| and
// |coded_size|. If |single_buffer| is true, the created VideoFrameLayout
// represents all the planes are stored in the same buffer. Otherwise, it
......
......@@ -185,8 +185,12 @@ void TestVDAVideoDecoder::ProvidePictureBuffers(
// Create a video frame for each of the picture buffers and provide memory
// handles to the video frame's data to the decoder.
for (const PictureBuffer& picture_buffer : picture_buffers) {
scoped_refptr<VideoFrame> video_frame =
CreatePlatformVideoFrame(pixel_format, size);
scoped_refptr<VideoFrame> video_frame;
#if defined(OS_LINUX)
video_frame = CreatePlatformVideoFrame(
pixel_format, size, gfx::Rect(size), size, base::TimeDelta(),
gfx::BufferUsage::SCANOUT_VDA_WRITE);
#endif
LOG_ASSERT(video_frame) << "Failed to create video frame";
video_frames_.emplace(picture_buffer.id(), video_frame);
gfx::GpuMemoryBufferHandle handle;
......
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