Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: media/gpu/video_encode_accelerator_unittest.cc

Issue 2058413003: H264 HW encode using MediaFoundation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <inttypes.h> 5 #include <inttypes.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/at_exit.h" 15 #include "base/at_exit.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
19 #include "base/files/memory_mapped_file.h" 19 #include "base/files/memory_mapped_file.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/memory/scoped_vector.h" 21 #include "base/memory/scoped_vector.h"
22 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
23 #include "base/numerics/safe_conversions.h" 23 #include "base/numerics/safe_conversions.h"
24 #include "base/process/process_handle.h" 24 #include "base/process/process_handle.h"
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_split.h" 26 #include "base/strings/string_split.h"
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/thread.h" 29 #include "base/threading/thread.h"
29 #include "base/threading/thread_checker.h" 30 #include "base/threading/thread_checker.h"
30 #include "base/time/time.h" 31 #include "base/time/time.h"
31 #include "base/timer/timer.h" 32 #include "base/timer/timer.h"
32 #include "build/build_config.h" 33 #include "build/build_config.h"
33 #include "media/base/bind_to_current_loop.h" 34 #include "media/base/bind_to_current_loop.h"
34 #include "media/base/bitstream_buffer.h" 35 #include "media/base/bitstream_buffer.h"
35 #include "media/base/cdm_context.h" 36 #include "media/base/cdm_context.h"
36 #include "media/base/decoder_buffer.h" 37 #include "media/base/decoder_buffer.h"
37 #include "media/base/media_util.h" 38 #include "media/base/media_util.h"
(...skipping 14 matching lines...) Expand all
52 #include "media/gpu/v4l2_video_encode_accelerator.h" 53 #include "media/gpu/v4l2_video_encode_accelerator.h"
53 #endif 54 #endif
54 #if defined(ARCH_CPU_X86_FAMILY) 55 #if defined(ARCH_CPU_X86_FAMILY)
55 #include "media/gpu/vaapi_video_encode_accelerator.h" 56 #include "media/gpu/vaapi_video_encode_accelerator.h"
56 #include "media/gpu/vaapi_wrapper.h" 57 #include "media/gpu/vaapi_wrapper.h"
57 // Status has been defined as int in Xlib.h. 58 // Status has been defined as int in Xlib.h.
58 #undef Status 59 #undef Status
59 #endif // defined(ARCH_CPU_X86_FAMILY) 60 #endif // defined(ARCH_CPU_X86_FAMILY)
60 #elif defined(OS_MACOSX) 61 #elif defined(OS_MACOSX)
61 #include "media/gpu/vt_video_encode_accelerator_mac.h" 62 #include "media/gpu/vt_video_encode_accelerator_mac.h"
63 #elif defined(OS_WIN)
64 #include "media/gpu/media_foundation_video_encode_accelerator_win.h"
62 #else 65 #else
63 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. 66 #error The VideoEncodeAcceleratorUnittest is not supported on this platform.
64 #endif 67 #endif
65 68
66 namespace media { 69 namespace media {
67 namespace { 70 namespace {
68 71
69 const VideoPixelFormat kInputFormat = PIXEL_FORMAT_I420; 72 const VideoPixelFormat kInputFormat = PIXEL_FORMAT_I420;
70 73
71 // The absolute differences between original frame and decoded frame usually 74 // The absolute differences between original frame and decoded frame usually
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // makes sure starting address of YUV planes are 64 bytes-aligned. 171 // makes sure starting address of YUV planes are 64 bytes-aligned.
169 std::vector<char> aligned_in_file_data; 172 std::vector<char> aligned_in_file_data;
170 173
171 // Byte size of a frame of |aligned_in_file_data|. 174 // Byte size of a frame of |aligned_in_file_data|.
172 size_t aligned_buffer_size; 175 size_t aligned_buffer_size;
173 176
174 // Byte size for each aligned plane of a frame. 177 // Byte size for each aligned plane of a frame.
175 std::vector<size_t> aligned_plane_size; 178 std::vector<size_t> aligned_plane_size;
176 179
177 std::string out_filename; 180 std::string out_filename;
181
178 VideoCodecProfile requested_profile; 182 VideoCodecProfile requested_profile;
179 unsigned int requested_bitrate; 183 unsigned int requested_bitrate;
180 unsigned int requested_framerate; 184 unsigned int requested_framerate;
181 unsigned int requested_subsequent_bitrate; 185 unsigned int requested_subsequent_bitrate;
182 unsigned int requested_subsequent_framerate; 186 unsigned int requested_subsequent_framerate;
183 }; 187 };
184 188
185 inline static size_t Align64Bytes(size_t value) { 189 inline static size_t Align64Bytes(size_t value) {
186 return (value + 63) & ~63; 190 return (value + 63) & ~63;
187 } 191 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 visible_bpl[i] = VideoFrame::RowBytes(i, kInputFormat, 254 visible_bpl[i] = VideoFrame::RowBytes(i, kInputFormat,
251 test_stream->visible_size.width()); 255 test_stream->visible_size.width());
252 visible_plane_rows[i] = 256 visible_plane_rows[i] =
253 VideoFrame::Rows(i, kInputFormat, test_stream->visible_size.height()); 257 VideoFrame::Rows(i, kInputFormat, test_stream->visible_size.height());
254 const size_t padding_rows = 258 const size_t padding_rows =
255 VideoFrame::Rows(i, kInputFormat, coded_size.height()) - 259 VideoFrame::Rows(i, kInputFormat, coded_size.height()) -
256 visible_plane_rows[i]; 260 visible_plane_rows[i];
257 padding_sizes[i] = padding_rows * coded_bpl[i] + Align64Bytes(size) - size; 261 padding_sizes[i] = padding_rows * coded_bpl[i] + Align64Bytes(size) - size;
258 } 262 }
259 263
264 #if defined(OS_POSIX)
260 base::FilePath src_file(test_stream->in_filename); 265 base::FilePath src_file(test_stream->in_filename);
266 #elif defined(OS_WIN)
267 base::FilePath src_file(base::UTF8ToWide(test_stream->in_filename));
268 #endif
261 int64_t src_file_size = 0; 269 int64_t src_file_size = 0;
262 LOG_ASSERT(base::GetFileSize(src_file, &src_file_size)); 270 LOG_ASSERT(base::GetFileSize(src_file, &src_file_size));
263 271
264 size_t visible_buffer_size = 272 size_t visible_buffer_size =
265 VideoFrame::AllocationSize(kInputFormat, test_stream->visible_size); 273 VideoFrame::AllocationSize(kInputFormat, test_stream->visible_size);
266 LOG_ASSERT(src_file_size % visible_buffer_size == 0U) 274 LOG_ASSERT(src_file_size % visible_buffer_size == 0U)
267 << "Stream byte size is not a product of calculated frame byte size"; 275 << "Stream byte size is not a product of calculated frame byte size";
268 276
269 test_stream->num_frames = src_file_size / visible_buffer_size; 277 test_stream->num_frames = src_file_size / visible_buffer_size;
270 278
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 324
317 // Parse each test stream data and read the input file. 325 // Parse each test stream data and read the input file.
318 for (size_t index = 0; index < test_streams_data.size(); ++index) { 326 for (size_t index = 0; index < test_streams_data.size(); ++index) {
319 std::vector<base::FilePath::StringType> fields = base::SplitString( 327 std::vector<base::FilePath::StringType> fields = base::SplitString(
320 test_streams_data[index], base::FilePath::StringType(1, ':'), 328 test_streams_data[index], base::FilePath::StringType(1, ':'),
321 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 329 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
322 LOG_ASSERT(fields.size() >= 4U) << data; 330 LOG_ASSERT(fields.size() >= 4U) << data;
323 LOG_ASSERT(fields.size() <= 9U) << data; 331 LOG_ASSERT(fields.size() <= 9U) << data;
324 TestStream* test_stream = new TestStream(); 332 TestStream* test_stream = new TestStream();
325 333
326 test_stream->in_filename = fields[0]; 334 #if defined(OS_POSIX)
335 test_stream->in_filename = fields[0];
336 #elif defined(OS_WIN)
337 test_stream->in_filename = base::WideToUTF8(fields[0]);
338 #endif
327 int width, height; 339 int width, height;
328 bool result = base::StringToInt(fields[1], &width); 340 bool result = base::StringToInt(fields[1], &width);
329 LOG_ASSERT(result); 341 LOG_ASSERT(result);
330 result = base::StringToInt(fields[2], &height); 342 result = base::StringToInt(fields[2], &height);
331 LOG_ASSERT(result); 343 LOG_ASSERT(result);
332 test_stream->visible_size = gfx::Size(width, height); 344 test_stream->visible_size = gfx::Size(width, height);
333 LOG_ASSERT(!test_stream->visible_size.IsEmpty()); 345 LOG_ASSERT(!test_stream->visible_size.IsEmpty());
334 int profile; 346 int profile;
335 result = base::StringToInt(fields[3], &profile); 347 result = base::StringToInt(fields[3], &profile);
336 LOG_ASSERT(result); 348 LOG_ASSERT(result);
337 LOG_ASSERT(profile > VIDEO_CODEC_PROFILE_UNKNOWN); 349 LOG_ASSERT(profile > VIDEO_CODEC_PROFILE_UNKNOWN);
338 LOG_ASSERT(profile <= VIDEO_CODEC_PROFILE_MAX); 350 LOG_ASSERT(profile <= VIDEO_CODEC_PROFILE_MAX);
339 test_stream->requested_profile = static_cast<VideoCodecProfile>(profile); 351 test_stream->requested_profile = static_cast<VideoCodecProfile>(profile);
340 352
341 if (fields.size() >= 5 && !fields[4].empty()) 353 if (fields.size() >= 5 && !fields[4].empty()) {
354 #if defined(OS_POSIX)
342 test_stream->out_filename = fields[4]; 355 test_stream->out_filename = fields[4];
356 #elif defined(OS_WIN)
357 test_stream->out_filename = base::WideToUTF8(fields[4]);
358 #endif
359 }
343 360
344 if (fields.size() >= 6 && !fields[5].empty()) 361 if (fields.size() >= 6 && !fields[5].empty())
345 LOG_ASSERT( 362 LOG_ASSERT(
346 base::StringToUint(fields[5], &test_stream->requested_bitrate)); 363 base::StringToUint(fields[5], &test_stream->requested_bitrate));
347 364
348 if (fields.size() >= 7 && !fields[6].empty()) 365 if (fields.size() >= 7 && !fields[6].empty())
349 LOG_ASSERT( 366 LOG_ASSERT(
350 base::StringToUint(fields[6], &test_stream->requested_framerate)); 367 base::StringToUint(fields[6], &test_stream->requested_framerate));
351 368
352 if (fields.size() >= 8 && !fields[7].empty()) { 369 if (fields.size() >= 8 && !fields[7].empty()) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // Flush the decoder. 612 // Flush the decoder.
596 void Flush(); 613 void Flush();
597 614
598 private: 615 private:
599 void InitializeCB(bool success); 616 void InitializeCB(bool success);
600 void DecodeDone(DecodeStatus status); 617 void DecodeDone(DecodeStatus status);
601 void FlushDone(DecodeStatus status); 618 void FlushDone(DecodeStatus status);
602 void VerifyOutputFrame(const scoped_refptr<VideoFrame>& output_frame); 619 void VerifyOutputFrame(const scoped_refptr<VideoFrame>& output_frame);
603 void Decode(); 620 void Decode();
604 621
605 enum State { UNINITIALIZED, INITIALIZED, DECODING, ERROR }; 622 enum State { UNINITIALIZED, INITIALIZED, DECODING, DECODER_ERROR };
606 623
607 const VideoCodecProfile profile_; 624 const VideoCodecProfile profile_;
608 std::unique_ptr<FFmpegVideoDecoder> decoder_; 625 std::unique_ptr<FFmpegVideoDecoder> decoder_;
609 VideoDecoder::DecodeCB decode_cb_; 626 VideoDecoder::DecodeCB decode_cb_;
610 // Decode callback of an EOS buffer. 627 // Decode callback of an EOS buffer.
611 VideoDecoder::DecodeCB eos_decode_cb_; 628 VideoDecoder::DecodeCB eos_decode_cb_;
612 // Callback of Flush(). Called after all frames are decoded. 629 // Callback of Flush(). Called after all frames are decoded.
613 const base::Closure flush_complete_cb_; 630 const base::Closure flush_complete_cb_;
614 const base::Closure decode_error_cb_; 631 const base::Closure decode_error_cb_;
615 State decoder_state_; 632 State decoder_state_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 base::Unretained(this)), 675 base::Unretained(this)),
659 base::Bind(&VideoFrameQualityValidator::VerifyOutputFrame, 676 base::Bind(&VideoFrameQualityValidator::VerifyOutputFrame,
660 base::Unretained(this))); 677 base::Unretained(this)));
661 } 678 }
662 679
663 void VideoFrameQualityValidator::InitializeCB(bool success) { 680 void VideoFrameQualityValidator::InitializeCB(bool success) {
664 if (success) { 681 if (success) {
665 decoder_state_ = INITIALIZED; 682 decoder_state_ = INITIALIZED;
666 Decode(); 683 Decode();
667 } else { 684 } else {
668 decoder_state_ = ERROR; 685 decoder_state_ = DECODER_ERROR;
669 if (IsH264(profile_)) 686 if (IsH264(profile_))
670 LOG(ERROR) << "Chromium does not support H264 decode. Try Chrome."; 687 LOG(ERROR) << "Chromium does not support H264 decode. Try Chrome.";
671 FAIL() << "Decoder initialization error"; 688 FAIL() << "Decoder initialization error";
672 decode_error_cb_.Run(); 689 decode_error_cb_.Run();
673 } 690 }
674 } 691 }
675 692
676 void VideoFrameQualityValidator::AddOriginalFrame( 693 void VideoFrameQualityValidator::AddOriginalFrame(
677 scoped_refptr<VideoFrame> frame) { 694 scoped_refptr<VideoFrame> frame) {
678 original_frames_.push(frame); 695 original_frames_.push(frame);
679 } 696 }
680 697
681 void VideoFrameQualityValidator::DecodeDone(DecodeStatus status) { 698 void VideoFrameQualityValidator::DecodeDone(DecodeStatus status) {
682 if (status == DecodeStatus::OK) { 699 if (status == DecodeStatus::OK) {
683 decoder_state_ = INITIALIZED; 700 decoder_state_ = INITIALIZED;
684 Decode(); 701 Decode();
685 } else { 702 } else {
686 decoder_state_ = ERROR; 703 decoder_state_ = DECODER_ERROR;
687 FAIL() << "Unexpected decode status = " << status << ". Stop decoding."; 704 FAIL() << "Unexpected decode status = " << status << ". Stop decoding.";
688 decode_error_cb_.Run(); 705 decode_error_cb_.Run();
689 } 706 }
690 } 707 }
691 708
692 void VideoFrameQualityValidator::FlushDone(DecodeStatus status) { 709 void VideoFrameQualityValidator::FlushDone(DecodeStatus status) {
693 flush_complete_cb_.Run(); 710 flush_complete_cb_.Run();
694 } 711 }
695 712
696 void VideoFrameQualityValidator::Flush() { 713 void VideoFrameQualityValidator::Flush() {
697 if (decoder_state_ != ERROR) { 714 if (decoder_state_ != DECODER_ERROR) {
698 decode_buffers_.push(DecoderBuffer::CreateEOSBuffer()); 715 decode_buffers_.push(DecoderBuffer::CreateEOSBuffer());
699 Decode(); 716 Decode();
700 } 717 }
701 } 718 }
702 719
703 void VideoFrameQualityValidator::AddDecodeBuffer( 720 void VideoFrameQualityValidator::AddDecodeBuffer(
704 const scoped_refptr<DecoderBuffer>& buffer) { 721 const scoped_refptr<DecoderBuffer>& buffer) {
705 if (decoder_state_ != ERROR) { 722 if (decoder_state_ != DECODER_ERROR) {
706 decode_buffers_.push(buffer); 723 decode_buffers_.push(buffer);
707 Decode(); 724 Decode();
708 } 725 }
709 } 726 }
710 727
711 void VideoFrameQualityValidator::Decode() { 728 void VideoFrameQualityValidator::Decode() {
712 if (decoder_state_ == INITIALIZED && !decode_buffers_.empty()) { 729 if (decoder_state_ == INITIALIZED && !decode_buffers_.empty()) {
713 scoped_refptr<DecoderBuffer> next_buffer = decode_buffers_.front(); 730 scoped_refptr<DecoderBuffer> next_buffer = decode_buffers_.front();
714 decode_buffers_.pop(); 731 decode_buffers_.pop();
715 decoder_state_ = DECODING; 732 decoder_state_ = DECODING;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 private: 794 private:
778 bool has_encoder() { return encoder_.get(); } 795 bool has_encoder() { return encoder_.get(); }
779 796
780 // Return the number of encoded frames per second. 797 // Return the number of encoded frames per second.
781 double frames_per_second(); 798 double frames_per_second();
782 799
783 std::unique_ptr<VideoEncodeAccelerator> CreateFakeVEA(); 800 std::unique_ptr<VideoEncodeAccelerator> CreateFakeVEA();
784 std::unique_ptr<VideoEncodeAccelerator> CreateV4L2VEA(); 801 std::unique_ptr<VideoEncodeAccelerator> CreateV4L2VEA();
785 std::unique_ptr<VideoEncodeAccelerator> CreateVaapiVEA(); 802 std::unique_ptr<VideoEncodeAccelerator> CreateVaapiVEA();
786 std::unique_ptr<VideoEncodeAccelerator> CreateVTVEA(); 803 std::unique_ptr<VideoEncodeAccelerator> CreateVTVEA();
804 std::unique_ptr<VideoEncodeAccelerator> CreateMFVEA();
787 805
788 void SetState(ClientState new_state); 806 void SetState(ClientState new_state);
789 807
790 // Set current stream parameters to given |bitrate| at |framerate|. 808 // Set current stream parameters to given |bitrate| at |framerate|.
791 void SetStreamParameters(unsigned int bitrate, unsigned int framerate); 809 void SetStreamParameters(unsigned int bitrate, unsigned int framerate);
792 810
793 // Called when encoder is done with a VideoFrame. 811 // Called when encoder is done with a VideoFrame.
794 void InputNoLongerNeededCallback(int32_t input_id); 812 void InputNoLongerNeededCallback(int32_t input_id);
795 813
796 // Feed the encoder with one input frame. 814 // Feed the encoder with one input frame.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 // Fake encoder produces an invalid stream, so skip validating it. 1013 // Fake encoder produces an invalid stream, so skip validating it.
996 if (!g_fake_encoder) { 1014 if (!g_fake_encoder) {
997 stream_validator_ = StreamValidator::Create( 1015 stream_validator_ = StreamValidator::Create(
998 test_stream_->requested_profile, 1016 test_stream_->requested_profile,
999 base::Bind(&VEAClient::HandleEncodedFrame, base::Unretained(this))); 1017 base::Bind(&VEAClient::HandleEncodedFrame, base::Unretained(this)));
1000 CHECK(stream_validator_); 1018 CHECK(stream_validator_);
1001 } 1019 }
1002 1020
1003 if (save_to_file_) { 1021 if (save_to_file_) {
1004 LOG_ASSERT(!test_stream_->out_filename.empty()); 1022 LOG_ASSERT(!test_stream_->out_filename.empty());
1023 #if defined(OS_POSIX)
1005 base::FilePath out_filename(test_stream_->out_filename); 1024 base::FilePath out_filename(test_stream_->out_filename);
1025 #elif defined(OS_WIN)
1026 base::FilePath out_filename(
1027 base::UTF8ToWide(test_stream_->out_filename));
1028 #endif
1006 // This creates or truncates out_filename. 1029 // This creates or truncates out_filename.
1007 // Without it, AppendToFile() will not work. 1030 // Without it, AppendToFile() will not work.
1008 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); 1031 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0));
1009 } 1032 }
1010 1033
1011 // Initialize the parameters of the test streams. 1034 // Initialize the parameters of the test streams.
1012 UpdateTestStreamData(mid_stream_bitrate_switch, mid_stream_framerate_switch); 1035 UpdateTestStreamData(mid_stream_bitrate_switch, mid_stream_framerate_switch);
1013 1036
1014 thread_checker_.DetachFromThread(); 1037 thread_checker_.DetachFromThread();
1015 } 1038 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } 1071 }
1049 1072
1050 std::unique_ptr<VideoEncodeAccelerator> VEAClient::CreateVTVEA() { 1073 std::unique_ptr<VideoEncodeAccelerator> VEAClient::CreateVTVEA() {
1051 std::unique_ptr<VideoEncodeAccelerator> encoder; 1074 std::unique_ptr<VideoEncodeAccelerator> encoder;
1052 #if defined(OS_MACOSX) 1075 #if defined(OS_MACOSX)
1053 encoder.reset(new VTVideoEncodeAccelerator()); 1076 encoder.reset(new VTVideoEncodeAccelerator());
1054 #endif 1077 #endif
1055 return encoder; 1078 return encoder;
1056 } 1079 }
1057 1080
1081 std::unique_ptr<VideoEncodeAccelerator> VEAClient::CreateMFVEA() {
1082 std::unique_ptr<VideoEncodeAccelerator> encoder;
1083 #if defined(OS_WIN)
1084 encoder.reset(new MediaFoundationVideoEncodeAccelerator());
1085 #endif
1086 return encoder;
1087 }
1088
1058 void VEAClient::CreateEncoder() { 1089 void VEAClient::CreateEncoder() {
1059 DCHECK(thread_checker_.CalledOnValidThread()); 1090 DCHECK(thread_checker_.CalledOnValidThread());
1060 LOG_ASSERT(!has_encoder()); 1091 LOG_ASSERT(!has_encoder());
1061 1092
1062 std::unique_ptr<VideoEncodeAccelerator> encoders[] = { 1093 std::unique_ptr<VideoEncodeAccelerator> encoders[] = {
1063 CreateFakeVEA(), CreateV4L2VEA(), CreateVaapiVEA(), CreateVTVEA()}; 1094 CreateFakeVEA(), CreateV4L2VEA(), CreateVaapiVEA(), CreateVTVEA(),
1095 CreateMFVEA()};
1064 1096
1065 DVLOG(1) << "Profile: " << test_stream_->requested_profile 1097 DVLOG(1) << "Profile: " << test_stream_->requested_profile
1066 << ", initial bitrate: " << requested_bitrate_; 1098 << ", initial bitrate: " << requested_bitrate_;
1067 1099
1068 for (size_t i = 0; i < arraysize(encoders); ++i) { 1100 for (size_t i = 0; i < arraysize(encoders); ++i) {
1069 if (!encoders[i]) 1101 if (!encoders[i])
1070 continue; 1102 continue;
1071 encoder_ = std::move(encoders[i]); 1103 encoder_ = std::move(encoders[i]);
1072 SetState(CS_ENCODER_SET); 1104 SetState(CS_ENCODER_SET);
1073 if (encoder_->Initialize(kInputFormat, test_stream_->visible_size, 1105 if (encoder_->Initialize(kInputFormat, test_stream_->visible_size,
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 } // namespace 1730 } // namespace
1699 } // namespace media 1731 } // namespace media
1700 1732
1701 int main(int argc, char** argv) { 1733 int main(int argc, char** argv) {
1702 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. 1734 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args.
1703 base::CommandLine::Init(argc, argv); 1735 base::CommandLine::Init(argc, argv);
1704 1736
1705 base::ShadowingAtExitManager at_exit_manager; 1737 base::ShadowingAtExitManager at_exit_manager;
1706 base::MessageLoop main_loop; 1738 base::MessageLoop main_loop;
1707 1739
1740 base::FilePath test_data_filepath =
1741 media::GetTestDataFilePath(media::g_default_in_filename);
1742 base::AppendToFile(test_data_filepath, media::g_default_in_parameters,
1743 strlen(media::g_default_in_parameters));
1708 std::unique_ptr<base::FilePath::StringType> test_stream_data( 1744 std::unique_ptr<base::FilePath::StringType> test_stream_data(
1709 new base::FilePath::StringType( 1745 new base::FilePath::StringType(test_data_filepath.value()));
1710 media::GetTestDataFilePath(media::g_default_in_filename).value() +
1711 media::g_default_in_parameters));
1712 1746
1713 // Needed to enable DVLOG through --vmodule. 1747 // Needed to enable DVLOG through --vmodule.
1714 logging::LoggingSettings settings; 1748 logging::LoggingSettings settings;
1715 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 1749 settings.logging_dest = logging::LOG_DEFAULT;
1716 LOG_ASSERT(logging::InitLogging(settings)); 1750 LOG_ASSERT(logging::InitLogging(settings));
1717 1751
1718 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 1752 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1719 DCHECK(cmd_line); 1753 DCHECK(cmd_line);
1720 1754
1721 bool run_at_fps = false; 1755 bool run_at_fps = false;
1722 bool needs_encode_latency = false; 1756 bool needs_encode_latency = false;
1723 bool verify_all_output = false; 1757 bool verify_all_output = false;
1724 base::FilePath log_path; 1758 base::FilePath log_path;
1725 1759
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 1811
1778 media::g_env = 1812 media::g_env =
1779 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( 1813 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>(
1780 testing::AddGlobalTestEnvironment( 1814 testing::AddGlobalTestEnvironment(
1781 new media::VideoEncodeAcceleratorTestEnvironment( 1815 new media::VideoEncodeAcceleratorTestEnvironment(
1782 std::move(test_stream_data), log_path, run_at_fps, 1816 std::move(test_stream_data), log_path, run_at_fps,
1783 needs_encode_latency, verify_all_output))); 1817 needs_encode_latency, verify_all_output)));
1784 1818
1785 return RUN_ALL_TESTS(); 1819 return RUN_ALL_TESTS();
1786 } 1820 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698