Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| 11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/sys_byteorder.h" | 15 #include "base/sys_byteorder.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 18 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
| 19 #include "media/base/bind_to_current_loop.h" | 19 #include "media/base/bind_to_current_loop.h" |
| 20 #include "media/base/bitstream_buffer.h" | 20 #include "media/base/bitstream_buffer.h" |
| 21 #include "media/base/test_data_util.h" | 21 #include "media/base/test_data_util.h" |
| 22 #include "media/filters/h264_parser.h" | 22 #include "media/filters/h264_parser.h" |
| 23 #include "media/video/video_encode_accelerator.h" | 23 #include "media/video/video_encode_accelerator.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 #if defined(USE_OZONE) | |
| 27 #include "ui/ozone/public/ozone_platform.h" | |
| 28 #endif | |
| 29 | |
| 26 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 30 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 27 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 31 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
| 28 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 32 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 29 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 33 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
| 30 #else | 34 #else |
| 31 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. | 35 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. |
| 32 #endif | 36 #endif |
| 33 | 37 |
| 34 using media::VideoEncodeAccelerator; | 38 using media::VideoEncodeAccelerator; |
| 35 | 39 |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 // - multiple encoders + decoders | 1284 // - multiple encoders + decoders |
| 1281 // - mid-stream encoder_->Destroy() | 1285 // - mid-stream encoder_->Destroy() |
| 1282 | 1286 |
| 1283 } // namespace | 1287 } // namespace |
| 1284 } // namespace content | 1288 } // namespace content |
| 1285 | 1289 |
| 1286 int main(int argc, char** argv) { | 1290 int main(int argc, char** argv) { |
| 1287 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. | 1291 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. |
| 1288 base::CommandLine::Init(argc, argv); | 1292 base::CommandLine::Init(argc, argv); |
| 1289 | 1293 |
| 1294 #if defined(USE_OZONE) | |
| 1295 ui::OzonePlatform::InitializeForUI(); | |
|
Pawel Osciak
2014/12/26 00:38:56
Do we need these in encoder test if we don't displ
llandwerlin-old
2014/12/26 02:50:02
Yes, because we need access to the drm fd, initial
| |
| 1296 ui::OzonePlatform::InitializeForGPU(); | |
| 1297 #endif | |
| 1298 | |
| 1290 base::ShadowingAtExitManager at_exit_manager; | 1299 base::ShadowingAtExitManager at_exit_manager; |
| 1291 scoped_ptr<base::FilePath::StringType> test_stream_data( | 1300 scoped_ptr<base::FilePath::StringType> test_stream_data( |
| 1292 new base::FilePath::StringType( | 1301 new base::FilePath::StringType( |
| 1293 media::GetTestDataFilePath(content::g_default_in_filename).value() + | 1302 media::GetTestDataFilePath(content::g_default_in_filename).value() + |
| 1294 content::g_default_in_parameters)); | 1303 content::g_default_in_parameters)); |
| 1295 | 1304 |
| 1296 // Needed to enable DVLOG through --vmodule. | 1305 // Needed to enable DVLOG through --vmodule. |
| 1297 logging::LoggingSettings settings; | 1306 logging::LoggingSettings settings; |
| 1298 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 1307 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 1299 CHECK(logging::InitLogging(settings)); | 1308 CHECK(logging::InitLogging(settings)); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1314 std::string input(it->second.begin(), it->second.end()); | 1323 std::string input(it->second.begin(), it->second.end()); |
| 1315 CHECK(base::StringToInt(input, &content::g_num_frames_to_encode)); | 1324 CHECK(base::StringToInt(input, &content::g_num_frames_to_encode)); |
| 1316 continue; | 1325 continue; |
| 1317 } | 1326 } |
| 1318 if (it->first == "run_at_fps") { | 1327 if (it->first == "run_at_fps") { |
| 1319 run_at_fps = true; | 1328 run_at_fps = true; |
| 1320 continue; | 1329 continue; |
| 1321 } | 1330 } |
| 1322 if (it->first == "v" || it->first == "vmodule") | 1331 if (it->first == "v" || it->first == "vmodule") |
| 1323 continue; | 1332 continue; |
| 1333 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") | |
| 1334 continue; | |
| 1324 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1335 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1325 } | 1336 } |
| 1326 | 1337 |
| 1327 content::g_env = | 1338 content::g_env = |
| 1328 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1339 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
| 1329 testing::AddGlobalTestEnvironment( | 1340 testing::AddGlobalTestEnvironment( |
| 1330 new content::VideoEncodeAcceleratorTestEnvironment( | 1341 new content::VideoEncodeAcceleratorTestEnvironment( |
| 1331 test_stream_data.Pass(), run_at_fps))); | 1342 test_stream_data.Pass(), run_at_fps))); |
| 1332 | 1343 |
| 1333 return RUN_ALL_TESTS(); | 1344 return RUN_ALL_TESTS(); |
| 1334 } | 1345 } |
| OLD | NEW |