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

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

Issue 430583005: Make VEA test support videos with different coded size and visible size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Copy data line by line Created 6 years, 3 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 "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"
(...skipping 15 matching lines...) Expand all
26 #endif 26 #endif
27 27
28 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 28 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
29 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" 29 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
30 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11) 30 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) && defined(USE_X11)
31 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" 31 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h"
32 #else 32 #else
33 #error The VideoEncodeAcceleratorUnittest is not supported on this platform. 33 #error The VideoEncodeAcceleratorUnittest is not supported on this platform.
34 #endif 34 #endif
35 35
36 #define ALIGN_64_BYTES(x) (((x) + 63) & ~63)
37
36 using media::VideoEncodeAccelerator; 38 using media::VideoEncodeAccelerator;
37 39
38 namespace content { 40 namespace content {
39 namespace { 41 namespace {
40 42
41 const media::VideoFrame::Format kInputFormat = media::VideoFrame::I420; 43 const media::VideoFrame::Format kInputFormat = media::VideoFrame::I420;
42 44
43 // Arbitrarily chosen to add some depth to the pipeline. 45 // Arbitrarily chosen to add some depth to the pipeline.
44 const unsigned int kNumOutputBuffers = 4; 46 const unsigned int kNumOutputBuffers = 4;
45 const unsigned int kNumExtraInputFrames = 4; 47 const unsigned int kNumExtraInputFrames = 4;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 98
97 struct TestStream { 99 struct TestStream {
98 TestStream() 100 TestStream()
99 : requested_bitrate(0), 101 : requested_bitrate(0),
100 requested_framerate(0), 102 requested_framerate(0),
101 requested_subsequent_bitrate(0), 103 requested_subsequent_bitrate(0),
102 requested_subsequent_framerate(0) {} 104 requested_subsequent_framerate(0) {}
103 ~TestStream() {} 105 ~TestStream() {}
104 106
105 gfx::Size size; 107 gfx::Size size;
108 std::string in_filename;
106 base::MemoryMappedFile input_file; 109 base::MemoryMappedFile input_file;
107 media::VideoCodecProfile requested_profile; 110 media::VideoCodecProfile requested_profile;
111 base::FilePath temp_file;
108 std::string out_filename; 112 std::string out_filename;
109 unsigned int requested_bitrate; 113 unsigned int requested_bitrate;
110 unsigned int requested_framerate; 114 unsigned int requested_framerate;
111 unsigned int requested_subsequent_bitrate; 115 unsigned int requested_subsequent_bitrate;
112 unsigned int requested_subsequent_framerate; 116 unsigned int requested_subsequent_framerate;
113 }; 117 };
114 118
119 static bool WriteFile(base::File* file,
120 const char* data,
121 size_t size,
122 off_t *offset) {
123 size_t write_bytes = 0;
124 while (write_bytes < size) {
125 int bytes = file->Write(*offset, data + write_bytes, size - write_bytes);
126 if (!bytes) return false;
127 write_bytes += bytes;
128 *offset += bytes;
129 }
130 return true;
131 }
132
wuchengli 2014/08/26 09:53:24 Add comment to explain what this function does.
henryhsu 2014/08/27 02:59:06 Done.
133 static bool PrepareAlignedTempFile(TestStream* test_stream,
wuchengli 2014/08/26 09:53:24 Output parameter should be after input.
henryhsu 2014/08/27 02:59:06 Done.
134 const gfx::Size& coded_size,
135 size_t* input_buffer_size) {
136 off_t input_planes_count = media::VideoFrame::NumPlanes(kInputFormat);
wuchengli 2014/08/26 09:53:24 s/input_planes_count/input_num_planes/ to be consi
henryhsu 2014/08/27 02:59:06 Done.
137 size_t *padding_size = new size_t[input_planes_count];
wuchengli 2014/08/26 09:53:24 s/size_t */size_t* /
henryhsu 2014/08/27 02:59:06 Done.
138
wuchengli 2014/08/26 09:53:24 Add comments for important parts of this function.
henryhsu 2014/08/27 02:59:05 Done.
139 *input_buffer_size = 0;
140 for (off_t i = 0; i < input_planes_count; i++) {
141 size_t size = media::VideoFrame::PlaneAllocationSize(
142 kInputFormat, i, coded_size);
143 padding_size[i] = ALIGN_64_BYTES(size) - size;
144 *input_buffer_size += ALIGN_64_BYTES(size);
145 }
146
147 if (!test_stream->input_file.IsValid()) {
148 base::MemoryMappedFile input_file;
149 CHECK(base::CreateTemporaryFile(&test_stream->temp_file));
150 CHECK(input_file.Initialize(base::FilePath(test_stream->in_filename)));
151 uint32 flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE;
152 base::File file(base::FilePath(test_stream->temp_file), flags);
153
154 off_t position = 0, offset = 0;
155 char *dummy_buffer = new char[coded_size.width()];
156 while (position < static_cast<off_t>(input_file.length())) {
157 for (off_t i = 0; i < input_planes_count; i++) {
158 size_t coded_bpl =
159 media::VideoFrame::RowBytes(i, kInputFormat, coded_size.width());
160 size_t visible_bpl =
161 media::VideoFrame::RowBytes(i, kInputFormat,
162 test_stream->size.width());
163 size_t padding_bpl = coded_bpl - visible_bpl;
164 off_t rows = media::VideoFrame::Rows(i, kInputFormat,
165 test_stream->size.height());
166 for (off_t j = 0; j < rows; j++) {
167 char *buffer = reinterpret_cast<char*>(
168 const_cast<uint8*>(input_file.data() + position));
169 CHECK(WriteFile(&file, buffer, visible_bpl, &offset));
170 CHECK(WriteFile(&file, dummy_buffer, padding_bpl, &offset));
171 position += visible_bpl;
172 }
173 off_t padding_rows =
174 media::VideoFrame::Rows(i, kInputFormat, coded_size.height()) -
175 rows;
176 for (off_t j = 0; j < padding_rows; j++) {
177 CHECK(WriteFile(&file, dummy_buffer, coded_bpl, &offset));
178 }
wuchengli 2014/08/26 09:53:24 Remove parenthesis to be consistent with the next
henryhsu 2014/08/27 02:59:05 Done.
179 if (padding_size[i])
180 CHECK(WriteFile(&file, dummy_buffer, padding_size[i], &offset));
181 }
182 }
183 file.Close();
184 CHECK(test_stream->input_file.Initialize(test_stream->temp_file));
185 delete[] dummy_buffer;
186 }
187 delete[] padding_size;
188 return true;
189 }
190
191 static void RemoveTempFile(ScopedVector<TestStream>* test_streams) {
wuchengli 2014/08/26 09:53:25 s/RemoveTempFile/RemoveTempFiles/. If a function
henryhsu 2014/08/27 02:59:05 Done.
192 for (size_t i = 0; i < test_streams->size(); i++) {
193 base::DeleteFile((*test_streams)[i]->temp_file, false);
194 }
195 }
196
115 // Parse |data| into its constituent parts, set the various output fields 197 // Parse |data| into its constituent parts, set the various output fields
116 // accordingly, read in video stream, and store them to |test_streams|. 198 // accordingly, read in video stream, and store them to |test_streams|.
117 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, 199 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data,
118 ScopedVector<TestStream>* test_streams) { 200 ScopedVector<TestStream>* test_streams) {
119 // Split the string to individual test stream data. 201 // Split the string to individual test stream data.
120 std::vector<base::FilePath::StringType> test_streams_data; 202 std::vector<base::FilePath::StringType> test_streams_data;
121 base::SplitString(data, ';', &test_streams_data); 203 base::SplitString(data, ';', &test_streams_data);
122 CHECK_GE(test_streams_data.size(), 1U) << data; 204 CHECK_GE(test_streams_data.size(), 1U) << data;
123 205
124 // Parse each test stream data and read the input file. 206 // Parse each test stream data and read the input file.
125 for (size_t index = 0; index < test_streams_data.size(); ++index) { 207 for (size_t index = 0; index < test_streams_data.size(); ++index) {
126 std::vector<base::FilePath::StringType> fields; 208 std::vector<base::FilePath::StringType> fields;
127 base::SplitString(test_streams_data[index], ':', &fields); 209 base::SplitString(test_streams_data[index], ':', &fields);
128 CHECK_GE(fields.size(), 4U) << data; 210 CHECK_GE(fields.size(), 4U) << data;
129 CHECK_LE(fields.size(), 9U) << data; 211 CHECK_LE(fields.size(), 9U) << data;
130 TestStream* test_stream = new TestStream(); 212 TestStream* test_stream = new TestStream();
131 213
132 base::FilePath::StringType filename = fields[0]; 214 test_stream->in_filename = fields[0];
133 int width, height; 215 int width, height;
134 CHECK(base::StringToInt(fields[1], &width)); 216 CHECK(base::StringToInt(fields[1], &width));
135 CHECK(base::StringToInt(fields[2], &height)); 217 CHECK(base::StringToInt(fields[2], &height));
136 test_stream->size = gfx::Size(width, height); 218 test_stream->size = gfx::Size(width, height);
137 CHECK(!test_stream->size.IsEmpty()); 219 CHECK(!test_stream->size.IsEmpty());
138 int profile; 220 int profile;
139 CHECK(base::StringToInt(fields[3], &profile)); 221 CHECK(base::StringToInt(fields[3], &profile));
140 CHECK_GT(profile, media::VIDEO_CODEC_PROFILE_UNKNOWN); 222 CHECK_GT(profile, media::VIDEO_CODEC_PROFILE_UNKNOWN);
141 CHECK_LE(profile, media::VIDEO_CODEC_PROFILE_MAX); 223 CHECK_LE(profile, media::VIDEO_CODEC_PROFILE_MAX);
142 test_stream->requested_profile = 224 test_stream->requested_profile =
(...skipping 11 matching lines...) Expand all
154 if (fields.size() >= 8 && !fields[7].empty()) { 236 if (fields.size() >= 8 && !fields[7].empty()) {
155 CHECK(base::StringToUint(fields[7], 237 CHECK(base::StringToUint(fields[7],
156 &test_stream->requested_subsequent_bitrate)); 238 &test_stream->requested_subsequent_bitrate));
157 } 239 }
158 240
159 if (fields.size() >= 9 && !fields[8].empty()) { 241 if (fields.size() >= 9 && !fields[8].empty()) {
160 CHECK(base::StringToUint(fields[8], 242 CHECK(base::StringToUint(fields[8],
161 &test_stream->requested_subsequent_framerate)); 243 &test_stream->requested_subsequent_framerate));
162 } 244 }
163 245
164 CHECK(test_stream->input_file.Initialize(base::FilePath(filename)));
165 test_streams->push_back(test_stream); 246 test_streams->push_back(test_stream);
166 } 247 }
167 } 248 }
168 249
169 // Set default parameters of |test_streams| and update the parameters according 250 // Set default parameters of |test_streams| and update the parameters according
170 // to |mid_stream_bitrate_switch| and |mid_stream_framerate_switch|. 251 // to |mid_stream_bitrate_switch| and |mid_stream_framerate_switch|.
171 static void UpdateTestStreamData(bool mid_stream_bitrate_switch, 252 static void UpdateTestStreamData(bool mid_stream_bitrate_switch,
172 bool mid_stream_framerate_switch, 253 bool mid_stream_framerate_switch,
173 ScopedVector<TestStream>* test_streams) { 254 ScopedVector<TestStream>* test_streams) {
174 for (size_t i = 0; i < test_streams->size(); i++) { 255 for (size_t i = 0; i < test_streams->size(); i++) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 CHECK(validator_.get()); 626 CHECK(validator_.get());
546 627
547 if (save_to_file_) { 628 if (save_to_file_) {
548 CHECK(!test_stream_.out_filename.empty()); 629 CHECK(!test_stream_.out_filename.empty());
549 base::FilePath out_filename(test_stream_.out_filename); 630 base::FilePath out_filename(test_stream_.out_filename);
550 // This creates or truncates out_filename. 631 // This creates or truncates out_filename.
551 // Without it, AppendToFile() will not work. 632 // Without it, AppendToFile() will not work.
552 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); 633 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0));
553 } 634 }
554 635
555 input_buffer_size_ =
556 media::VideoFrame::AllocationSize(kInputFormat, test_stream.size);
557 CHECK_GT(input_buffer_size_, 0UL);
558
559 // Calculate the number of frames in the input stream by dividing its length
560 // in bytes by frame size in bytes.
561 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0U)
562 << "Stream byte size is not a product of calculated frame byte size";
563 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_;
564 CHECK_GT(num_frames_in_stream_, 0UL);
565 CHECK_LE(num_frames_in_stream_, kMaxFrameNum);
566
567 // We may need to loop over the stream more than once if more frames than
568 // provided is required for bitrate tests.
569 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) {
570 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_
571 << " frames), will loop it to reach " << kMinFramesForBitrateTests
572 << " frames";
573 num_frames_to_encode_ = kMinFramesForBitrateTests;
574 } else {
575 num_frames_to_encode_ = num_frames_in_stream_;
576 }
577
578 thread_checker_.DetachFromThread(); 636 thread_checker_.DetachFromThread();
579 } 637 }
580 638
581 VEAClient::~VEAClient() { CHECK(!has_encoder()); } 639 VEAClient::~VEAClient() { CHECK(!has_encoder()); }
582 640
583 void VEAClient::CreateEncoder() { 641 void VEAClient::CreateEncoder() {
584 DCHECK(thread_checker_.CalledOnValidThread()); 642 DCHECK(thread_checker_.CalledOnValidThread());
585 CHECK(!has_encoder()); 643 CHECK(!has_encoder());
586 644
587 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 645 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return num_encoded_frames_ / duration.InSecondsF(); 680 return num_encoded_frames_ / duration.InSecondsF();
623 } 681 }
624 682
625 void VEAClient::RequireBitstreamBuffers(unsigned int input_count, 683 void VEAClient::RequireBitstreamBuffers(unsigned int input_count,
626 const gfx::Size& input_coded_size, 684 const gfx::Size& input_coded_size,
627 size_t output_size) { 685 size_t output_size) {
628 DCHECK(thread_checker_.CalledOnValidThread()); 686 DCHECK(thread_checker_.CalledOnValidThread());
629 ASSERT_EQ(state_, CS_INITIALIZED); 687 ASSERT_EQ(state_, CS_INITIALIZED);
630 SetState(CS_ENCODING); 688 SetState(CS_ENCODING);
631 689
690 PrepareAlignedTempFile(const_cast<TestStream*>(&test_stream_),
691 input_coded_size,
692 &input_buffer_size_);
693 CHECK_GT(input_buffer_size_, 0UL);
694
695 // Calculate the number of frames in the input stream by dividing its length
696 // in bytes by frame size in bytes.
697 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0U)
698 << "Stream byte size is not a product of calculated frame byte size";
699 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_;
700 CHECK_GT(num_frames_in_stream_, 0UL);
701 CHECK_LE(num_frames_in_stream_, kMaxFrameNum);
702
703 // We may need to loop over the stream more than once if more frames than
704 // provided is required for bitrate tests.
705 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) {
706 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_
707 << " frames), will loop it to reach " << kMinFramesForBitrateTests
708 << " frames";
709 num_frames_to_encode_ = kMinFramesForBitrateTests;
710 } else {
711 num_frames_to_encode_ = num_frames_in_stream_;
712 }
713
632 // TODO(posciak): For now we only support input streams that meet encoder 714 // TODO(posciak): For now we only support input streams that meet encoder
wuchengli 2014/08/26 09:53:24 remove the comments
henryhsu 2014/08/27 02:59:06 Done.
633 // size requirements exactly (i.e. coded size == visible size), so that we 715 // size requirements exactly (i.e. coded size == visible size), so that we
634 // can simply mmap the stream file and feed the encoder directly with chunks 716 // can simply mmap the stream file and feed the encoder directly with chunks
635 // of that, instead of memcpying from mmapped file into a separate set of 717 // of that, instead of memcpying from mmapped file into a separate set of
636 // input buffers that would meet the coded size and alignment requirements. 718 // input buffers that would meet the coded size and alignment requirements.
637 // If/when this is changed, the ARM-specific alignment check below should be 719 // If/when this is changed, the ARM-specific alignment check below should be
wuchengli 2014/08/26 09:53:25 Do we need to redo the below check?
henryhsu 2014/08/27 02:59:05 I think the below check is enabled when platform i
638 // redone as well. 720 // redone as well.
639 input_coded_size_ = input_coded_size; 721 input_coded_size_ = input_coded_size;
640 ASSERT_EQ(input_coded_size_, test_stream_.size);
641 #if defined(ARCH_CPU_ARMEL) 722 #if defined(ARCH_CPU_ARMEL)
642 // ARM performs CPU cache management with CPU cache line granularity. We thus 723 // ARM performs CPU cache management with CPU cache line granularity. We thus
643 // need to ensure our buffers are CPU cache line-aligned (64 byte-aligned). 724 // need to ensure our buffers are CPU cache line-aligned (64 byte-aligned).
644 // Otherwise newer kernels will refuse to accept them, and on older kernels 725 // Otherwise newer kernels will refuse to accept them, and on older kernels
645 // we'll be treating ourselves to random corruption. 726 // we'll be treating ourselves to random corruption.
646 // Since we are just mmapping and passing chunks of the input file, to ensure 727 // Since we are just mmapping and passing chunks of the input file, to ensure
647 // alignment, if the starting virtual addresses of the frames in it were not 728 // alignment, if the starting virtual addresses of the frames in it were not
wuchengli 2014/08/26 09:53:25 Explain all three planes have to be 64 byte-aligne
henryhsu 2014/08/27 02:59:06 Done.
648 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy 729 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy
649 // the frames into them before sending to the encoder. It would have been an 730 // the frames into them before sending to the encoder. It would have been an
650 // overkill here though, because, for now at least, we only test resolutions 731 // overkill here though, because, for now at least, we only test resolutions
651 // that result in proper alignment, and it would have also interfered with 732 // that result in proper alignment, and it would have also interfered with
wuchengli 2014/08/26 09:53:24 Update the comments.
henryhsu 2014/08/27 02:59:05 Done.
652 // performance testing. So just assert that the frame size is a multiple of 733 // performance testing. So just assert that the frame size is a multiple of
653 // 64 bytes. This ensures all frames start at 64-byte boundary, because 734 // 64 bytes. This ensures all frames start at 64-byte boundary, because
654 // MemoryMappedFile should be mmapp()ed at virtual page start as well. 735 // MemoryMappedFile should be mmapp()ed at virtual page start as well.
655 ASSERT_EQ(input_buffer_size_ & 63, 0u) 736 ASSERT_EQ(input_buffer_size_ & 63, 0u)
656 << "Frame size has to be a multiple of 64 bytes"; 737 << "Frame size has to be a multiple of 64 bytes";
657 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0) 738 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0)
658 << "Mapped file should be mapped at a 64 byte boundary"; 739 << "Mapped file should be mapped at a 64 byte boundary";
659 #endif 740 #endif
660 741
661 num_required_input_buffers_ = input_count; 742 num_required_input_buffers_ = input_count;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 void VEAClient::InputNoLongerNeededCallback(int32 input_id) { 817 void VEAClient::InputNoLongerNeededCallback(int32 input_id) {
737 std::set<int32>::iterator it = inputs_at_client_.find(input_id); 818 std::set<int32>::iterator it = inputs_at_client_.find(input_id);
738 ASSERT_NE(it, inputs_at_client_.end()); 819 ASSERT_NE(it, inputs_at_client_.end());
739 inputs_at_client_.erase(it); 820 inputs_at_client_.erase(it);
740 FeedEncoderWithInputs(); 821 FeedEncoderWithInputs();
741 } 822 }
742 823
743 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) { 824 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) {
744 CHECK_LE(position + input_buffer_size_, test_stream_.input_file.length()); 825 CHECK_LE(position + input_buffer_size_, test_stream_.input_file.length());
745 826
746 uint8* frame_data = 827 uint8* frame_data_y =
747 const_cast<uint8*>(test_stream_.input_file.data() + position); 828 const_cast<uint8*>(test_stream_.input_file.data() + position);
829 uint8* frame_data_u = frame_data_y +
830 ALIGN_64_BYTES(media::VideoFrame::PlaneAllocationSize(
831 kInputFormat, 0, input_coded_size_));
832 uint8* frame_data_v = frame_data_u +
833 ALIGN_64_BYTES(media::VideoFrame::PlaneAllocationSize(
834 kInputFormat, 1, input_coded_size_));
748 835
749 CHECK_GT(current_framerate_, 0U); 836 CHECK_GT(current_framerate_, 0U);
750 scoped_refptr<media::VideoFrame> frame = 837 scoped_refptr<media::VideoFrame> frame =
751 media::VideoFrame::WrapExternalYuvData( 838 media::VideoFrame::WrapExternalYuvData(
752 kInputFormat, 839 kInputFormat,
753 input_coded_size_, 840 input_coded_size_,
754 gfx::Rect(test_stream_.size), 841 gfx::Rect(test_stream_.size),
755 test_stream_.size, 842 test_stream_.size,
756 input_coded_size_.width(), 843 input_coded_size_.width(),
757 input_coded_size_.width() / 2, 844 input_coded_size_.width() / 2,
758 input_coded_size_.width() / 2, 845 input_coded_size_.width() / 2,
759 frame_data, 846 frame_data_y,
760 frame_data + input_coded_size_.GetArea(), 847 frame_data_u,
761 frame_data + (input_coded_size_.GetArea() * 5 / 4), 848 frame_data_v,
762 base::TimeDelta().FromMilliseconds( 849 base::TimeDelta().FromMilliseconds(
763 next_input_id_ * base::Time::kMillisecondsPerSecond / 850 next_input_id_ * base::Time::kMillisecondsPerSecond /
764 current_framerate_), 851 current_framerate_),
765 media::BindToCurrentLoop( 852 media::BindToCurrentLoop(
766 base::Bind(&VEAClient::InputNoLongerNeededCallback, 853 base::Bind(&VEAClient::InputNoLongerNeededCallback,
767 base::Unretained(this), 854 base::Unretained(this),
768 next_input_id_))); 855 next_input_id_)));
769 856
770 CHECK(inputs_at_client_.insert(next_input_id_).second); 857 CHECK(inputs_at_client_.insert(next_input_id_).second);
771 ++next_input_id_; 858 ++next_input_id_;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 for (size_t state_no = 0; state_no < arraysize(state_transitions); ++state_no) 1053 for (size_t state_no = 0; state_no < arraysize(state_transitions); ++state_no)
967 for (size_t i = 0; i < num_concurrent_encoders; i++) 1054 for (size_t i = 0; i < num_concurrent_encoders; i++)
968 ASSERT_EQ(notes[i]->Wait(), state_transitions[state_no]); 1055 ASSERT_EQ(notes[i]->Wait(), state_transitions[state_no]);
969 1056
970 for (size_t i = 0; i < num_concurrent_encoders; ++i) { 1057 for (size_t i = 0; i < num_concurrent_encoders; ++i) {
971 encoder_thread.message_loop()->PostTask( 1058 encoder_thread.message_loop()->PostTask(
972 FROM_HERE, 1059 FROM_HERE,
973 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i]))); 1060 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i])));
974 } 1061 }
975 1062
1063 RemoveTempFile(&test_streams);
976 // This ensures all tasks have finished. 1064 // This ensures all tasks have finished.
977 encoder_thread.Stop(); 1065 encoder_thread.Stop();
978 } 1066 }
979 1067
980 INSTANTIATE_TEST_CASE_P( 1068 INSTANTIATE_TEST_CASE_P(
981 SimpleEncode, 1069 SimpleEncode,
982 VideoEncodeAcceleratorTest, 1070 VideoEncodeAcceleratorTest,
983 ::testing::Values(MakeTuple(1, true, 0, false, false, false, false))); 1071 ::testing::Values(MakeTuple(1, true, 0, false, false, false, false)));
984 1072
985 INSTANTIATE_TEST_CASE_P( 1073 INSTANTIATE_TEST_CASE_P(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 test_stream_data->assign(it->second.c_str()); 1142 test_stream_data->assign(it->second.c_str());
1055 continue; 1143 continue;
1056 } 1144 }
1057 if (it->first == "v" || it->first == "vmodule") 1145 if (it->first == "v" || it->first == "vmodule")
1058 continue; 1146 continue;
1059 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1147 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1060 } 1148 }
1061 1149
1062 return RUN_ALL_TESTS(); 1150 return RUN_ALL_TESTS();
1063 } 1151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698