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