OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
8 // Win/EGL. | 8 // Win/EGL. |
9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // (the latter tests just decode speed). | 89 // (the latter tests just decode speed). |
90 // - |profile| is the media::VideoCodecProfile set during Initialization. | 90 // - |profile| is the media::VideoCodecProfile set during Initialization. |
91 // An empty value for a numeric field means "ignore". | 91 // An empty value for a numeric field means "ignore". |
92 const base::FilePath::CharType* g_test_video_data = | 92 const base::FilePath::CharType* g_test_video_data = |
93 // FILE_PATH_LITERAL("test-25fps.vp8:320:240:250:250:50:175:11"); | 93 // FILE_PATH_LITERAL("test-25fps.vp8:320:240:250:250:50:175:11"); |
94 FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); | 94 FILE_PATH_LITERAL("test-25fps.h264:320:240:250:258:50:175:1"); |
95 | 95 |
96 // The file path of the test output log. This is used to communicate the test | 96 // The file path of the test output log. This is used to communicate the test |
97 // results to CrOS autotests. We can enable the log and specify the filename by | 97 // results to CrOS autotests. We can enable the log and specify the filename by |
98 // the "--output_log" switch. | 98 // the "--output_log" switch. |
99 const base::FilePath::CharType* g_output_log = NULL; | 99 const base::FilePath::CharType* g_output_log = nullptr; |
100 | 100 |
101 // The value is set by the switch "--rendering_fps". | 101 // The value is set by the switch "--rendering_fps". |
102 double g_rendering_fps = 60; | 102 double g_rendering_fps = 60; |
103 | 103 |
104 // Magic constants for differentiating the reasons for NotifyResetDone being | 104 // Magic constants for differentiating the reasons for NotifyResetDone being |
105 // called. | 105 // called. |
106 enum ResetPoint { | 106 enum ResetPoint { |
107 // Reset() just after calling Decode() with a fragment containing config info. | 107 // Reset() just after calling Decode() with a fragment containing config info. |
108 RESET_AFTER_FIRST_CONFIG_INFO = -4, | 108 RESET_AFTER_FIRST_CONFIG_INFO = -4, |
109 START_OF_STREAM_RESET = -3, | 109 START_OF_STREAM_RESET = -3, |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 bool test_reuse_delay = GetParam().f; | 1058 bool test_reuse_delay = GetParam().f; |
1059 const bool render_as_thumbnails = GetParam().g; | 1059 const bool render_as_thumbnails = GetParam().g; |
1060 | 1060 |
1061 UpdateTestVideoFileParams( | 1061 UpdateTestVideoFileParams( |
1062 num_concurrent_decoders, reset_point, &test_video_files_); | 1062 num_concurrent_decoders, reset_point, &test_video_files_); |
1063 | 1063 |
1064 // Suppress GL rendering for all tests when the "--rendering_fps" is 0. | 1064 // Suppress GL rendering for all tests when the "--rendering_fps" is 0. |
1065 const bool suppress_rendering = g_rendering_fps == 0; | 1065 const bool suppress_rendering = g_rendering_fps == 0; |
1066 | 1066 |
1067 std::vector<ClientStateNotification<ClientState>*> | 1067 std::vector<ClientStateNotification<ClientState>*> |
1068 notes(num_concurrent_decoders, NULL); | 1068 notes(num_concurrent_decoders, nullptr); |
1069 std::vector<GLRenderingVDAClient*> clients(num_concurrent_decoders, NULL); | 1069 std::vector<GLRenderingVDAClient*> clients(num_concurrent_decoders, nullptr); |
1070 | 1070 |
1071 RenderingHelperParams helper_params; | 1071 RenderingHelperParams helper_params; |
1072 helper_params.rendering_fps = g_rendering_fps; | 1072 helper_params.rendering_fps = g_rendering_fps; |
1073 helper_params.render_as_thumbnails = render_as_thumbnails; | 1073 helper_params.render_as_thumbnails = render_as_thumbnails; |
1074 if (render_as_thumbnails) { | 1074 if (render_as_thumbnails) { |
1075 // Only one decoder is supported with thumbnail rendering | 1075 // Only one decoder is supported with thumbnail rendering |
1076 CHECK_EQ(num_concurrent_decoders, 1U); | 1076 CHECK_EQ(num_concurrent_decoders, 1U); |
1077 helper_params.thumbnails_page_size = kThumbnailsPageSize; | 1077 helper_params.thumbnails_page_size = kThumbnailsPageSize; |
1078 helper_params.thumbnail_size = kThumbnailSize; | 1078 helper_params.thumbnail_size = kThumbnailSize; |
1079 } | 1079 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 png.size()); | 1231 png.size()); |
1232 ASSERT_EQ(num_bytes, static_cast<int>(png.size())); | 1232 ASSERT_EQ(num_bytes, static_cast<int>(png.size())); |
1233 } | 1233 } |
1234 ASSERT_NE(match, golden_md5s.end()); | 1234 ASSERT_NE(match, golden_md5s.end()); |
1235 EXPECT_EQ(alpha_solid, true) << "RGBA frame had incorrect alpha"; | 1235 EXPECT_EQ(alpha_solid, true) << "RGBA frame had incorrect alpha"; |
1236 } | 1236 } |
1237 | 1237 |
1238 // Output the frame delivery time to file | 1238 // Output the frame delivery time to file |
1239 // We can only make performance/correctness assertions if the decoder was | 1239 // We can only make performance/correctness assertions if the decoder was |
1240 // allowed to finish. | 1240 // allowed to finish. |
1241 if (g_output_log != NULL && delete_decoder_state >= CS_FLUSHED) { | 1241 if (g_output_log != nullptr && delete_decoder_state >= CS_FLUSHED) { |
1242 base::File output_file( | 1242 base::File output_file( |
1243 base::FilePath(g_output_log), | 1243 base::FilePath(g_output_log), |
1244 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); | 1244 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); |
1245 for (size_t i = 0; i < num_concurrent_decoders; ++i) { | 1245 for (size_t i = 0; i < num_concurrent_decoders; ++i) { |
1246 clients[i]->OutputFrameDeliveryTimes(&output_file); | 1246 clients[i]->OutputFrameDeliveryTimes(&output_file); |
1247 } | 1247 } |
1248 } | 1248 } |
1249 | 1249 |
1250 rendering_loop_proxy_->PostTask( | 1250 rendering_loop_proxy_->PostTask( |
1251 FROM_HERE, | 1251 FROM_HERE, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 InitializeRenderingHelper(helper_params); | 1366 InitializeRenderingHelper(helper_params); |
1367 CreateAndStartDecoder(client, note); | 1367 CreateAndStartDecoder(client, note); |
1368 WaitUntilDecodeFinish(note); | 1368 WaitUntilDecodeFinish(note); |
1369 | 1369 |
1370 base::TimeDelta decode_time_median = client->decode_time_median(); | 1370 base::TimeDelta decode_time_median = client->decode_time_median(); |
1371 std::string output_string = | 1371 std::string output_string = |
1372 base::StringPrintf("Decode time median: %" PRId64 " us", | 1372 base::StringPrintf("Decode time median: %" PRId64 " us", |
1373 decode_time_median.InMicroseconds()); | 1373 decode_time_median.InMicroseconds()); |
1374 LOG(INFO) << output_string; | 1374 LOG(INFO) << output_string; |
1375 | 1375 |
1376 if (g_output_log != NULL) | 1376 if (g_output_log != nullptr) |
1377 OutputLogFile(g_output_log, output_string); | 1377 OutputLogFile(g_output_log, output_string); |
1378 | 1378 |
1379 rendering_loop_proxy_->DeleteSoon(FROM_HERE, client); | 1379 rendering_loop_proxy_->DeleteSoon(FROM_HERE, client); |
1380 rendering_loop_proxy_->DeleteSoon(FROM_HERE, note); | 1380 rendering_loop_proxy_->DeleteSoon(FROM_HERE, note); |
1381 WaitUntilIdle(); | 1381 WaitUntilIdle(); |
1382 }; | 1382 }; |
1383 | 1383 |
1384 // TODO(fischman, vrk): add more tests! In particular: | 1384 // TODO(fischman, vrk): add more tests! In particular: |
1385 // - Test life-cycle: Seek/Stop/Pause/Play for a single decoder. | 1385 // - Test life-cycle: Seek/Stop/Pause/Play for a single decoder. |
1386 // - Test alternate configurations | 1386 // - Test alternate configurations |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 if (it->first == "v" || it->first == "vmodule") | 1429 if (it->first == "v" || it->first == "vmodule") |
1430 continue; | 1430 continue; |
1431 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1431 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1432 } | 1432 } |
1433 | 1433 |
1434 base::ShadowingAtExitManager at_exit_manager; | 1434 base::ShadowingAtExitManager at_exit_manager; |
1435 content::RenderingHelper::InitializeOneOff(); | 1435 content::RenderingHelper::InitializeOneOff(); |
1436 | 1436 |
1437 return RUN_ALL_TESTS(); | 1437 return RUN_ALL_TESTS(); |
1438 } | 1438 } |
OLD | NEW |