Commit 96d56fbc authored by David Staessens's avatar David Staessens Committed by Commit Bot

media/gpu/test: Remove video_decode_accelerator_unittest and associated helpers.

This CL removes the video_decode_accelerator_unittest and associated helpers.
These tests have been deprecated in favor of the video_decode_accelerator_tests
and video_decode_accelerator_perf_tests targets.

The video_decode_accelerator_unittest for the Android platform seems to use a
completely different test binary so this test has been retained.

TEST=./video_decode_accelerator_tests on eve

BUG=1802897

Change-Id: I66565844be5608f560f3a56ca72aa579c7c1c68e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1851629
Commit-Queue: David Staessens <dstaessens@chromium.org>
Reviewed-by: default avatarTakuto Ikuta <tikuta@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708534}
parent b2afb6f4
...@@ -327,11 +327,6 @@ group("gn_all") { ...@@ -327,11 +327,6 @@ group("gn_all") {
"//content/public/android:content_junit_tests", "//content/public/android:content_junit_tests",
"//content/shell/android:content_shell_apk", "//content/shell/android:content_shell_apk",
"//device:device_junit_tests", "//device:device_junit_tests",
"//weblayer/shell/android:weblayer_demo_apk",
"//weblayer/shell/android:weblayer_shell_apk",
# TODO(https://crbug.com/879065): remove once tests have been migrated to
# the video_decode_accelerator_tests target.
"//media/gpu:video_decode_accelerator_unittest", "//media/gpu:video_decode_accelerator_unittest",
"//net/android:net_junit_tests", "//net/android:net_junit_tests",
"//services:service_junit_tests", "//services:service_junit_tests",
...@@ -347,6 +342,8 @@ group("gn_all") { ...@@ -347,6 +342,8 @@ group("gn_all") {
"//tools/android/errorprone_plugin:errorprone_plugin_java", "//tools/android/errorprone_plugin:errorprone_plugin_java",
"//tools/android/kerberos/SpnegoAuthenticator:spnego_authenticator_apk", "//tools/android/kerberos/SpnegoAuthenticator:spnego_authenticator_apk",
"//ui/android:ui_junit_tests", "//ui/android:ui_junit_tests",
"//weblayer/shell/android:weblayer_demo_apk",
"//weblayer/shell/android:weblayer_shell_apk",
] ]
deps -= [ deps -= [
"//net:net_perftests", "//net:net_perftests",
...@@ -918,10 +915,6 @@ if (is_chromeos) { ...@@ -918,10 +915,6 @@ if (is_chromeos) {
"//components/chromeos_camera:jpeg_encode_accelerator_unittest", "//components/chromeos_camera:jpeg_encode_accelerator_unittest",
"//media/gpu:video_decode_accelerator_perf_tests", "//media/gpu:video_decode_accelerator_perf_tests",
"//media/gpu:video_decode_accelerator_tests", "//media/gpu:video_decode_accelerator_tests",
# TODO(https://crbug.com/879065): remove once tests have been migrated
# to the above target.
"//media/gpu:video_decode_accelerator_unittest",
"//media/gpu:video_encode_accelerator_unittest", "//media/gpu:video_encode_accelerator_unittest",
] ]
} }
......
...@@ -91,7 +91,7 @@ cast_test_group("cast_tests") { ...@@ -91,7 +91,7 @@ cast_test_group("cast_tests") {
} }
if (use_v4l2_codec) { if (use_v4l2_codec) {
tests += [ "//media/gpu:video_decode_accelerator_unittest" ] tests += [ "//media/gpu:video_decode_accelerator_tests" ]
} }
if (is_linux) { if (is_linux) {
......
...@@ -395,20 +395,25 @@ if (use_v4l2_codec || use_vaapi) { ...@@ -395,20 +395,25 @@ if (use_v4l2_codec || use_vaapi) {
} }
# TODO(watk): Run this on bots. http://crbug.com/461437 # TODO(watk): Run this on bots. http://crbug.com/461437
if (is_win || is_android || use_v4l2_codec || use_vaapi) { if (is_android) {
test("video_decode_accelerator_unittest") { test("video_decode_accelerator_unittest") {
data = [ data = [
"//media/test/data/", "//media/test/data/",
] ]
deps = [ deps = [
":android_video_decode_accelerator_unittests",
":common", ":common",
":gpu", ":gpu",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//gpu/command_buffer/service:android_texture_owner_unittests",
"//media:test_support", "//media:test_support",
"//media/base/android:media_java",
"//media/test:run_all_unittests",
"//mojo/core/embedder", "//mojo/core/embedder",
"//testing/gtest", "//testing/gtest",
"//ui/android:ui_java",
"//ui/base", "//ui/base",
"//ui/display/manager", "//ui/display/manager",
"//ui/gfx", "//ui/gfx",
...@@ -420,51 +425,6 @@ if (is_win || is_android || use_v4l2_codec || use_vaapi) { ...@@ -420,51 +425,6 @@ if (is_win || is_android || use_v4l2_codec || use_vaapi) {
] ]
configs += [ "//third_party/khronos:khronos_headers" ] configs += [ "//third_party/khronos:khronos_headers" ]
if (is_win || is_chromeos || use_v4l2_codec) {
sources = [
"test/fake_video_decode_accelerator.cc",
"test/fake_video_decode_accelerator.h",
"video_decode_accelerator_unittest.cc",
]
deps += [
"test:decode_helpers",
"test:frame_file_writer",
"test:frame_validator",
"//mojo/core/embedder",
"//ui/display",
"//ui/display/types",
"//ui/platform_window",
]
}
if (is_android) {
deps += [
":android_video_decode_accelerator_unittests",
"//gpu/command_buffer/service:android_texture_owner_unittests",
"//media/base/android:media_java",
"//media/test:run_all_unittests",
"//ui/android:ui_java",
]
}
if (is_win) {
# TODO(https://crbug.com/167187): Fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
deps += [
"//third_party/angle:libEGL",
"//third_party/angle:libGLESv2",
]
}
if (use_x11) {
configs += [ "//build/config/linux:x11" ]
deps += [ "//ui/gfx/x" ]
}
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
} }
} }
...@@ -658,7 +618,6 @@ if (use_v4l2_codec || use_vaapi) { ...@@ -658,7 +618,6 @@ if (use_v4l2_codec || use_vaapi) {
"test:frame_validator", "test:frame_validator",
"test:helpers", "test:helpers",
"test:image_processor", "test:image_processor",
"test:render_helpers",
"//base/test:test_support", "//base/test:test_support",
"//media:test_support", "//media:test_support",
"//media/gpu/chromeos:fourcc", "//media/gpu/chromeos:fourcc",
......
...@@ -37,24 +37,6 @@ source_set("helpers") { ...@@ -37,24 +37,6 @@ source_set("helpers") {
} }
} }
source_set("render_helpers") {
testonly = true
sources = [
"rendering_helper.cc",
"rendering_helper.h",
"texture_ref.cc",
"texture_ref.h",
]
deps = [
":helpers",
"//media/gpu",
"//ui/gl/init:init",
]
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
}
source_set("frame_validator") { source_set("frame_validator") {
testonly = true testonly = true
sources = [ sources = [
...@@ -76,7 +58,6 @@ source_set("frame_file_writer") { ...@@ -76,7 +58,6 @@ source_set("frame_file_writer") {
] ]
deps = [ deps = [
":helpers", ":helpers",
":render_helpers",
"//media/gpu", "//media/gpu",
"//ui/gfx/codec:codec", "//ui/gfx/codec:codec",
] ]
...@@ -90,7 +71,6 @@ source_set("decode_helpers") { ...@@ -90,7 +71,6 @@ source_set("decode_helpers") {
] ]
public_deps = [ public_deps = [
":helpers", ":helpers",
":render_helpers",
] ]
deps = [ deps = [
"//media/gpu", "//media/gpu",
...@@ -166,7 +146,6 @@ if (use_vaapi || use_v4l2_codec) { ...@@ -166,7 +146,6 @@ if (use_vaapi || use_v4l2_codec) {
] ]
deps = [ deps = [
":helpers", ":helpers",
":render_helpers",
"//media:test_support", "//media:test_support",
"//media/gpu", "//media/gpu",
"//media/gpu/chromeos:fourcc", "//media/gpu/chromeos:fourcc",
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/gpu/test/fake_video_decode_accelerator.h"
#include <stddef.h>
#include <string.h>
#include <memory>
#include "base/bind.h"
#include "base/location.h"
#include "base/threading/thread_task_runner_handle.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/limits.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/gl_surface_glx.h"
namespace media {
static const uint32_t kDefaultTextureTarget = GL_TEXTURE_2D;
// Must be at least 2 since the rendering helper will switch between textures
// and if there is only one, it will wait for the next one that will never come.
// Must also be an even number as otherwise there won't be the same amount of
// white and black frames.
static const unsigned int kNumBuffers =
limits::kMaxVideoFrames + (limits::kMaxVideoFrames & 1u);
FakeVideoDecodeAccelerator::FakeVideoDecodeAccelerator(
const gfx::Size& size,
const MakeGLContextCurrentCallback& make_context_current_cb)
: child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
client_(NULL),
make_context_current_cb_(make_context_current_cb),
frame_buffer_size_(size),
flushing_(false) {}
FakeVideoDecodeAccelerator::~FakeVideoDecodeAccelerator() = default;
bool FakeVideoDecodeAccelerator::Initialize(const Config& config,
Client* client) {
DCHECK(child_task_runner_->BelongsToCurrentThread());
if (config.profile == VIDEO_CODEC_PROFILE_UNKNOWN) {
LOG(ERROR) << "unknown codec profile";
return false;
}
if (config.is_encrypted()) {
NOTREACHED() << "encrypted streams are not supported";
return false;
}
// V4L2VideoDecodeAccelerator waits until first decode call to ask for buffers
// This class asks for it on initialization instead.
client_ = client;
client_->ProvidePictureBuffers(kNumBuffers, PIXEL_FORMAT_UNKNOWN, 1,
frame_buffer_size_, kDefaultTextureTarget);
return true;
}
void FakeVideoDecodeAccelerator::Decode(BitstreamBuffer bitstream_buffer) {
if (bitstream_buffer.id() < 0) {
LOG(ERROR) << "Invalid bitstream: id=" << bitstream_buffer.id();
client_->NotifyError(INVALID_ARGUMENT);
return;
}
int bitstream_buffer_id = bitstream_buffer.id();
queued_bitstream_ids_.push(bitstream_buffer_id);
child_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&FakeVideoDecodeAccelerator::DoPictureReady,
weak_this_factory_.GetWeakPtr()));
}
// Similar to UseOutputBitstreamBuffer for the encode accelerator.
void FakeVideoDecodeAccelerator::AssignPictureBuffers(
const std::vector<PictureBuffer>& buffers) {
DCHECK(buffers.size() == kNumBuffers);
DCHECK(!(buffers.size() % 2));
// Save buffers and mark all buffers as ready for use.
std::unique_ptr<uint8_t[]> white_data(
new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() *
4]);
memset(white_data.get(), UINT8_MAX,
frame_buffer_size_.width() * frame_buffer_size_.height() * 4);
std::unique_ptr<uint8_t[]> black_data(
new uint8_t[frame_buffer_size_.width() * frame_buffer_size_.height() *
4]);
memset(black_data.get(), 0,
frame_buffer_size_.width() * frame_buffer_size_.height() * 4);
if (!make_context_current_cb_.Run()) {
LOG(ERROR) << "ReusePictureBuffer(): could not make context current";
return;
}
for (size_t index = 0; index < buffers.size(); ++index) {
DCHECK_LE(1u, buffers[index].service_texture_ids().size());
glBindTexture(GL_TEXTURE_2D, buffers[index].service_texture_ids()[0]);
// Every other frame white and the rest black.
uint8_t* data = index % 2 ? white_data.get() : black_data.get();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, frame_buffer_size_.width(),
frame_buffer_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
free_output_buffers_.push(buffers[index].id());
}
child_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&FakeVideoDecodeAccelerator::DoPictureReady,
weak_this_factory_.GetWeakPtr()));
}
void FakeVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_buffer_id) {
free_output_buffers_.push(picture_buffer_id);
child_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&FakeVideoDecodeAccelerator::DoPictureReady,
weak_this_factory_.GetWeakPtr()));
}
void FakeVideoDecodeAccelerator::Flush() {
flushing_ = true;
child_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&FakeVideoDecodeAccelerator::DoPictureReady,
weak_this_factory_.GetWeakPtr()));
}
void FakeVideoDecodeAccelerator::Reset() {
while (!queued_bitstream_ids_.empty()) {
client_->NotifyEndOfBitstreamBuffer(queued_bitstream_ids_.front());
queued_bitstream_ids_.pop();
}
client_->NotifyResetDone();
}
void FakeVideoDecodeAccelerator::Destroy() {
while (!queued_bitstream_ids_.empty()) {
client_->NotifyEndOfBitstreamBuffer(queued_bitstream_ids_.front());
queued_bitstream_ids_.pop();
}
delete this;
}
bool FakeVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread(
const base::WeakPtr<Client>& decode_client,
const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) {
return false;
}
void FakeVideoDecodeAccelerator::DoPictureReady() {
if (flushing_ && queued_bitstream_ids_.empty()) {
flushing_ = false;
client_->NotifyFlushDone();
}
while (!free_output_buffers_.empty() && !queued_bitstream_ids_.empty()) {
int bitstream_id = queued_bitstream_ids_.front();
queued_bitstream_ids_.pop();
int buffer_id = free_output_buffers_.front();
free_output_buffers_.pop();
const Picture picture =
Picture(buffer_id, bitstream_id, gfx::Rect(frame_buffer_size_),
gfx::ColorSpace(), false);
client_->PictureReady(picture);
// Bitstream no longer needed.
client_->NotifyEndOfBitstreamBuffer(bitstream_id);
if (flushing_ && queued_bitstream_ids_.empty()) {
flushing_ = false;
client_->NotifyFlushDone();
}
}
}
} // namespace media
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_TEST_FAKE_VIDEO_DECODE_ACCELERATOR_H_
#define MEDIA_GPU_TEST_FAKE_VIDEO_DECODE_ACCELERATOR_H_
#include <stdint.h>
#include <vector>
#include "base/containers/queue.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "media/gpu/gpu_video_decode_accelerator_helpers.h"
#include "media/video/video_decode_accelerator.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gl/gl_context.h"
namespace media {
class FakeVideoDecodeAccelerator : public VideoDecodeAccelerator {
public:
FakeVideoDecodeAccelerator(
const gfx::Size& size,
const MakeGLContextCurrentCallback& make_context_current_cb);
~FakeVideoDecodeAccelerator() override;
bool Initialize(const Config& config, Client* client) override;
void Decode(BitstreamBuffer bitstream_buffer) override;
void AssignPictureBuffers(const std::vector<PictureBuffer>& buffers) override;
void ReusePictureBuffer(int32_t picture_buffer_id) override;
void Flush() override;
void Reset() override;
void Destroy() override;
bool TryToSetupDecodeOnSeparateThread(
const base::WeakPtr<Client>& decode_client,
const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner)
override;
private:
void DoPictureReady();
// The message loop that created the class. Used for all callbacks. This
// class expects all calls to this class to be on this message loop (not
// checked).
const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_;
Client* client_;
// Make our context current before running any GL entry points.
MakeGLContextCurrentCallback make_context_current_cb_;
// Output picture size.
gfx::Size frame_buffer_size_;
// Picture buffer ids that are available for putting fake frames in.
base::queue<int> free_output_buffers_;
// BitstreamBuffer ids for buffers that contain new data to decode.
base::queue<int> queued_bitstream_ids_;
bool flushing_;
// The WeakPtrFactory for |weak_this_|.
base::WeakPtrFactory<FakeVideoDecodeAccelerator> weak_this_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FakeVideoDecodeAccelerator);
};
} // namespace media
#endif // MEDIA_GPU_TEST_FAKE_VIDEO_DECODE_ACCELERATOR_H_
This diff is collapsed.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_TEST_RENDERING_HELPER_H_
#define MEDIA_GPU_TEST_RENDERING_HELPER_H_
#include <stddef.h>
#include <stdint.h>
#include <map>
#include <memory>
#include <vector>
#include "base/cancelable_callback.h"
#include "base/containers/queue.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "media/base/video_types.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
namespace base {
class WaitableEvent;
}
namespace media {
namespace test {
class TextureRef;
} // namespace test
// TODO(dstaessens@) Most functionality can be removed from this file when the
// video_decode_accelerator_unittests are deprecated in favor of the new
// video_decode_accelerator_test.
class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> {
public:
uint32_t texture_id() const { return texture_id_; }
uint32_t texture_target() const { return texture_target_; }
VideoFrameTexture(uint32_t texture_target,
uint32_t texture_id,
const base::Closure& no_longer_needed_cb);
private:
friend class base::RefCounted<VideoFrameTexture>;
uint32_t texture_target_;
uint32_t texture_id_;
base::Closure no_longer_needed_cb_;
~VideoFrameTexture();
};
struct RenderingHelperParams {
// The target rendering FPS. A value of 0 makes the RenderingHelper return
// frames immediately.
int rendering_fps = 0;
// The number of windows. We play each stream in its own window
// on the screen.
int num_windows = 0;
// The members below are only used for the thumbnail mode where all frames
// are rendered in sequence onto one FBO for comparison/verification purposes.
// Whether the frames are rendered as scaled thumbnails within a
// larger FBO that is in turn rendered to the window.
bool render_as_thumbnails = false;
// The size of the FBO containing all visible thumbnails.
gfx::Size thumbnails_page_size;
// The size of each thumbnail within the FBO.
gfx::Size thumbnail_size;
};
// Creates and draws textures used by the video decoder.
// This class is not thread safe and thus all the methods of this class
// (except for ctor/dtor) ensure they're being run on a single thread.
class RenderingHelper {
public:
RenderingHelper();
~RenderingHelper();
// Initialize GL. This method must be called on the rendering thread.
static void InitializeOneOff(bool use_gl, base::WaitableEvent* done);
// Create the render context and windows by the specified
// dimensions. This method must be called on the rendering thread.
void Initialize(const RenderingHelperParams& params,
base::WaitableEvent* done);
// Undo the effects of Initialize() and signal |*done|. This method
// must be called on the rendering thread.
void UnInitialize(base::WaitableEvent* done);
// Return a newly-created media::test::TextureRef of the specified size and
// pixel format. If pre_allocate is true, NativePixmap is allocated in this
// function.
scoped_refptr<media::test::TextureRef> CreateTexture(
uint32_t texture_target,
bool pre_allocate,
VideoPixelFormat pixel_format,
const gfx::Size& size);
// If |render_as_thumbnails_| is true, renders |video_frame| as thumbnail.
// Otherwise, queues |video_frame| to |pending_frames|.
void ConsumeVideoFrame(size_t window_id,
scoped_refptr<VideoFrameTexture> video_frame);
// Flushes the pending frames. Notify the rendering_helper there won't be
// more video frames.
void Flush(size_t window_id);
// Get the GL context.
gl::GLContext* GetGLContext();
// Get rendered thumbnails as RGBA.
void GetThumbnailsAsRGBA(std::vector<unsigned char>* rgba,
base::WaitableEvent* done);
// Delete the texture with specified |texture_id|.
static void DeleteTexture(uint32_t texture_id);
// Set the GL viewport to the specified |area|.
static void GLSetViewPort(const gfx::Rect& area);
// Create a shader with specified |program| id and |type| by compiling the
// shader |source| code with length |size|.
static void CreateShader(GLuint program,
GLenum type,
const char* source,
int size);
// Render |texture_id| to the current view port of the screen using target
// |texture_target|.
static void RenderTexture(uint32_t texture_target, uint32_t texture_id);
private:
struct RenderedVideo {
// True if there won't be any new video frames comming.
bool is_flushing = false;
// The number of frames need to be dropped to catch up the rendering. We
// always keep the last remaining frame in pending_frames even after it
// has been rendered, so that we have something to display if the client
// is falling behind on providing us with new frames during timer-driven
// playback.
int frames_to_drop = 0;
// The video frames pending for rendering.
base::queue<scoped_refptr<VideoFrameTexture>> pending_frames;
RenderedVideo();
RenderedVideo(const RenderedVideo& other);
~RenderedVideo();
};
// Render thumbnail in the |texture_id| to the FBO buffer using target
// |texture_target|.
void RenderThumbnail(uint32_t texture_target, uint32_t texture_id);
// Queues the |video_frame| for rendering.
void QueueVideoFrame(size_t window_id,
scoped_refptr<VideoFrameTexture> video_frame);
// Return a newly-created GLES2 texture id of the specified size.
uint32_t CreateTextureId(uint32_t texture_target, const gfx::Size& size);
void Clear();
void RenderContent();
void DropOneFrameForAllVideos();
void ScheduleNextRenderContent();
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<gl::GLContext> gl_context_;
scoped_refptr<gl::GLSurface> gl_surface_;
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
std::vector<RenderedVideo> videos_;
bool render_as_thumbnails_;
int frame_count_;
GLuint thumbnails_fbo_id_;
GLuint thumbnails_texture_id_;
gfx::Size thumbnails_fbo_size_;
gfx::Size thumbnail_size_;
GLuint vertex_buffer_;
GLuint program_;
static bool use_gl_;
base::TimeDelta frame_duration_;
base::TimeTicks scheduled_render_time_;
base::CancelableClosure render_task_;
base::TimeTicks vsync_timebase_;
DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
};
} // namespace media
#endif // MEDIA_GPU_TEST_RENDERING_HELPER_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/gpu/test/texture_ref.h"
#include <utility>
#include <vector>
#include "base/logging.h"
#include "build/build_config.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "media/gpu/test/video_frame_helpers.h"
#if defined(OS_LINUX)
#include <libdrm/drm_fourcc.h>
#endif // defined(OS_LINUX)
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
#include "media/gpu/linux/platform_video_frame_utils.h"
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
namespace media {
namespace test {
TextureRef::TextureRef(uint32_t texture_id,
base::OnceClosure no_longer_needed_cb)
: texture_id_(texture_id),
no_longer_needed_cb_(std::move(no_longer_needed_cb)) {}
TextureRef::~TextureRef() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::move(no_longer_needed_cb_).Run();
}
// static
scoped_refptr<TextureRef> TextureRef::Create(
uint32_t texture_id,
base::OnceClosure no_longer_needed_cb) {
return base::WrapRefCounted(
new TextureRef(texture_id, std::move(no_longer_needed_cb)));
}
// static
scoped_refptr<TextureRef> TextureRef::CreatePreallocated(
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
uint32_t texture_id,
base::OnceClosure no_longer_needed_cb,
VideoPixelFormat pixel_format,
const gfx::Size& size,
gfx::BufferUsage buffer_usage) {
scoped_refptr<TextureRef> texture_ref;
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
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(
gpu_memory_buffer_factory, pixel_format, size, gfx::Rect(size), size,
base::TimeDelta(), buffer_usage);
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
return texture_ref;
}
gfx::GpuMemoryBufferHandle TextureRef::ExportGpuMemoryBufferHandle() const {
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
auto handle = CreateGpuMemoryBufferHandle(frame_.get());
DCHECK(!handle.is_null());
return handle;
#else
return gfx::GpuMemoryBufferHandle();
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
}
scoped_refptr<VideoFrame> TextureRef::ExportVideoFrame(
gfx::Rect visible_rect) const {
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
return VideoFrame::WrapVideoFrame(frame_, frame_->format(), visible_rect,
visible_rect.size());
#else
return nullptr;
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
}
} // namespace test
} // namespace media
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_TEST_TEXTURE_REF_H_
#define MEDIA_GPU_TEST_TEXTURE_REF_H_
#include "base/memory/scoped_refptr.h"
#include "base/threading/thread_checker.h"
#include "media/base/video_frame.h"
#include "media/base/video_types.h"
#include "media/gpu/buildflags.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace gpu {
class GpuMemoryBufferFactory;
}
namespace media {
namespace test {
// A helper class used to manage the lifetime of a Texture. Can be backed by
// either a buffer allocated by the VDA, or by a preallocated pixmap.
class TextureRef : public base::RefCounted<TextureRef> {
public:
static scoped_refptr<TextureRef> Create(
uint32_t texture_id,
base::OnceClosure no_longer_needed_cb);
static scoped_refptr<TextureRef> CreatePreallocated(
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
uint32_t texture_id,
base::OnceClosure no_longer_needed_cb,
VideoPixelFormat pixel_format,
const gfx::Size& size,
gfx::BufferUsage buffer_usage);
gfx::GpuMemoryBufferHandle ExportGpuMemoryBufferHandle() const;
scoped_refptr<VideoFrame> ExportVideoFrame(gfx::Rect visible_rect) const;
int32_t texture_id() const { return texture_id_; }
private:
friend class base::RefCounted<TextureRef>;
TextureRef(uint32_t texture_id, base::OnceClosure no_longer_needed_cb);
~TextureRef();
uint32_t texture_id_;
base::OnceClosure no_longer_needed_cb_;
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
scoped_refptr<VideoFrame> frame_;
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
THREAD_CHECKER(thread_checker_);
};
} // namespace test
} // namespace media
#endif // MEDIA_GPU_TEST_TEXTURE_REF_H_
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
#include "media/gpu/macros.h" #include "media/gpu/macros.h"
#include "media/gpu/test/rendering_helper.h"
#include "media/video/h264_parser.h" #include "media/video/h264_parser.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -24,63 +23,11 @@ ...@@ -24,63 +23,11 @@
namespace media { namespace media {
namespace test { namespace test {
namespace {
const size_t kMD5StringLength = 32;
} // namespace
VideoDecodeAcceleratorTestEnvironment::VideoDecodeAcceleratorTestEnvironment(
bool use_gl_renderer)
: use_gl_renderer_(use_gl_renderer),
rendering_thread_("GLRenderingVDAClientThread") {}
VideoDecodeAcceleratorTestEnvironment::
~VideoDecodeAcceleratorTestEnvironment() {}
void VideoDecodeAcceleratorTestEnvironment::SetUp() {
base::Thread::Options options;
options.message_pump_type = base::MessagePumpType::UI;
rendering_thread_.StartWithOptions(options);
base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
rendering_thread_.task_runner()->PostTask(
FROM_HERE, base::BindOnce(&RenderingHelper::InitializeOneOff,
use_gl_renderer_, &done));
done.Wait();
#if defined(OS_CHROMEOS)
gpu_helper_.reset(new ui::OzoneGpuTestHelper());
// Need to initialize after the rendering side since the rendering side
// initializes the "GPU" parts of Ozone.
//
// This also needs to be done in the test environment since this shouldn't
// be initialized multiple times for the same Ozone platform.
gpu_helper_->Initialize(base::ThreadTaskRunnerHandle::Get());
#endif
}
void VideoDecodeAcceleratorTestEnvironment::TearDown() {
#if defined(OS_CHROMEOS)
gpu_helper_.reset();
#endif
rendering_thread_.Stop();
}
scoped_refptr<base::SingleThreadTaskRunner>
VideoDecodeAcceleratorTestEnvironment::GetRenderingTaskRunner() const {
return rendering_thread_.task_runner();
}
EncodedDataHelper::EncodedDataHelper(const std::string& data,
VideoCodecProfile profile)
: data_(data), profile_(profile) {}
EncodedDataHelper::EncodedDataHelper(const std::vector<uint8_t>& stream, EncodedDataHelper::EncodedDataHelper(const std::vector<uint8_t>& stream,
VideoCodecProfile profile) VideoCodecProfile profile)
: EncodedDataHelper( : data_(std::string(reinterpret_cast<const char*>(stream.data()),
std::string(reinterpret_cast<const char*>(stream.data()), stream.size())),
stream.size()), profile_(profile) {}
profile) {}
EncodedDataHelper::~EncodedDataHelper() { EncodedDataHelper::~EncodedDataHelper() {
base::STLClearObject(&data_); base::STLClearObject(&data_);
...@@ -210,51 +157,5 @@ bool EncodedDataHelper::HasConfigInfo(const uint8_t* data, ...@@ -210,51 +157,5 @@ bool EncodedDataHelper::HasConfigInfo(const uint8_t* data,
return false; return false;
} }
// Read in golden MD5s for the thumbnailed rendering of this video
std::vector<std::string> ReadGoldenThumbnailMD5s(
const base::FilePath& md5_file_path) {
std::vector<std::string> golden_md5s;
std::vector<std::string> md5_strings;
std::string all_md5s;
base::ReadFileToString(md5_file_path, &all_md5s);
md5_strings = base::SplitString(all_md5s, "\n", base::TRIM_WHITESPACE,
base::SPLIT_WANT_ALL);
// Check these are legitimate MD5s.
for (const std::string& md5_string : md5_strings) {
// Ignore the empty string added by SplitString
if (!md5_string.length())
continue;
// Ignore comments
if (md5_string.at(0) == '#')
continue;
bool valid_length = md5_string.length() == kMD5StringLength;
LOG_IF(ERROR, !valid_length) << "MD5 length error: " << md5_string;
bool hex_only = std::count_if(md5_string.begin(), md5_string.end(),
isxdigit) == kMD5StringLength;
LOG_IF(ERROR, !hex_only) << "MD5 includes non-hex char: " << md5_string;
if (valid_length && hex_only)
golden_md5s.push_back(md5_string);
}
LOG_IF(ERROR, md5_strings.empty())
<< " MD5 checksum file (" << md5_file_path.MaybeAsASCII()
<< ") missing or empty.";
return golden_md5s;
}
bool ConvertRGBAToRGB(const std::vector<unsigned char>& rgba,
std::vector<unsigned char>* rgb) {
size_t num_pixels = rgba.size() / 4;
rgb->resize(num_pixels * 3);
// Drop the alpha channel, but check as we go that it is all 0xff.
bool solid = true;
for (size_t i = 0; i < num_pixels; i++) {
(*rgb)[3 * i] = rgba[4 * i];
(*rgb)[3 * i + 1] = rgba[4 * i + 1];
(*rgb)[3 * i + 2] = rgba[4 * i + 2];
solid = solid && (rgba[4 * i + 3] == 0xff);
}
return solid;
}
} // namespace test } // namespace test
} // namespace media } // namespace media
...@@ -24,41 +24,11 @@ ...@@ -24,41 +24,11 @@
#include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/native_pixmap.h" #include "ui/gfx/native_pixmap.h"
#if defined(OS_CHROMEOS)
namespace ui {
class OzoneGpuTestHelper;
} // namespace ui
#endif
namespace media { namespace media {
namespace test { namespace test {
// Initialize the GPU thread for rendering. We only need to setup once
// for all test cases.
class VideoDecodeAcceleratorTestEnvironment : public ::testing::Environment {
public:
explicit VideoDecodeAcceleratorTestEnvironment(bool use_gl_renderer);
virtual ~VideoDecodeAcceleratorTestEnvironment();
void SetUp() override;
void TearDown() override;
scoped_refptr<base::SingleThreadTaskRunner> GetRenderingTaskRunner() const;
private:
bool use_gl_renderer_;
base::Thread rendering_thread_;
#if defined(OS_CHROMEOS)
std::unique_ptr<ui::OzoneGpuTestHelper> gpu_helper_;
#endif
DISALLOW_COPY_AND_ASSIGN(VideoDecodeAcceleratorTestEnvironment);
};
class EncodedDataHelper { class EncodedDataHelper {
public: public:
// TODO(dstaessens@) Remove this constructor once the VDA tests are migrated.
EncodedDataHelper(const std::string& encoded_data, VideoCodecProfile profile);
EncodedDataHelper(const std::vector<uint8_t>& stream, EncodedDataHelper(const std::vector<uint8_t>& stream,
VideoCodecProfile profile); VideoCodecProfile profile);
~EncodedDataHelper(); ~EncodedDataHelper();
...@@ -94,15 +64,6 @@ class EncodedDataHelper { ...@@ -94,15 +64,6 @@ class EncodedDataHelper {
size_t num_skipped_fragments_ = 0; size_t num_skipped_fragments_ = 0;
}; };
// Read in golden MD5s for the thumbnailed rendering of this video
std::vector<std::string> ReadGoldenThumbnailMD5s(
const base::FilePath& md5_file_path);
// Convert from RGBA to RGB.
// Return false if any alpha channel is not 0xff, otherwise true.
bool ConvertRGBAToRGB(const std::vector<unsigned char>& rgba,
std::vector<unsigned char>* rgb);
} // namespace test } // namespace test
} // namespace media } // namespace media
#endif // MEDIA_GPU_TEST_VIDEO_DECODE_ACCELERATOR_UNITTEST_HELPERS_H_ #endif // MEDIA_GPU_TEST_VIDEO_DECODE_ACCELERATOR_UNITTEST_HELPERS_H_
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/gpu/test/rendering_helper.h"
#include "media/gpu/test/video_decode_accelerator_unittest_helpers.h" #include "media/gpu/test/video_decode_accelerator_unittest_helpers.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
#include "ui/gl/gl_context.h" #include "ui/gl/gl_context.h"
...@@ -79,7 +78,7 @@ GLuint CreateTexture(GLenum texture_target, const gfx::Size& size) { ...@@ -79,7 +78,7 @@ GLuint CreateTexture(GLenum texture_target, const gfx::Size& size) {
glBindTexture(texture_target, texture_id); glBindTexture(texture_target, texture_id);
if (texture_target == GL_TEXTURE_2D) { if (texture_target == GL_TEXTURE_2D) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL); GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
} }
glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
...@@ -92,6 +91,64 @@ GLuint CreateTexture(GLenum texture_target, const gfx::Size& size) { ...@@ -92,6 +91,64 @@ GLuint CreateTexture(GLenum texture_target, const gfx::Size& size) {
return texture_id; return texture_id;
} }
void DeleteTexture(uint32_t texture_id) {
glDeleteTextures(1, &texture_id);
CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
}
void RenderTexture(uint32_t texture_target, uint32_t texture_id) {
// The ExternalOES sampler is bound to GL_TEXTURE1 and the Texture2D sampler
// is bound to GL_TEXTURE0.
if (texture_target == GL_TEXTURE_2D) {
glActiveTexture(GL_TEXTURE0 + 0);
} else if (texture_target == GL_TEXTURE_EXTERNAL_OES) {
glActiveTexture(GL_TEXTURE0 + 1);
}
glBindTexture(texture_target, texture_id);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindTexture(texture_target, 0);
CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
}
void CreateShader(GLuint program, GLenum type, const char* source, int size) {
GLuint shader = glCreateShader(type);
glShaderSource(shader, 1, &source, &size);
glCompileShader(shader);
int result = GL_FALSE;
glGetShaderiv(shader, GL_COMPILE_STATUS, &result);
if (!result) {
char log[4096];
glGetShaderInfoLog(shader, base::size(log), nullptr, log);
LOG(FATAL) << log;
}
glAttachShader(program, shader);
glDeleteShader(shader);
CHECK_EQ(static_cast<int>(glGetError()), GL_NO_ERROR);
}
void GLSetViewPort(const gfx::Rect& area) {
glViewport(area.x(), area.y(), area.width(), area.height());
glScissor(area.x(), area.y(), area.width(), area.height());
}
// Helper function to convert from RGBA to RGB. Returns false if any alpha
// channel is not 0xff, otherwise true.
bool ConvertRGBAToRGB(const std::vector<unsigned char>& rgba,
std::vector<unsigned char>* rgb) {
size_t num_pixels = rgba.size() / 4;
rgb->resize(num_pixels * 3);
// Drop the alpha channel, but check as we go that it is all 0xff.
bool solid = true;
for (size_t i = 0; i < num_pixels; i++) {
(*rgb)[3 * i] = rgba[4 * i];
(*rgb)[3 * i + 1] = rgba[4 * i + 1];
(*rgb)[3 * i + 2] = rgba[4 * i + 2];
solid = solid && (rgba[4 * i + 3] == 0xff);
}
return solid;
}
} // namespace } // namespace
bool FrameRendererThumbnail::gl_initialized_ = false; bool FrameRendererThumbnail::gl_initialized_ = false;
...@@ -125,18 +182,6 @@ std::unique_ptr<FrameRendererThumbnail> FrameRendererThumbnail::Create( ...@@ -125,18 +182,6 @@ std::unique_ptr<FrameRendererThumbnail> FrameRendererThumbnail::Create(
return frame_renderer; return frame_renderer;
} }
// static
std::unique_ptr<FrameRendererThumbnail> FrameRendererThumbnail::Create(
const base::FilePath& video_file_path,
const base::FilePath& output_folder) {
// Read thumbnail checksums from file.
std::vector<std::string> thumbnail_checksums =
media::test::ReadGoldenThumbnailMD5s(
video_file_path.AddExtension(FILE_PATH_LITERAL(".md5")));
return FrameRendererThumbnail::Create(thumbnail_checksums, output_folder);
}
bool FrameRendererThumbnail::AcquireGLContext() { bool FrameRendererThumbnail::AcquireGLContext() {
DCHECK_CALLED_ON_VALID_SEQUENCE(renderer_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(renderer_sequence_checker_);
...@@ -273,10 +318,6 @@ void FrameRendererThumbnail::DestroyTask(base::WaitableEvent* done) { ...@@ -273,10 +318,6 @@ void FrameRendererThumbnail::DestroyTask(base::WaitableEvent* done) {
done->Signal(); done->Signal();
} }
// TODO(dstaessens@) This code is mostly duplicated from
// RenderingHelper::Initialize(), as that code is unfortunately too inflexible
// to reuse here. But most of the code in rendering helper can be removed soon
// when the video_decoder_accelerator_unittests get deprecated.
void FrameRendererThumbnail::InitializeThumbnailImageTask() { void FrameRendererThumbnail::InitializeThumbnailImageTask() {
DCHECK_CALLED_ON_VALID_SEQUENCE(renderer_sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(renderer_sequence_checker_);
...@@ -293,7 +334,7 @@ void FrameRendererThumbnail::InitializeThumbnailImageTask() { ...@@ -293,7 +334,7 @@ void FrameRendererThumbnail::InitializeThumbnailImageTask() {
glBindTexture(GL_TEXTURE_2D, thumbnails_texture_id_); glBindTexture(GL_TEXTURE_2D, thumbnails_texture_id_);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, thumbnails_fbo_size_.width(), glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, thumbnails_fbo_size_.width(),
thumbnails_fbo_size_.height(), 0, GL_RGB, thumbnails_fbo_size_.height(), 0, GL_RGB,
GL_UNSIGNED_SHORT_5_6_5, NULL); GL_UNSIGNED_SHORT_5_6_5, nullptr);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
...@@ -334,17 +375,17 @@ void FrameRendererThumbnail::InitializeThumbnailImageTask() { ...@@ -334,17 +375,17 @@ void FrameRendererThumbnail::InitializeThumbnailImageTask() {
glBufferData(GL_ARRAY_BUFFER, sizeof(kVertices), kVertices, GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, sizeof(kVertices), kVertices, GL_STATIC_DRAW);
program_ = glCreateProgram(); program_ = glCreateProgram();
RenderingHelper::CreateShader(program_, GL_VERTEX_SHADER, kVertexShader, CreateShader(program_, GL_VERTEX_SHADER, kVertexShader,
base::size(kVertexShader)); base::size(kVertexShader));
RenderingHelper::CreateShader(program_, GL_FRAGMENT_SHADER, kFragmentShader, CreateShader(program_, GL_FRAGMENT_SHADER, kFragmentShader,
base::size(kFragmentShader)); base::size(kFragmentShader));
glLinkProgram(program_); glLinkProgram(program_);
GLint result = GL_FALSE; GLint result = GL_FALSE;
glGetProgramiv(program_, GL_LINK_STATUS, &result); glGetProgramiv(program_, GL_LINK_STATUS, &result);
if (!result) { if (!result) {
constexpr GLsizei kLogBufferSize = 4096; constexpr GLsizei kLogBufferSize = 4096;
char log[kLogBufferSize]; char log[kLogBufferSize];
glGetShaderInfoLog(program_, kLogBufferSize, NULL, log); glGetShaderInfoLog(program_, kLogBufferSize, nullptr, log);
LOG(FATAL) << log; LOG(FATAL) << log;
} }
glUseProgram(program_); glUseProgram(program_);
...@@ -395,8 +436,8 @@ void FrameRendererThumbnail::RenderThumbnailTask(uint32_t texture_target, ...@@ -395,8 +436,8 @@ void FrameRendererThumbnail::RenderThumbnailTask(uint32_t texture_target,
glUniform1i(glGetUniformLocation(program_, "tex_flip"), 0); glUniform1i(glGetUniformLocation(program_, "tex_flip"), 0);
glBindFramebufferEXT(GL_FRAMEBUFFER, thumbnails_fbo_id_); glBindFramebufferEXT(GL_FRAMEBUFFER, thumbnails_fbo_id_);
RenderingHelper::GLSetViewPort(area); GLSetViewPort(area);
RenderingHelper::RenderTexture(texture_target, texture_id); RenderTexture(texture_target, texture_id);
glBindFramebufferEXT(GL_FRAMEBUFFER, glBindFramebufferEXT(GL_FRAMEBUFFER,
gl_surface_->GetBackingFramebufferObject()); gl_surface_->GetBackingFramebufferObject());
// We need to flush the GL commands before returning the thumbnail texture to // We need to flush the GL commands before returning the thumbnail texture to
...@@ -433,7 +474,7 @@ void FrameRendererThumbnail::ValidateThumbnailTask(bool* success, ...@@ -433,7 +474,7 @@ void FrameRendererThumbnail::ValidateThumbnailTask(bool* success,
// Convert the thumbnail from RGBA to RGB. // Convert the thumbnail from RGBA to RGB.
std::vector<uint8_t> rgb; std::vector<uint8_t> rgb;
EXPECT_EQ(media::test::ConvertRGBAToRGB(rgba, &rgb), true) EXPECT_EQ(ConvertRGBAToRGB(rgba, &rgb), true)
<< "RGBA frame has incorrect alpha"; << "RGBA frame has incorrect alpha";
// Calculate the thumbnail's checksum and compare it to golden values. // Calculate the thumbnail's checksum and compare it to golden values.
...@@ -457,7 +498,7 @@ void FrameRendererThumbnail::DeleteTextureTask(const gpu::Mailbox& mailbox, ...@@ -457,7 +498,7 @@ void FrameRendererThumbnail::DeleteTextureTask(const gpu::Mailbox& mailbox,
uint32_t texture_id = it->second; uint32_t texture_id = it->second;
mailbox_texture_map_.erase(mailbox); mailbox_texture_map_.erase(mailbox);
RenderingHelper::DeleteTexture(texture_id); DeleteTexture(texture_id);
} }
} // namespace test } // namespace test
......
...@@ -44,13 +44,6 @@ class FrameRendererThumbnail : public FrameRenderer { ...@@ -44,13 +44,6 @@ class FrameRendererThumbnail : public FrameRenderer {
const std::vector<std::string> thumbnail_checksums, const std::vector<std::string> thumbnail_checksums,
const base::FilePath& output_folder); const base::FilePath& output_folder);
// Create an instance of the thumbnail frame renderer. The |video_file_path|
// should point to a file containing all golden thumbnail hashes for the video
// being rendered.
static std::unique_ptr<FrameRendererThumbnail> Create(
const base::FilePath& video_file_path,
const base::FilePath& output_folder);
// FrameRenderer implementation // FrameRenderer implementation
// Acquire the GL context on the |renderer_task_runner_|. This needs to be // Acquire the GL context on the |renderer_task_runner_|. This needs to be
// called before executing any GL-related functions. The context will remain // called before executing any GL-related functions. The context will remain
......
This diff is collapsed.
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