| 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_X11) | |
| 27 #include "ui/gfx/x/x11_types.h" | |
| 28 #endif | |
| 29 | |
| 30 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 26 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 31 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 27 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
| 32 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 28 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 33 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 29 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
| 34 #else | 30 #else |
| 35 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. | 31 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. |
| 36 #endif | 32 #endif |
| 37 | 33 |
| 38 using media::VideoEncodeAccelerator; | 34 using media::VideoEncodeAccelerator; |
| 39 | 35 |
| 40 namespace content { | 36 namespace content { |
| 41 namespace { | 37 namespace { |
| 42 | 38 |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 724 |
| 729 VEAClient::~VEAClient() { CHECK(!has_encoder()); } | 725 VEAClient::~VEAClient() { CHECK(!has_encoder()); } |
| 730 | 726 |
| 731 void VEAClient::CreateEncoder() { | 727 void VEAClient::CreateEncoder() { |
| 732 DCHECK(thread_checker_.CalledOnValidThread()); | 728 DCHECK(thread_checker_.CalledOnValidThread()); |
| 733 CHECK(!has_encoder()); | 729 CHECK(!has_encoder()); |
| 734 | 730 |
| 735 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 731 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
| 736 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 732 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
| 737 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); | 733 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); |
| 738 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 734 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 739 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); | 735 encoder_.reset(new VaapiVideoEncodeAccelerator()); |
| 740 #endif | 736 #endif |
| 741 | 737 |
| 742 SetState(CS_ENCODER_SET); | 738 SetState(CS_ENCODER_SET); |
| 743 | 739 |
| 744 DVLOG(1) << "Profile: " << test_stream_->requested_profile | 740 DVLOG(1) << "Profile: " << test_stream_->requested_profile |
| 745 << ", initial bitrate: " << requested_bitrate_; | 741 << ", initial bitrate: " << requested_bitrate_; |
| 746 if (!encoder_->Initialize(kInputFormat, | 742 if (!encoder_->Initialize(kInputFormat, |
| 747 test_stream_->visible_size, | 743 test_stream_->visible_size, |
| 748 test_stream_->requested_profile, | 744 test_stream_->requested_profile, |
| 749 requested_bitrate_, | 745 requested_bitrate_, |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 } | 1325 } |
| 1330 | 1326 |
| 1331 content::g_env = | 1327 content::g_env = |
| 1332 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1328 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
| 1333 testing::AddGlobalTestEnvironment( | 1329 testing::AddGlobalTestEnvironment( |
| 1334 new content::VideoEncodeAcceleratorTestEnvironment( | 1330 new content::VideoEncodeAcceleratorTestEnvironment( |
| 1335 test_stream_data.Pass(), run_at_fps))); | 1331 test_stream_data.Pass(), run_at_fps))); |
| 1336 | 1332 |
| 1337 return RUN_ALL_TESTS(); | 1333 return RUN_ALL_TESTS(); |
| 1338 } | 1334 } |
| OLD | NEW |