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 "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 17 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
18 #include "media/base/bind_to_current_loop.h" | 18 #include "media/base/bind_to_current_loop.h" |
19 #include "media/base/bitstream_buffer.h" | 19 #include "media/base/bitstream_buffer.h" |
20 #include "media/base/test_data_util.h" | 20 #include "media/base/test_data_util.h" |
21 #include "media/filters/h264_parser.h" | 21 #include "media/filters/h264_parser.h" |
22 #include "media/video/video_encode_accelerator.h" | 22 #include "media/video/video_encode_accelerator.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 #if defined(USE_X11) | |
26 #include "ui/gfx/x/x11_types.h" | |
27 #endif | |
28 | |
29 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 25 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
30 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 26 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
31 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 27 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
32 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 28 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
33 #else | 29 #else |
34 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. | 30 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. |
35 #endif | 31 #endif |
36 | 32 |
37 using media::VideoEncodeAccelerator; | 33 using media::VideoEncodeAccelerator; |
38 | 34 |
39 namespace content { | 35 namespace content { |
40 namespace { | 36 namespace { |
41 | 37 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 | 709 |
714 VEAClient::~VEAClient() { CHECK(!has_encoder()); } | 710 VEAClient::~VEAClient() { CHECK(!has_encoder()); } |
715 | 711 |
716 void VEAClient::CreateEncoder() { | 712 void VEAClient::CreateEncoder() { |
717 DCHECK(thread_checker_.CalledOnValidThread()); | 713 DCHECK(thread_checker_.CalledOnValidThread()); |
718 CHECK(!has_encoder()); | 714 CHECK(!has_encoder()); |
719 | 715 |
720 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 716 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
721 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 717 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
722 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); | 718 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); |
723 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 719 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
724 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); | 720 encoder_.reset(new VaapiVideoEncodeAccelerator()); |
725 #endif | 721 #endif |
726 | 722 |
727 SetState(CS_ENCODER_SET); | 723 SetState(CS_ENCODER_SET); |
728 | 724 |
729 DVLOG(1) << "Profile: " << test_stream_->requested_profile | 725 DVLOG(1) << "Profile: " << test_stream_->requested_profile |
730 << ", initial bitrate: " << requested_bitrate_; | 726 << ", initial bitrate: " << requested_bitrate_; |
731 if (!encoder_->Initialize(kInputFormat, | 727 if (!encoder_->Initialize(kInputFormat, |
732 test_stream_->visible_size, | 728 test_stream_->visible_size, |
733 test_stream_->requested_profile, | 729 test_stream_->requested_profile, |
734 requested_bitrate_, | 730 requested_bitrate_, |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 } | 1287 } |
1292 | 1288 |
1293 content::g_env = | 1289 content::g_env = |
1294 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1290 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
1295 testing::AddGlobalTestEnvironment( | 1291 testing::AddGlobalTestEnvironment( |
1296 new content::VideoEncodeAcceleratorTestEnvironment( | 1292 new content::VideoEncodeAcceleratorTestEnvironment( |
1297 test_stream_data.Pass()))); | 1293 test_stream_data.Pass()))); |
1298 | 1294 |
1299 return RUN_ALL_TESTS(); | 1295 return RUN_ALL_TESTS(); |
1300 } | 1296 } |
OLD | NEW |