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

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

Issue 2044203003: VEA Test: revert timestamp test (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 unsigned int requested_framerate_; 952 unsigned int requested_framerate_;
953 953
954 // Bitrate to switch to in the middle of the stream. 954 // Bitrate to switch to in the middle of the stream.
955 unsigned int requested_subsequent_bitrate_; 955 unsigned int requested_subsequent_bitrate_;
956 956
957 // Framerate to switch to in the middle of the stream. 957 // Framerate to switch to in the middle of the stream.
958 unsigned int requested_subsequent_framerate_; 958 unsigned int requested_subsequent_framerate_;
959 959
960 // The timer used to feed the encoder with the input frames. 960 // The timer used to feed the encoder with the input frames.
961 std::unique_ptr<base::RepeatingTimer> input_timer_; 961 std::unique_ptr<base::RepeatingTimer> input_timer_;
962
963 // The timestamps for each frame in the order of CreateFrame() invocation.
964 std::queue<base::TimeDelta> frame_timestamps_;
965 }; 962 };
966 963
967 VEAClient::VEAClient(TestStream* test_stream, 964 VEAClient::VEAClient(TestStream* test_stream,
968 ClientStateNotification<ClientState>* note, 965 ClientStateNotification<ClientState>* note,
969 bool save_to_file, 966 bool save_to_file,
970 unsigned int keyframe_period, 967 unsigned int keyframe_period,
971 bool force_bitrate, 968 bool force_bitrate,
972 bool test_perf, 969 bool test_perf,
973 bool mid_stream_bitrate_switch, 970 bool mid_stream_bitrate_switch,
974 bool mid_stream_framerate_switch, 971 bool mid_stream_framerate_switch,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 ASSERT_LE(payload_size, output_buffer_size_); 1226 ASSERT_LE(payload_size, output_buffer_size_);
1230 1227
1231 IdToSHM::iterator it = output_buffers_at_client_.find(bitstream_buffer_id); 1228 IdToSHM::iterator it = output_buffers_at_client_.find(bitstream_buffer_id);
1232 ASSERT_NE(it, output_buffers_at_client_.end()); 1229 ASSERT_NE(it, output_buffers_at_client_.end());
1233 base::SharedMemory* shm = it->second; 1230 base::SharedMemory* shm = it->second;
1234 output_buffers_at_client_.erase(it); 1231 output_buffers_at_client_.erase(it);
1235 1232
1236 if (state_ == CS_FINISHED || state_ == CS_VALIDATED) 1233 if (state_ == CS_FINISHED || state_ == CS_VALIDATED)
1237 return; 1234 return;
1238 1235
1239 ASSERT_FALSE(frame_timestamps_.empty());
1240 ASSERT_EQ(timestamp, frame_timestamps_.front());
wuchengli 2016/06/15 08:59:21 Use EXPECT so the rest of this function can be run
1241 frame_timestamps_.pop();
wuchengli 2016/06/15 08:59:21 One input buffer can generate more than one output
1242
1243 encoded_stream_size_since_last_check_ += payload_size; 1236 encoded_stream_size_since_last_check_ += payload_size;
1244 1237
1245 const uint8_t* stream_ptr = static_cast<const uint8_t*>(shm->memory()); 1238 const uint8_t* stream_ptr = static_cast<const uint8_t*>(shm->memory());
1246 if (payload_size > 0) { 1239 if (payload_size > 0) {
1247 if (stream_validator_) { 1240 if (stream_validator_) {
1248 stream_validator_->ProcessStreamBuffer(stream_ptr, payload_size); 1241 stream_validator_->ProcessStreamBuffer(stream_ptr, payload_size);
1249 } else { 1242 } else {
1250 HandleEncodedFrame(key_frame); 1243 HandleEncodedFrame(key_frame);
1251 } 1244 }
1252 1245
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 CHECK_GT(current_framerate_, 0U); 1310 CHECK_GT(current_framerate_, 0U);
1318 1311
1319 scoped_refptr<media::VideoFrame> video_frame = 1312 scoped_refptr<media::VideoFrame> video_frame =
1320 media::VideoFrame::WrapExternalYuvData( 1313 media::VideoFrame::WrapExternalYuvData(
1321 kInputFormat, input_coded_size_, 1314 kInputFormat, input_coded_size_,
1322 gfx::Rect(test_stream_->visible_size), test_stream_->visible_size, 1315 gfx::Rect(test_stream_->visible_size), test_stream_->visible_size,
1323 input_coded_size_.width(), input_coded_size_.width() / 2, 1316 input_coded_size_.width(), input_coded_size_.width() / 2,
1324 input_coded_size_.width() / 2, frame_data_y, frame_data_u, 1317 input_coded_size_.width() / 2, frame_data_y, frame_data_u,
1325 frame_data_v, 1318 frame_data_v,
1326 base::TimeDelta().FromMilliseconds( 1319 base::TimeDelta().FromMilliseconds(
1327 next_input_id_ * base::Time::kMillisecondsPerSecond / 1320 next_input_id_ * base::Time::kMillisecondsPerSecond /
wuchengli 2016/06/15 08:59:21 Better to use (next_input_id_ + 1) so the timestam
1328 current_framerate_)); 1321 current_framerate_));
1329 EXPECT_NE(nullptr, video_frame.get()); 1322 EXPECT_NE(nullptr, video_frame.get());
1330 return video_frame; 1323 return video_frame;
1331 } 1324 }
1332 1325
1333 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame( 1326 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(
1334 off_t position, 1327 off_t position,
1335 int32_t* input_id) { 1328 int32_t* input_id) {
1336 CHECK_LE(position + test_stream_->aligned_buffer_size, 1329 CHECK_LE(position + test_stream_->aligned_buffer_size,
1337 test_stream_->aligned_in_file_data.size()); 1330 test_stream_->aligned_in_file_data.size());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 // we require for bitrate tests. 1365 // we require for bitrate tests.
1373 pos_in_input_stream_ = 0; 1366 pos_in_input_stream_ = 0;
1374 } 1367 }
1375 1368
1376 if (quality_validator_) 1369 if (quality_validator_)
1377 quality_validator_->AddOriginalFrame(CreateFrame(pos_in_input_stream_)); 1370 quality_validator_->AddOriginalFrame(CreateFrame(pos_in_input_stream_));
1378 1371
1379 int32_t input_id; 1372 int32_t input_id;
1380 scoped_refptr<media::VideoFrame> video_frame = 1373 scoped_refptr<media::VideoFrame> video_frame =
1381 PrepareInputFrame(pos_in_input_stream_, &input_id); 1374 PrepareInputFrame(pos_in_input_stream_, &input_id);
1382 frame_timestamps_.push(video_frame->timestamp());
1383 pos_in_input_stream_ += test_stream_->aligned_buffer_size; 1375 pos_in_input_stream_ += test_stream_->aligned_buffer_size;
1384 1376
1385 bool force_keyframe = false; 1377 bool force_keyframe = false;
1386 if (keyframe_period_ && input_id % keyframe_period_ == 0) { 1378 if (keyframe_period_ && input_id % keyframe_period_ == 0) {
1387 force_keyframe = true; 1379 force_keyframe = true;
1388 ++num_keyframes_requested_; 1380 ++num_keyframes_requested_;
1389 } 1381 }
1390 1382
1391 if (input_id == 0) { 1383 if (input_id == 0) {
1392 first_frame_start_time_ = base::TimeTicks::Now(); 1384 first_frame_start_time_ = base::TimeTicks::Now();
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 1788
1797 media::g_env = 1789 media::g_env =
1798 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( 1790 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>(
1799 testing::AddGlobalTestEnvironment( 1791 testing::AddGlobalTestEnvironment(
1800 new media::VideoEncodeAcceleratorTestEnvironment( 1792 new media::VideoEncodeAcceleratorTestEnvironment(
1801 std::move(test_stream_data), log_path, run_at_fps, 1793 std::move(test_stream_data), log_path, run_at_fps,
1802 needs_encode_latency, verify_all_output))); 1794 needs_encode_latency, verify_all_output)));
1803 1795
1804 return RUN_ALL_TESTS(); 1796 return RUN_ALL_TESTS();
1805 } 1797 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698