Commit e43820dd authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu VDA unittest: Check the number of decoded frames in NotifyFlushDone()

The number of decoded frames should be equal to the number of frames of input
video, if no Reset() is invoked before Flush().
Should check this condition in VDA unittest.

BUG=chromium:834170
TEST=VDA unittest on eve and kevin
TEST=VDA unittest on non-Chrome OS platforms in CQ.

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: I2eda613522b9a1e6259a9d72c4f86b616bc90996
Reviewed-on: https://chromium-review.googlesource.com/1063910
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarPawel Osciak <posciak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566703}
parent 14beb33b
...@@ -260,6 +260,8 @@ class GLRenderingVDAClient ...@@ -260,6 +260,8 @@ class GLRenderingVDAClient
// If |decode_calls_per_second| > 0, |num_in_flight_decodes| must be 1. // If |decode_calls_per_second| > 0, |num_in_flight_decodes| must be 1.
// |render_as_thumbnails| indicates if the decoded picture will be rendered // |render_as_thumbnails| indicates if the decoded picture will be rendered
// as thumbnails at the end of tests. // as thumbnails at the end of tests.
// |num_frames| is the number of frames that must be verified to be decoded
// during the test.
struct Config { struct Config {
size_t window_id = 0; size_t window_id = 0;
size_t num_in_flight_decodes = 1; size_t num_in_flight_decodes = 1;
...@@ -276,6 +278,7 @@ class GLRenderingVDAClient ...@@ -276,6 +278,7 @@ class GLRenderingVDAClient
size_t delay_reuse_after_frame_num = std::numeric_limits<size_t>::max(); size_t delay_reuse_after_frame_num = std::numeric_limits<size_t>::max();
size_t decode_calls_per_second = 0; size_t decode_calls_per_second = 0;
bool render_as_thumbnails = false; bool render_as_thumbnails = false;
size_t num_frames = 0;
}; };
// Doesn't take ownership of |rendering_helper| or |note|, which must outlive // Doesn't take ownership of |rendering_helper| or |note|, which must outlive
...@@ -687,6 +690,11 @@ void GLRenderingVDAClient::NotifyFlushDone() { ...@@ -687,6 +690,11 @@ void GLRenderingVDAClient::NotifyFlushDone() {
return; return;
} }
// Check all the Decode()-ed frames are returned by PictureReady() in
// END_OF_STREAM_RESET case.
if (config_.reset_point == END_OF_STREAM_RESET)
EXPECT_EQ(num_decoded_frames_, config_.num_frames);
SetState(CS_FLUSHED); SetState(CS_FLUSHED);
ResetDecoderAfterFlush(); ResetDecoderAfterFlush();
} }
...@@ -702,6 +710,8 @@ void GLRenderingVDAClient::NotifyResetDone() { ...@@ -702,6 +710,8 @@ void GLRenderingVDAClient::NotifyResetDone() {
DecodeNextFragment(); DecodeNextFragment();
return; return;
case START_OF_STREAM_RESET: case START_OF_STREAM_RESET:
EXPECT_EQ(num_decoded_frames_, 0u);
EXPECT_EQ(encoded_data_helper_->AtHeadOfStream(), true);
reset_point_ = END_OF_STREAM_RESET; reset_point_ = END_OF_STREAM_RESET;
for (size_t i = 0; i < config_.num_in_flight_decodes; ++i) for (size_t i = 0; i < config_.num_in_flight_decodes; ++i)
DecodeNextFragment(); DecodeNextFragment();
...@@ -757,6 +767,8 @@ void GLRenderingVDAClient::SetState(ClientState new_state) { ...@@ -757,6 +767,8 @@ void GLRenderingVDAClient::SetState(ClientState new_state) {
void GLRenderingVDAClient::FinishInitialization() { void GLRenderingVDAClient::FinishInitialization() {
SetState(CS_INITIALIZED); SetState(CS_INITIALIZED);
initialize_done_ticks_ = base::TimeTicks::Now(); initialize_done_ticks_ = base::TimeTicks::Now();
EXPECT_EQ(encoded_data_helper_->AtHeadOfStream(), true);
num_decoded_frames_ = 0;
if (reset_point_ == START_OF_STREAM_RESET) { if (reset_point_ == START_OF_STREAM_RESET) {
decoder_->Reset(); decoder_->Reset();
...@@ -1160,6 +1172,7 @@ TEST_P(VideoDecodeAcceleratorParamTest, MAYBE_TestSimpleDecode) { ...@@ -1160,6 +1172,7 @@ TEST_P(VideoDecodeAcceleratorParamTest, MAYBE_TestSimpleDecode) {
config.fake_decoder = g_fake_decoder; config.fake_decoder = g_fake_decoder;
config.delay_reuse_after_frame_num = delay_reuse_after_frame_num; config.delay_reuse_after_frame_num = delay_reuse_after_frame_num;
config.render_as_thumbnails = render_as_thumbnails; config.render_as_thumbnails = render_as_thumbnails;
config.num_frames = video_file->num_frames;
clients_[index] = std::make_unique<GLRenderingVDAClient>( clients_[index] = std::make_unique<GLRenderingVDAClient>(
std::move(config), video_file->data_str, &rendering_helper_, std::move(config), video_file->data_str, &rendering_helper_,
...@@ -1506,6 +1519,7 @@ TEST_F(VideoDecodeAcceleratorTest, TestDecodeTimeMedian) { ...@@ -1506,6 +1519,7 @@ TEST_F(VideoDecodeAcceleratorTest, TestDecodeTimeMedian) {
config.profile = video_file->profile; config.profile = video_file->profile;
config.fake_decoder = g_fake_decoder; config.fake_decoder = g_fake_decoder;
config.decode_calls_per_second = kWebRtcDecodeCallsPerSecond; config.decode_calls_per_second = kWebRtcDecodeCallsPerSecond;
config.num_frames = video_file->num_frames;
clients_.push_back(std::make_unique<GLRenderingVDAClient>( clients_.push_back(std::make_unique<GLRenderingVDAClient>(
std::move(config), video_file->data_str, &rendering_helper_, std::move(config), video_file->data_str, &rendering_helper_,
...@@ -1539,6 +1553,7 @@ TEST_F(VideoDecodeAcceleratorTest, NoCrash) { ...@@ -1539,6 +1553,7 @@ TEST_F(VideoDecodeAcceleratorTest, NoCrash) {
config.frame_size = gfx::Size(video_file->width, video_file->height); config.frame_size = gfx::Size(video_file->width, video_file->height);
config.profile = video_file->profile; config.profile = video_file->profile;
config.fake_decoder = g_fake_decoder; config.fake_decoder = g_fake_decoder;
config.num_frames = video_file->num_frames;
clients_.push_back(std::make_unique<GLRenderingVDAClient>( clients_.push_back(std::make_unique<GLRenderingVDAClient>(
std::move(config), video_file->data_str, &rendering_helper_, std::move(config), video_file->data_str, &rendering_helper_,
......
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