| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "content/common/gpu/media/mac_video_decode_accelerator.h" | 47 #include "content/common/gpu/media/mac_video_decode_accelerator.h" |
| 48 #elif defined(ARCH_CPU_X86_FAMILY) | 48 #elif defined(ARCH_CPU_X86_FAMILY) |
| 49 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 49 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
| 50 #elif defined(ARCH_CPU_ARMEL) | 50 #elif defined(ARCH_CPU_ARMEL) |
| 51 #include "content/common/gpu/media/omx_video_decode_accelerator.h" | 51 #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
| 52 #else | 52 #else |
| 53 #error The VideoAccelerator tests are not supported on this platform. | 53 #error The VideoAccelerator tests are not supported on this platform. |
| 54 #endif // defined(OS_WIN) | 54 #endif // defined(OS_WIN) |
| 55 | 55 |
| 56 using media::VideoDecodeAccelerator; | 56 using media::VideoDecodeAccelerator; |
| 57 using video_test_util::RenderingHelper; | |
| 58 | 57 |
| 58 namespace content { |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 // Values optionally filled in from flags; see main() below. | 61 // Values optionally filled in from flags; see main() below. |
| 62 // The syntax of this variable is: | 62 // The syntax of this variable is: |
| 63 // filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender | 63 // filename:width:height:numframes:numfragments:minFPSwithRender:minFPSnoRender |
| 64 // where only the first field is required. Value details: | 64 // where only the first field is required. Value details: |
| 65 // - |filename| must be an h264 Annex B (NAL) stream or an IVF VP8 stream. | 65 // - |filename| must be an h264 Annex B (NAL) stream or an IVF VP8 stream. |
| 66 // - |width| and |height| are in pixels. | 66 // - |width| and |height| are in pixels. |
| 67 // - |numframes| is the number of picture frames in the file. | 67 // - |numframes| is the number of picture frames in the file. |
| 68 // - |numfragments| NALU (h264) or frame (VP8) count in the stream. | 68 // - |numfragments| NALU (h264) or frame (VP8) count in the stream. |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 MakeTuple(1, kMinSupportedNumConcurrentDecoders + 1, 1, 1, | 850 MakeTuple(1, kMinSupportedNumConcurrentDecoders + 1, 1, 1, |
| 851 END_OF_STREAM_RESET, CS_RESET))); | 851 END_OF_STREAM_RESET, CS_RESET))); |
| 852 | 852 |
| 853 // TODO(fischman, vrk): add more tests! In particular: | 853 // TODO(fischman, vrk): add more tests! In particular: |
| 854 // - Test life-cycle: Seek/Stop/Pause/Play for a single decoder. | 854 // - Test life-cycle: Seek/Stop/Pause/Play for a single decoder. |
| 855 // - Test alternate configurations | 855 // - Test alternate configurations |
| 856 // - Test failure conditions. | 856 // - Test failure conditions. |
| 857 // - Test frame size changes mid-stream | 857 // - Test frame size changes mid-stream |
| 858 | 858 |
| 859 } // namespace | 859 } // namespace |
| 860 } // namespace content |
| 860 | 861 |
| 861 int main(int argc, char **argv) { | 862 int main(int argc, char **argv) { |
| 862 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. | 863 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. |
| 863 CommandLine::Init(argc, argv); | 864 CommandLine::Init(argc, argv); |
| 864 | 865 |
| 865 // Needed to enable DVLOG through --vmodule. | 866 // Needed to enable DVLOG through --vmodule. |
| 866 CHECK(logging::InitLogging( | 867 CHECK(logging::InitLogging( |
| 867 NULL, | 868 NULL, |
| 868 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 869 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| 869 logging::DONT_LOCK_LOG_FILE, | 870 logging::DONT_LOCK_LOG_FILE, |
| 870 logging::APPEND_TO_OLD_LOG_FILE, | 871 logging::APPEND_TO_OLD_LOG_FILE, |
| 871 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); | 872 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)); |
| 872 | 873 |
| 873 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 874 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 874 DCHECK(cmd_line); | 875 DCHECK(cmd_line); |
| 875 | 876 |
| 876 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 877 CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
| 877 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); | 878 for (CommandLine::SwitchMap::const_iterator it = switches.begin(); |
| 878 it != switches.end(); ++it) { | 879 it != switches.end(); ++it) { |
| 879 if (it->first == "test_video_data") { | 880 if (it->first == "test_video_data") { |
| 880 test_video_data = it->second.c_str(); | 881 content::test_video_data = it->second.c_str(); |
| 881 continue; | 882 continue; |
| 882 } | 883 } |
| 883 if (it->first == "v" || it->first == "vmodule") | 884 if (it->first == "v" || it->first == "vmodule") |
| 884 continue; | 885 continue; |
| 885 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 886 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 886 } | 887 } |
| 887 | 888 |
| 888 base::ShadowingAtExitManager at_exit_manager; | 889 base::ShadowingAtExitManager at_exit_manager; |
| 889 RenderingHelper::InitializePlatform(); | 890 content::RenderingHelper::InitializePlatform(); |
| 890 | 891 |
| 891 #if defined(OS_WIN) | 892 #if defined(OS_WIN) |
| 892 DXVAVideoDecodeAccelerator::PreSandboxInitialization(); | 893 content::DXVAVideoDecodeAccelerator::PreSandboxInitialization(); |
| 893 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 894 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 894 OmxVideoDecodeAccelerator::PreSandboxInitialization(); | 895 content::OmxVideoDecodeAccelerator::PreSandboxInitialization(); |
| 895 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 896 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 896 VaapiVideoDecodeAccelerator::PreSandboxInitialization(); | 897 content::VaapiVideoDecodeAccelerator::PreSandboxInitialization(); |
| 897 #endif | 898 #endif |
| 898 | 899 |
| 899 return RUN_ALL_TESTS(); | 900 return RUN_ALL_TESTS(); |
| 900 } | 901 } |
| OLD | NEW |