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

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

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LOG in video_Frame and CHECK/return outside. Created 5 years 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 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 FeedEncoderWithOneInput(); 1309 FeedEncoderWithOneInput();
1310 } 1310 }
1311 1311
1312 scoped_refptr<media::VideoFrame> VEAClient::CreateFrame(off_t position) { 1312 scoped_refptr<media::VideoFrame> VEAClient::CreateFrame(off_t position) {
1313 uint8* frame_data_y = const_cast<uint8*>( 1313 uint8* frame_data_y = const_cast<uint8*>(
1314 test_stream_->mapped_aligned_in_file.data() + position); 1314 test_stream_->mapped_aligned_in_file.data() + position);
1315 uint8* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0]; 1315 uint8* frame_data_u = frame_data_y + test_stream_->aligned_plane_size[0];
1316 uint8* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1]; 1316 uint8* frame_data_v = frame_data_u + test_stream_->aligned_plane_size[1];
1317 CHECK_GT(current_framerate_, 0U); 1317 CHECK_GT(current_framerate_, 0U);
1318 1318
1319 return media::VideoFrame::WrapExternalYuvData( 1319 scoped_refptr<media::VideoFrame> video_frame =
1320 kInputFormat, input_coded_size_, gfx::Rect(test_stream_->visible_size), 1320 media::VideoFrame::WrapExternalYuvData(
1321 test_stream_->visible_size, input_coded_size_.width(), 1321 kInputFormat, input_coded_size_,
1322 input_coded_size_.width() / 2, input_coded_size_.width() / 2, 1322 gfx::Rect(test_stream_->visible_size), test_stream_->visible_size,
1323 frame_data_y, frame_data_u, frame_data_v, 1323 input_coded_size_.width(), input_coded_size_.width() / 2,
1324 base::TimeDelta().FromMilliseconds(next_input_id_ * 1324 input_coded_size_.width() / 2, frame_data_y, frame_data_u,
1325 base::Time::kMillisecondsPerSecond / 1325 frame_data_v,
1326 current_framerate_)); 1326 base::TimeDelta().FromMilliseconds(
1327 next_input_id_ * base::Time::kMillisecondsPerSecond /
1328 current_framerate_));
1329 CHECK(video_frame);
1330 return video_frame;
1327 } 1331 }
1328 1332
1329 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position, 1333 scoped_refptr<media::VideoFrame> VEAClient::PrepareInputFrame(off_t position,
1330 int32* input_id) { 1334 int32* input_id) {
1331 CHECK_LE(position + test_stream_->aligned_buffer_size, 1335 CHECK_LE(position + test_stream_->aligned_buffer_size,
1332 test_stream_->mapped_aligned_in_file.length()); 1336 test_stream_->mapped_aligned_in_file.length());
1333 1337
1334 scoped_refptr<media::VideoFrame> frame = CreateFrame(position); 1338 scoped_refptr<media::VideoFrame> frame = CreateFrame(position);
1339 CHECK(frame);
1335 frame->AddDestructionObserver( 1340 frame->AddDestructionObserver(
1336 media::BindToCurrentLoop( 1341 media::BindToCurrentLoop(
1337 base::Bind(&VEAClient::InputNoLongerNeededCallback, 1342 base::Bind(&VEAClient::InputNoLongerNeededCallback,
1338 base::Unretained(this), 1343 base::Unretained(this),
1339 next_input_id_))); 1344 next_input_id_)));
1340 1345
1341 LOG_ASSERT(inputs_at_client_.insert(next_input_id_).second); 1346 LOG_ASSERT(inputs_at_client_.insert(next_input_id_).second);
1342 1347
1343 *input_id = next_input_id_++; 1348 *input_id = next_input_id_++;
1344 return frame; 1349 return frame;
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 1777
1773 content::g_env = 1778 content::g_env =
1774 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( 1779 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>(
1775 testing::AddGlobalTestEnvironment( 1780 testing::AddGlobalTestEnvironment(
1776 new content::VideoEncodeAcceleratorTestEnvironment( 1781 new content::VideoEncodeAcceleratorTestEnvironment(
1777 test_stream_data.Pass(), log_path, run_at_fps, 1782 test_stream_data.Pass(), log_path, run_at_fps,
1778 needs_encode_latency, verify_all_output))); 1783 needs_encode_latency, verify_all_output)));
1779 1784
1780 return RUN_ALL_TESTS(); 1785 return RUN_ALL_TESTS();
1781 } 1786 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698