Commit 64c218a5 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu VDA unittest: Move constant values and enum to top of the file

In additon to moving those declaration places, changes the type of
kMinSupportedNumConcurrentDecoders to const size_t from enum.

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: I5b343adb64811f8f6dde2699af60542c666890af
Reviewed-on: https://chromium-review.googlesource.com/1027333
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarPawel Osciak <posciak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555265}
parent f1fde849
...@@ -141,6 +141,24 @@ base::FilePath g_thumbnail_output_dir; ...@@ -141,6 +141,24 @@ base::FilePath g_thumbnail_output_dir;
// Environment to store rendering thread. // Environment to store rendering thread.
media::test::VideoDecodeAcceleratorTestEnvironment* g_env; media::test::VideoDecodeAcceleratorTestEnvironment* g_env;
const int kMaxResetAfterFrameNum = 100;
const int kMaxFramesToDelayReuse = 64;
const base::TimeDelta kReuseDelay = base::TimeDelta::FromSeconds(1);
// Simulate WebRTC and call VDA::Decode 30 times per second.
const int kWebRtcDecodeCallsPerSecond = 30;
// Simulate an adjustment to a larger number of pictures to make sure the
// decoder supports an upwards adjustment.
const int kExtraPictureBuffers = 2;
const int kNoMidStreamReset = -1;
const gfx::Size kThumbnailsPageSize(1600, 1200);
const gfx::Size kThumbnailSize(160, 120);
// We assert a minimal number of concurrent decoders we expect to succeed.
// Different platforms can support more concurrent decoders, so we don't assert
// failure above this.
const size_t kMinSupportedNumConcurrentDecoders = 3;
// Magic constants for differentiating the reasons for NotifyResetDone being // Magic constants for differentiating the reasons for NotifyResetDone being
// called. // called.
enum ResetPoint { enum ResetPoint {
...@@ -159,15 +177,20 @@ enum ResetPoint { ...@@ -159,15 +177,20 @@ enum ResetPoint {
DONE_RESET_AFTER_FIRST_CONFIG_INFO, DONE_RESET_AFTER_FIRST_CONFIG_INFO,
}; };
const int kMaxResetAfterFrameNum = 100; // State of the GLRenderingVDAClient below. Order matters here as the test
const int kMaxFramesToDelayReuse = 64; // makes assumptions about it.
const base::TimeDelta kReuseDelay = base::TimeDelta::FromSeconds(1); enum ClientState {
// Simulate WebRTC and call VDA::Decode 30 times per second. CS_CREATED = 0,
const int kWebRtcDecodeCallsPerSecond = 30; CS_DECODER_SET = 1,
// Simulate an adjustment to a larger number of pictures to make sure the CS_INITIALIZED = 2,
// decoder supports an upwards adjustment. CS_FLUSHING = 3,
const int kExtraPictureBuffers = 2; CS_FLUSHED = 4,
const int kNoMidStreamReset = -1; CS_RESETTING = 5,
CS_RESET = 6,
CS_ERROR = 7,
CS_DESTROYED = 8,
CS_MAX, // Must be last entry.
};
struct TestVideoFile { struct TestVideoFile {
explicit TestVideoFile(base::FilePath::StringType file_name) explicit TestVideoFile(base::FilePath::StringType file_name)
...@@ -193,9 +216,6 @@ struct TestVideoFile { ...@@ -193,9 +216,6 @@ struct TestVideoFile {
std::string data_str; std::string data_str;
}; };
const gfx::Size kThumbnailsPageSize(1600, 1200);
const gfx::Size kThumbnailSize(160, 120);
base::FilePath GetTestDataFile(const base::FilePath& input_file) { base::FilePath GetTestDataFile(const base::FilePath& input_file) {
if (input_file.IsAbsolute()) if (input_file.IsAbsolute())
return input_file; return input_file;
...@@ -209,21 +229,6 @@ base::FilePath GetTestDataFile(const base::FilePath& input_file) { ...@@ -209,21 +229,6 @@ base::FilePath GetTestDataFile(const base::FilePath& input_file) {
return abs_path; return abs_path;
} }
// State of the GLRenderingVDAClient below. Order matters here as the test
// makes assumptions about it.
enum ClientState {
CS_CREATED = 0,
CS_DECODER_SET = 1,
CS_INITIALIZED = 2,
CS_FLUSHING = 3,
CS_FLUSHED = 4,
CS_RESETTING = 5,
CS_RESET = 6,
CS_ERROR = 7,
CS_DESTROYED = 8,
CS_MAX, // Must be last entry.
};
// Client that can accept callbacks from a VideoDecodeAccelerator and is used by // Client that can accept callbacks from a VideoDecodeAccelerator and is used by
// the TESTs below. // the TESTs below.
class GLRenderingVDAClient class GLRenderingVDAClient
...@@ -1090,11 +1095,6 @@ static void AssertWaitForStateOrDeleted( ...@@ -1090,11 +1095,6 @@ static void AssertWaitForStateOrDeleted(
<< ", instead of " << expected_state; << ", instead of " << expected_state;
} }
// We assert a minimal number of concurrent decoders we expect to succeed.
// Different platforms can support more concurrent decoders, so we don't assert
// failure above this.
enum { kMinSupportedNumConcurrentDecoders = 3 };
// Test the most straightforward case possible: data is decoded from a single // Test the most straightforward case possible: data is decoded from a single
// chunk and rendered to the screen. // chunk and rendered to the screen.
TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) { TEST_P(VideoDecodeAcceleratorParamTest, TestSimpleDecode) {
...@@ -1437,9 +1437,7 @@ INSTANTIATE_TEST_CASE_P( ...@@ -1437,9 +1437,7 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
ResourceExhaustion, ResourceExhaustion,
VideoDecodeAcceleratorParamTest, VideoDecodeAcceleratorParamTest,
::testing::Values( ::testing::Values(std::make_tuple(kMinSupportedNumConcurrentDecoders,
// +0 hack below to promote enum to int.
std::make_tuple(kMinSupportedNumConcurrentDecoders + 0,
1, 1,
1, 1,
END_OF_STREAM_RESET, END_OF_STREAM_RESET,
......
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