Commit 6a55d377 authored by David Staessens's avatar David Staessens Committed by Commit Bot

media/gpu/test: Minor cleanup in video decoder tests.

This CL contains some minor cleanup in the video decoder tests:
- Update an outdated comment.
- Remove a duplicate define that's already defined in macros.h.
- Improved debug output when waiting for events.
- Moved some initialization to header file.

TEST=./video_decode_accelerator_tests on nocturne

BUG=None

Change-Id: Id0794cff6036396e46e293077663b62bba0b3560
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032464Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Commit-Queue: David Staessens <dstaessens@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742064}
parent 41847475
......@@ -64,12 +64,11 @@ class VideoDecoderClient {
~VideoDecoderClient();
// Return an instance of the VideoDecoderClient. The
// |gpu_memory_buffer_factory|, |frame_renderer| and |frame_processors| will
// not be owned by the decoder client, the caller should guarantee they
// outlive the decoder client. The |event_cb| will be called whenever an event
// occurs (e.g. frame decoded) and should be thread-safe. Initialization is
// performed asynchronous, upon completion a 'kInitialized' event will be
// thrown.
// |gpu_memory_buffer_factory| will not be owned by the decoder client, the
// caller should guarantee it outlives the decoder client. The |event_cb| will
// be called whenever an event occurs (e.g. frame decoded) and should be
// thread-safe. Initialization is performed asynchronous, upon completion a
// 'kInitialized' event will be thrown.
static std::unique_ptr<VideoDecoderClient> Create(
const VideoPlayer::EventCallback& event_cb,
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
......
......@@ -10,8 +10,6 @@
#include "media/gpu/test/video.h"
#include "media/gpu/test/video_player/video_decoder_client.h"
#define DVLOGF(level) DVLOG(level) << __func__ << "(): "
namespace media {
namespace test {
......@@ -40,11 +38,7 @@ const char* EventName(VideoPlayerEvent event) {
} // namespace
VideoPlayer::VideoPlayer()
: video_(nullptr),
video_player_state_(VideoPlayerState::kUninitialized),
event_cv_(&event_lock_),
video_player_event_counts_{},
event_id_(0) {}
: event_cv_(&event_lock_), video_player_event_counts_{}, event_id_(0) {}
VideoPlayer::~VideoPlayer() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
......@@ -188,7 +182,7 @@ FrameRenderer* VideoPlayer::GetFrameRenderer() const {
bool VideoPlayer::WaitForEvent(VideoPlayerEvent event, size_t times) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_GE(times, 1u);
DVLOGF(4) << "Event ID: " << static_cast<size_t>(event);
DVLOGF(4) << "Event: " << EventName(event);
base::TimeDelta time_waiting;
base::AutoLock auto_lock(event_lock_);
......
......@@ -138,8 +138,8 @@ class VideoPlayer {
// whether the decoder client should continue decoding frames.
bool NotifyEvent(VideoPlayerEvent event);
const Video* video_;
VideoPlayerState video_player_state_;
const Video* video_ = nullptr;
VideoPlayerState video_player_state_ = VideoPlayerState::kUninitialized;
std::unique_ptr<VideoDecoderClient> decoder_client_;
// The timeout used when waiting for events.
......
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