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/file_util.h" | 8 #include "base/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.h" | 12 #include "base/process/process.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/time/time.h" | 15 #include "base/time/time.h" |
16 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | 16 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" |
17 #include "media/base/bind_to_current_loop.h" | 17 #include "media/base/bind_to_current_loop.h" |
18 #include "media/base/bitstream_buffer.h" | 18 #include "media/base/bitstream_buffer.h" |
19 #include "media/base/test_data_util.h" | 19 #include "media/base/test_data_util.h" |
20 #include "media/filters/h264_parser.h" | 20 #include "media/filters/h264_parser.h" |
21 #include "media/video/video_encode_accelerator.h" | 21 #include "media/video/video_encode_accelerator.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 #if defined(USE_X11) | |
25 #include "ui/gfx/x/x11_types.h" | |
26 #endif | |
27 | |
28 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 24 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
29 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" | 25 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" |
30 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 26 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) |
31 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 27 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
32 #else | 28 #else |
33 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. | 29 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. |
34 #endif | 30 #endif |
35 | 31 |
36 using media::VideoEncodeAccelerator; | 32 using media::VideoEncodeAccelerator; |
37 | 33 |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 576 |
581 VEAClient::~VEAClient() { CHECK(!has_encoder()); } | 577 VEAClient::~VEAClient() { CHECK(!has_encoder()); } |
582 | 578 |
583 void VEAClient::CreateEncoder() { | 579 void VEAClient::CreateEncoder() { |
584 DCHECK(thread_checker_.CalledOnValidThread()); | 580 DCHECK(thread_checker_.CalledOnValidThread()); |
585 CHECK(!has_encoder()); | 581 CHECK(!has_encoder()); |
586 | 582 |
587 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 583 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
588 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); | 584 scoped_ptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kEncoder); |
589 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); | 585 encoder_.reset(new V4L2VideoEncodeAccelerator(device.Pass())); |
590 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) | 586 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
591 encoder_.reset(new VaapiVideoEncodeAccelerator(gfx::GetXDisplay())); | 587 encoder_.reset(new VaapiVideoEncodeAccelerator()); |
592 #endif | 588 #endif |
593 | 589 |
594 SetState(CS_ENCODER_SET); | 590 SetState(CS_ENCODER_SET); |
595 | 591 |
596 DVLOG(1) << "Profile: " << test_stream_.requested_profile | 592 DVLOG(1) << "Profile: " << test_stream_.requested_profile |
597 << ", initial bitrate: " << test_stream_.requested_bitrate; | 593 << ", initial bitrate: " << test_stream_.requested_bitrate; |
598 if (!encoder_->Initialize(kInputFormat, | 594 if (!encoder_->Initialize(kInputFormat, |
599 test_stream_.size, | 595 test_stream_.size, |
600 test_stream_.requested_profile, | 596 test_stream_.requested_profile, |
601 test_stream_.requested_bitrate, | 597 test_stream_.requested_bitrate, |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 test_stream_data->assign(it->second.c_str()); | 1050 test_stream_data->assign(it->second.c_str()); |
1055 continue; | 1051 continue; |
1056 } | 1052 } |
1057 if (it->first == "v" || it->first == "vmodule") | 1053 if (it->first == "v" || it->first == "vmodule") |
1058 continue; | 1054 continue; |
1059 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1055 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1060 } | 1056 } |
1061 | 1057 |
1062 return RUN_ALL_TESTS(); | 1058 return RUN_ALL_TESTS(); |
1063 } | 1059 } |
OLD | NEW |