| 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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 base::ShadowingAtExitManager at_exit_manager_; | 949 base::ShadowingAtExitManager at_exit_manager_; |
| 950 | 950 |
| 951 DISALLOW_COPY_AND_ASSIGN(VideoDecodeAcceleratorTest); | 951 DISALLOW_COPY_AND_ASSIGN(VideoDecodeAcceleratorTest); |
| 952 }; | 952 }; |
| 953 | 953 |
| 954 VideoDecodeAcceleratorTest::VideoDecodeAcceleratorTest() | 954 VideoDecodeAcceleratorTest::VideoDecodeAcceleratorTest() |
| 955 : rendering_thread_("GLRenderingVDAClientThread") {} | 955 : rendering_thread_("GLRenderingVDAClientThread") {} |
| 956 | 956 |
| 957 void VideoDecodeAcceleratorTest::SetUp() { | 957 void VideoDecodeAcceleratorTest::SetUp() { |
| 958 ParseAndReadTestVideoData(g_test_video_data, &test_video_files_); | 958 ParseAndReadTestVideoData(g_test_video_data, &test_video_files_); |
| 959 | 959 rendering_thread_.Start(); |
| 960 // Initialize the rendering thread. | |
| 961 base::Thread::Options options; | |
| 962 options.message_loop_type = base::MessageLoop::TYPE_DEFAULT; | |
| 963 #if defined(OS_WIN) || defined(USE_OZONE) | |
| 964 // For windows the decoding thread initializes the media foundation decoder | |
| 965 // which uses COM. We need the thread to be a UI thread. | |
| 966 // On Ozone, the backend initializes the event system using a UI | |
| 967 // thread. | |
| 968 options.message_loop_type = base::MessageLoop::TYPE_UI; | |
| 969 #endif // OS_WIN || USE_OZONE | |
| 970 | |
| 971 rendering_thread_.StartWithOptions(options); | |
| 972 rendering_loop_proxy_ = rendering_thread_.message_loop_proxy(); | 960 rendering_loop_proxy_ = rendering_thread_.message_loop_proxy(); |
| 973 } | 961 } |
| 974 | 962 |
| 975 void VideoDecodeAcceleratorTest::TearDown() { | 963 void VideoDecodeAcceleratorTest::TearDown() { |
| 976 rendering_loop_proxy_->PostTask( | 964 rendering_loop_proxy_->PostTask( |
| 977 FROM_HERE, | 965 FROM_HERE, |
| 978 base::Bind(&STLDeleteElements<std::vector<TestVideoFile*> >, | 966 base::Bind(&STLDeleteElements<std::vector<TestVideoFile*> >, |
| 979 &test_video_files_)); | 967 &test_video_files_)); |
| 980 | 968 |
| 981 base::WaitableEvent done(false, false); | 969 base::WaitableEvent done(false, false); |
| 982 rendering_loop_proxy_->PostTask( | 970 rendering_loop_proxy_->PostTask( |
| 983 FROM_HERE, | 971 FROM_HERE, |
| 984 base::Bind(&RenderingHelper::UnInitialize, | 972 base::Bind(&RenderingHelper::UnInitialize, |
| 985 base::Unretained(&rendering_helper_), | 973 base::Unretained(&rendering_helper_), |
| 986 &done)); | 974 &done)); |
| 987 done.Wait(); | 975 done.Wait(); |
| 988 | 976 |
| 989 rendering_thread_.Stop(); | 977 rendering_thread_.Stop(); |
| 978 rendering_helper_.TearDown(); |
| 990 } | 979 } |
| 991 | 980 |
| 992 void VideoDecodeAcceleratorTest::ParseAndReadTestVideoData( | 981 void VideoDecodeAcceleratorTest::ParseAndReadTestVideoData( |
| 993 base::FilePath::StringType data, | 982 base::FilePath::StringType data, |
| 994 std::vector<TestVideoFile*>* test_video_files) { | 983 std::vector<TestVideoFile*>* test_video_files) { |
| 995 std::vector<base::FilePath::StringType> entries; | 984 std::vector<base::FilePath::StringType> entries; |
| 996 base::SplitString(data, ';', &entries); | 985 base::SplitString(data, ';', &entries); |
| 997 CHECK_GE(entries.size(), 1U) << data; | 986 CHECK_GE(entries.size(), 1U) << data; |
| 998 for (size_t index = 0; index < entries.size(); ++index) { | 987 for (size_t index = 0; index < entries.size(); ++index) { |
| 999 std::vector<base::FilePath::StringType> fields; | 988 std::vector<base::FilePath::StringType> fields; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 | 1036 |
| 1048 if (video_file->min_fps_render != -1) | 1037 if (video_file->min_fps_render != -1) |
| 1049 video_file->min_fps_render /= num_concurrent_decoders; | 1038 video_file->min_fps_render /= num_concurrent_decoders; |
| 1050 if (video_file->min_fps_no_render != -1) | 1039 if (video_file->min_fps_no_render != -1) |
| 1051 video_file->min_fps_no_render /= num_concurrent_decoders; | 1040 video_file->min_fps_no_render /= num_concurrent_decoders; |
| 1052 } | 1041 } |
| 1053 } | 1042 } |
| 1054 | 1043 |
| 1055 void VideoDecodeAcceleratorTest::InitializeRenderingHelper( | 1044 void VideoDecodeAcceleratorTest::InitializeRenderingHelper( |
| 1056 const RenderingHelperParams& helper_params) { | 1045 const RenderingHelperParams& helper_params) { |
| 1046 rendering_helper_.Setup(); |
| 1047 |
| 1057 base::WaitableEvent done(false, false); | 1048 base::WaitableEvent done(false, false); |
| 1058 rendering_loop_proxy_->PostTask( | 1049 rendering_loop_proxy_->PostTask( |
| 1059 FROM_HERE, | 1050 FROM_HERE, |
| 1060 base::Bind(&RenderingHelper::Initialize, | 1051 base::Bind(&RenderingHelper::Initialize, |
| 1061 base::Unretained(&rendering_helper_), | 1052 base::Unretained(&rendering_helper_), |
| 1062 helper_params, | 1053 helper_params, |
| 1063 &done)); | 1054 &done)); |
| 1064 done.Wait(); | 1055 done.Wait(); |
| 1065 } | 1056 } |
| 1066 | 1057 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 continue; | 1532 continue; |
| 1542 } | 1533 } |
| 1543 if (it->first == "v" || it->first == "vmodule") | 1534 if (it->first == "v" || it->first == "vmodule") |
| 1544 continue; | 1535 continue; |
| 1545 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") | 1536 if (it->first == "ozone-platform" || it->first == "ozone-use-surfaceless") |
| 1546 continue; | 1537 continue; |
| 1547 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1538 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1548 } | 1539 } |
| 1549 | 1540 |
| 1550 base::ShadowingAtExitManager at_exit_manager; | 1541 base::ShadowingAtExitManager at_exit_manager; |
| 1542 #if defined(OS_WIN) || defined(USE_OZONE) |
| 1543 // For windows the decoding thread initializes the media foundation decoder |
| 1544 // which uses COM. We need the thread to be a UI thread. |
| 1545 // On Ozone, the backend initializes the event system using a UI |
| 1546 // thread. |
| 1547 base::MessageLoopForUI main_loop; |
| 1548 #else |
| 1551 base::MessageLoop main_loop; | 1549 base::MessageLoop main_loop; |
| 1550 #endif // OS_WIN || USE_OZONE |
| 1552 content::RenderingHelper::InitializeOneOff(); | 1551 content::RenderingHelper::InitializeOneOff(); |
| 1553 | 1552 |
| 1554 return RUN_ALL_TESTS(); | 1553 return RUN_ALL_TESTS(); |
| 1555 } | 1554 } |
| OLD | NEW |