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

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: address wucheng's review comments 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 // Use |coded_size| to copy YUV data into memory from |test_stream| input file.
120 // Also calculate |input_buffer_size| frame size value.
121 static bool PrepareAlignedTempFile(const gfx::Size& coded_size,
122 TestStream* test_stream,
123 size_t* input_buffer_size) {
124 size_t input_num_planes = media::VideoFrame::NumPlanes(kInputFormat);
125 size_t* padding_size = new size_t[input_num_planes];
126 size_t visible_frame_size = 0;
127
128 // YUV plane starting address should be 64 bytes alignment.
129 // Calculate padding size for each plane, and frame size for visible size
130 // and coded size.
131 *input_buffer_size = 0;
132 for (off_t i = 0; i < input_num_planes; i++) {
133 size_t size = media::VideoFrame::PlaneAllocationSize(
134 kInputFormat, i, coded_size);
135 padding_size[i] = ALIGN_64_BYTES(size) - size;
136 visible_frame_size += media::VideoFrame::PlaneAllocationSize(
137 kInputFormat, i, test_stream->size);
138 *input_buffer_size += ALIGN_64_BYTES(size);
139 }
140
141 // Test case may have many encoders and memory should be prepared once.
142 if (!test_stream->input_file.IsValid()) {
143 base::MemoryMappedFile input_file;
144 CHECK(base::CreateTemporaryFile(&test_stream->temp_file));
145 CHECK(input_file.Initialize(base::FilePath(test_stream->in_filename)));
146
147 size_t num_frames = input_file.length() / visible_frame_size;
148 uint32 flags = base::File::FLAG_CREATE_ALWAYS |
149 base::File::FLAG_WRITE |
150 base::File::FLAG_READ;
151
152 // Create a temporary file with coded_size length
153 base::File file(base::FilePath(test_stream->temp_file), flags);
154 file.Write(*input_buffer_size * num_frames - 1, ".", 1);
155 CHECK(test_stream->input_file.Initialize(file.Pass()));
156
157 off_t src_offset = 0, dest_offset = 0;
158 while (src_offset < static_cast<off_t>(input_file.length())) {
159 for (off_t i = 0; i < input_num_planes; i++) {
160 size_t coded_bpl =
161 media::VideoFrame::RowBytes(i, kInputFormat, coded_size.width());
162 size_t visible_bpl =
163 media::VideoFrame::RowBytes(i, kInputFormat,
164 test_stream->size.width());
165 off_t rows = media::VideoFrame::Rows(i, kInputFormat,
166 test_stream->size.height());
167 for (off_t j = 0; j < rows; j++) {
168 char *src = reinterpret_cast<char*>(
169 const_cast<uint8*>(input_file.data() + src_offset));
170 char *dest = reinterpret_cast<char*>(
171 const_cast<uint8*>(test_stream->input_file.data() + dest_offset));
172 memcpy(dest, src, visible_bpl);
173 src_offset += visible_bpl;
174 dest_offset += coded_bpl;
175 }
176 off_t padding_rows =
177 media::VideoFrame::Rows(i, kInputFormat, coded_size.height()) -
178 rows;
179 dest_offset += padding_rows * coded_bpl + padding_size[i];
180 }
181 }
182 file.Close();
rvargas (doing something else) 2014/08/26 21:25:21 no need to explicitly close the file
henryhsu 2014/08/27 02:59:06 Done.
183 }
184 delete[] padding_size;
185 return true;
186 }
187
115 // Parse |data| into its constituent parts, set the various output fields 188 // Parse |data| into its constituent parts, set the various output fields
116 // accordingly, read in video stream, and store them to |test_streams|. 189 // accordingly, read in video stream, and store them to |test_streams|.
117 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, 190 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data,
118 ScopedVector<TestStream>* test_streams) { 191 ScopedVector<TestStream>* test_streams) {
119 // Split the string to individual test stream data. 192 // Split the string to individual test stream data.
120 std::vector<base::FilePath::StringType> test_streams_data; 193 std::vector<base::FilePath::StringType> test_streams_data;
121 base::SplitString(data, ';', &test_streams_data); 194 base::SplitString(data, ';', &test_streams_data);
122 CHECK_GE(test_streams_data.size(), 1U) << data; 195 CHECK_GE(test_streams_data.size(), 1U) << data;
123 196
124 // Parse each test stream data and read the input file. 197 // Parse each test stream data and read the input file.
125 for (size_t index = 0; index < test_streams_data.size(); ++index) { 198 for (size_t index = 0; index < test_streams_data.size(); ++index) {
126 std::vector<base::FilePath::StringType> fields; 199 std::vector<base::FilePath::StringType> fields;
127 base::SplitString(test_streams_data[index], ':', &fields); 200 base::SplitString(test_streams_data[index], ':', &fields);
128 CHECK_GE(fields.size(), 4U) << data; 201 CHECK_GE(fields.size(), 4U) << data;
129 CHECK_LE(fields.size(), 9U) << data; 202 CHECK_LE(fields.size(), 9U) << data;
130 TestStream* test_stream = new TestStream(); 203 TestStream* test_stream = new TestStream();
131 204
132 base::FilePath::StringType filename = fields[0]; 205 test_stream->in_filename = fields[0];
133 int width, height; 206 int width, height;
134 CHECK(base::StringToInt(fields[1], &width)); 207 CHECK(base::StringToInt(fields[1], &width));
135 CHECK(base::StringToInt(fields[2], &height)); 208 CHECK(base::StringToInt(fields[2], &height));
136 test_stream->size = gfx::Size(width, height); 209 test_stream->size = gfx::Size(width, height);
137 CHECK(!test_stream->size.IsEmpty()); 210 CHECK(!test_stream->size.IsEmpty());
138 int profile; 211 int profile;
139 CHECK(base::StringToInt(fields[3], &profile)); 212 CHECK(base::StringToInt(fields[3], &profile));
140 CHECK_GT(profile, media::VIDEO_CODEC_PROFILE_UNKNOWN); 213 CHECK_GT(profile, media::VIDEO_CODEC_PROFILE_UNKNOWN);
141 CHECK_LE(profile, media::VIDEO_CODEC_PROFILE_MAX); 214 CHECK_LE(profile, media::VIDEO_CODEC_PROFILE_MAX);
142 test_stream->requested_profile = 215 test_stream->requested_profile =
(...skipping 11 matching lines...) Expand all
154 if (fields.size() >= 8 && !fields[7].empty()) { 227 if (fields.size() >= 8 && !fields[7].empty()) {
155 CHECK(base::StringToUint(fields[7], 228 CHECK(base::StringToUint(fields[7],
156 &test_stream->requested_subsequent_bitrate)); 229 &test_stream->requested_subsequent_bitrate));
157 } 230 }
158 231
159 if (fields.size() >= 9 && !fields[8].empty()) { 232 if (fields.size() >= 9 && !fields[8].empty()) {
160 CHECK(base::StringToUint(fields[8], 233 CHECK(base::StringToUint(fields[8],
161 &test_stream->requested_subsequent_framerate)); 234 &test_stream->requested_subsequent_framerate));
162 } 235 }
163 236
164 CHECK(test_stream->input_file.Initialize(base::FilePath(filename)));
165 test_streams->push_back(test_stream); 237 test_streams->push_back(test_stream);
166 } 238 }
167 } 239 }
168 240
169 // Set default parameters of |test_streams| and update the parameters according 241 // Set default parameters of |test_streams| and update the parameters according
170 // to |mid_stream_bitrate_switch| and |mid_stream_framerate_switch|. 242 // to |mid_stream_bitrate_switch| and |mid_stream_framerate_switch|.
171 static void UpdateTestStreamData(bool mid_stream_bitrate_switch, 243 static void UpdateTestStreamData(bool mid_stream_bitrate_switch,
172 bool mid_stream_framerate_switch, 244 bool mid_stream_framerate_switch,
173 ScopedVector<TestStream>* test_streams) { 245 ScopedVector<TestStream>* test_streams) {
174 for (size_t i = 0; i < test_streams->size(); i++) { 246 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()); 617 CHECK(validator_.get());
546 618
547 if (save_to_file_) { 619 if (save_to_file_) {
548 CHECK(!test_stream_.out_filename.empty()); 620 CHECK(!test_stream_.out_filename.empty());
549 base::FilePath out_filename(test_stream_.out_filename); 621 base::FilePath out_filename(test_stream_.out_filename);
550 // This creates or truncates out_filename. 622 // This creates or truncates out_filename.
551 // Without it, AppendToFile() will not work. 623 // Without it, AppendToFile() will not work.
552 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); 624 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0));
553 } 625 }
554 626
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(); 627 thread_checker_.DetachFromThread();
579 } 628 }
580 629
581 VEAClient::~VEAClient() { CHECK(!has_encoder()); } 630 VEAClient::~VEAClient() { CHECK(!has_encoder()); }
582 631
583 void VEAClient::CreateEncoder() { 632 void VEAClient::CreateEncoder() {
584 DCHECK(thread_checker_.CalledOnValidThread()); 633 DCHECK(thread_checker_.CalledOnValidThread());
585 CHECK(!has_encoder()); 634 CHECK(!has_encoder());
586 635
587 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 636 #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(); 671 return num_encoded_frames_ / duration.InSecondsF();
623 } 672 }
624 673
625 void VEAClient::RequireBitstreamBuffers(unsigned int input_count, 674 void VEAClient::RequireBitstreamBuffers(unsigned int input_count,
626 const gfx::Size& input_coded_size, 675 const gfx::Size& input_coded_size,
627 size_t output_size) { 676 size_t output_size) {
628 DCHECK(thread_checker_.CalledOnValidThread()); 677 DCHECK(thread_checker_.CalledOnValidThread());
629 ASSERT_EQ(state_, CS_INITIALIZED); 678 ASSERT_EQ(state_, CS_INITIALIZED);
630 SetState(CS_ENCODING); 679 SetState(CS_ENCODING);
631 680
632 // TODO(posciak): For now we only support input streams that meet encoder 681 PrepareAlignedTempFile(input_coded_size,
633 // size requirements exactly (i.e. coded size == visible size), so that we 682 const_cast<TestStream*>(&test_stream_),
634 // can simply mmap the stream file and feed the encoder directly with chunks 683 &input_buffer_size_);
635 // of that, instead of memcpying from mmapped file into a separate set of 684 CHECK_GT(input_buffer_size_, 0UL);
636 // input buffers that would meet the coded size and alignment requirements. 685
637 // If/when this is changed, the ARM-specific alignment check below should be 686 // Calculate the number of frames in the input stream by dividing its length
638 // redone as well. 687 // in bytes by frame size in bytes.
688 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0U)
689 << "Stream byte size is not a product of calculated frame byte size";
690 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_;
691 CHECK_GT(num_frames_in_stream_, 0UL);
692 CHECK_LE(num_frames_in_stream_, kMaxFrameNum);
693
694 // We may need to loop over the stream more than once if more frames than
695 // provided is required for bitrate tests.
696 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) {
697 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_
698 << " frames), will loop it to reach " << kMinFramesForBitrateTests
699 << " frames";
700 num_frames_to_encode_ = kMinFramesForBitrateTests;
701 } else {
702 num_frames_to_encode_ = num_frames_in_stream_;
703 }
704
639 input_coded_size_ = input_coded_size; 705 input_coded_size_ = input_coded_size;
640 ASSERT_EQ(input_coded_size_, test_stream_.size);
641 #if defined(ARCH_CPU_ARMEL) 706 #if defined(ARCH_CPU_ARMEL)
642 // ARM performs CPU cache management with CPU cache line granularity. We thus 707 // 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). 708 // 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 709 // Otherwise newer kernels will refuse to accept them, and on older kernels
645 // we'll be treating ourselves to random corruption. 710 // we'll be treating ourselves to random corruption.
646 // Since we are just mmapping and passing chunks of the input file, to ensure 711 // 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 712 // alignment, if the starting virtual addresses of YUV planes of the frames
648 // 64 byte-aligned, we'd have to use a separate set of input buffers and copy 713 // in it were not 64 byte-aligned, we'd have to use a separate set of input
649 // the frames into them before sending to the encoder. It would have been an 714 // buffers and copy the frames into them before sending to the encoder.
650 // overkill here though, because, for now at least, we only test resolutions 715 // Now we test resolutions differ from coded size and prepare chunks before
651 // that result in proper alignment, and it would have also interfered with 716 // testing to avoid performance impact.
652 // performance testing. So just assert that the frame size is a multiple of 717 // So just assert that the frame size is a multiple of 64 bytes.
653 // 64 bytes. This ensures all frames start at 64-byte boundary, because 718 // This ensures all frames start at 64-byte boundary, because
654 // MemoryMappedFile should be mmapp()ed at virtual page start as well. 719 // MemoryMappedFile should be mmapp()ed at virtual page start as well.
655 ASSERT_EQ(input_buffer_size_ & 63, 0u) 720 ASSERT_EQ(input_buffer_size_ & 63, 0u)
656 << "Frame size has to be a multiple of 64 bytes"; 721 << "Frame size has to be a multiple of 64 bytes";
657 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0) 722 ASSERT_EQ(reinterpret_cast<off_t>(test_stream_.input_file.data()) & 63, 0)
658 << "Mapped file should be mapped at a 64 byte boundary"; 723 << "Mapped file should be mapped at a 64 byte boundary";
659 #endif 724 #endif
660 725
661 num_required_input_buffers_ = input_count; 726 num_required_input_buffers_ = input_count;
662 ASSERT_GT(num_required_input_buffers_, 0UL); 727 ASSERT_GT(num_required_input_buffers_, 0UL);
663 728
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 void VEAClient::InputNoLongerNeededCallback(int32 input_id) { 801 void VEAClient::InputNoLongerNeededCallback(int32 input_id) {
737 std::set<int32>::iterator it = inputs_at_client_.find(input_id); 802 std::set<int32>::iterator it = inputs_at_client_.find(input_id);
738 ASSERT_NE(it, inputs_at_client_.end()); 803 ASSERT_NE(it, inputs_at_client_.end());
739 inputs_at_client_.erase(it); 804 inputs_at_client_.erase(it);
740 FeedEncoderWithInputs(); 805 FeedEncoderWithInputs();
741 } 806 }
742 807
743 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) { 808 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position) {
744 CHECK_LE(position + input_buffer_size_, test_stream_.input_file.length()); 809 CHECK_LE(position + input_buffer_size_, test_stream_.input_file.length());
745 810
746 uint8* frame_data = 811 uint8* frame_data_y =
747 const_cast<uint8*>(test_stream_.input_file.data() + position); 812 const_cast<uint8*>(test_stream_.input_file.data() + position);
813 uint8* frame_data_u = frame_data_y +
814 ALIGN_64_BYTES(media::VideoFrame::PlaneAllocationSize(
815 kInputFormat, 0, input_coded_size_));
816 uint8* frame_data_v = frame_data_u +
817 ALIGN_64_BYTES(media::VideoFrame::PlaneAllocationSize(
818 kInputFormat, 1, input_coded_size_));
748 819
749 CHECK_GT(current_framerate_, 0U); 820 CHECK_GT(current_framerate_, 0U);
750 scoped_refptr<media::VideoFrame> frame = 821 scoped_refptr<media::VideoFrame> frame =
751 media::VideoFrame::WrapExternalYuvData( 822 media::VideoFrame::WrapExternalYuvData(
752 kInputFormat, 823 kInputFormat,
753 input_coded_size_, 824 input_coded_size_,
754 gfx::Rect(test_stream_.size), 825 gfx::Rect(test_stream_.size),
755 test_stream_.size, 826 test_stream_.size,
756 input_coded_size_.width(), 827 input_coded_size_.width(),
757 input_coded_size_.width() / 2, 828 input_coded_size_.width() / 2,
758 input_coded_size_.width() / 2, 829 input_coded_size_.width() / 2,
759 frame_data, 830 frame_data_y,
760 frame_data + input_coded_size_.GetArea(), 831 frame_data_u,
761 frame_data + (input_coded_size_.GetArea() * 5 / 4), 832 frame_data_v,
762 base::TimeDelta().FromMilliseconds( 833 base::TimeDelta().FromMilliseconds(
763 next_input_id_ * base::Time::kMillisecondsPerSecond / 834 next_input_id_ * base::Time::kMillisecondsPerSecond /
764 current_framerate_), 835 current_framerate_),
765 media::BindToCurrentLoop( 836 media::BindToCurrentLoop(
766 base::Bind(&VEAClient::InputNoLongerNeededCallback, 837 base::Bind(&VEAClient::InputNoLongerNeededCallback,
767 base::Unretained(this), 838 base::Unretained(this),
768 next_input_id_))); 839 next_input_id_)));
769 840
770 CHECK(inputs_at_client_.insert(next_input_id_).second); 841 CHECK(inputs_at_client_.insert(next_input_id_).second);
771 ++next_input_id_; 842 ++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) 1037 for (size_t state_no = 0; state_no < arraysize(state_transitions); ++state_no)
967 for (size_t i = 0; i < num_concurrent_encoders; i++) 1038 for (size_t i = 0; i < num_concurrent_encoders; i++)
968 ASSERT_EQ(notes[i]->Wait(), state_transitions[state_no]); 1039 ASSERT_EQ(notes[i]->Wait(), state_transitions[state_no]);
969 1040
970 for (size_t i = 0; i < num_concurrent_encoders; ++i) { 1041 for (size_t i = 0; i < num_concurrent_encoders; ++i) {
971 encoder_thread.message_loop()->PostTask( 1042 encoder_thread.message_loop()->PostTask(
972 FROM_HERE, 1043 FROM_HERE,
973 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i]))); 1044 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i])));
974 } 1045 }
975 1046
1047 // Delete temporary files when test finished.
1048 for (size_t i = 0; i < test_streams.size(); i++)
1049 base::DeleteFile(test_streams[i]->temp_file, false);
1050
976 // This ensures all tasks have finished. 1051 // This ensures all tasks have finished.
977 encoder_thread.Stop(); 1052 encoder_thread.Stop();
978 } 1053 }
979 1054
980 INSTANTIATE_TEST_CASE_P( 1055 INSTANTIATE_TEST_CASE_P(
981 SimpleEncode, 1056 SimpleEncode,
982 VideoEncodeAcceleratorTest, 1057 VideoEncodeAcceleratorTest,
983 ::testing::Values(MakeTuple(1, true, 0, false, false, false, false))); 1058 ::testing::Values(MakeTuple(1, true, 0, false, false, false, false)));
984 1059
985 INSTANTIATE_TEST_CASE_P( 1060 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()); 1129 test_stream_data->assign(it->second.c_str());
1055 continue; 1130 continue;
1056 } 1131 }
1057 if (it->first == "v" || it->first == "vmodule") 1132 if (it->first == "v" || it->first == "vmodule")
1058 continue; 1133 continue;
1059 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 1134 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
1060 } 1135 }
1061 1136
1062 return RUN_ALL_TESTS(); 1137 return RUN_ALL_TESTS();
1063 } 1138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698