OLD | NEW |
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 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 // instantiated. | 1319 // instantiated. |
1320 // - If true, save output to file (provided an output filename was supplied). | 1320 // - If true, save output to file (provided an output filename was supplied). |
1321 // - Force a keyframe every n frames. | 1321 // - Force a keyframe every n frames. |
1322 // - Force bitrate; the actual required value is provided as a property | 1322 // - Force bitrate; the actual required value is provided as a property |
1323 // of the input stream, because it depends on stream type/resolution/etc. | 1323 // of the input stream, because it depends on stream type/resolution/etc. |
1324 // - If true, measure performance. | 1324 // - If true, measure performance. |
1325 // - If true, switch bitrate mid-stream. | 1325 // - If true, switch bitrate mid-stream. |
1326 // - If true, switch framerate mid-stream. | 1326 // - If true, switch framerate mid-stream. |
1327 class VideoEncodeAcceleratorTest | 1327 class VideoEncodeAcceleratorTest |
1328 : public ::testing::TestWithParam< | 1328 : public ::testing::TestWithParam< |
1329 Tuple<int, bool, int, bool, bool, bool, bool>> {}; | 1329 base::Tuple<int, bool, int, bool, bool, bool, bool>> {}; |
1330 | 1330 |
1331 TEST_P(VideoEncodeAcceleratorTest, TestSimpleEncode) { | 1331 TEST_P(VideoEncodeAcceleratorTest, TestSimpleEncode) { |
1332 size_t num_concurrent_encoders = get<0>(GetParam()); | 1332 size_t num_concurrent_encoders = base::get<0>(GetParam()); |
1333 const bool save_to_file = get<1>(GetParam()); | 1333 const bool save_to_file = base::get<1>(GetParam()); |
1334 const unsigned int keyframe_period = get<2>(GetParam()); | 1334 const unsigned int keyframe_period = base::get<2>(GetParam()); |
1335 const bool force_bitrate = get<3>(GetParam()); | 1335 const bool force_bitrate = base::get<3>(GetParam()); |
1336 const bool test_perf = get<4>(GetParam()); | 1336 const bool test_perf = base::get<4>(GetParam()); |
1337 const bool mid_stream_bitrate_switch = get<5>(GetParam()); | 1337 const bool mid_stream_bitrate_switch = base::get<5>(GetParam()); |
1338 const bool mid_stream_framerate_switch = get<6>(GetParam()); | 1338 const bool mid_stream_framerate_switch = base::get<6>(GetParam()); |
1339 | 1339 |
1340 ScopedVector<ClientStateNotification<ClientState> > notes; | 1340 ScopedVector<ClientStateNotification<ClientState> > notes; |
1341 ScopedVector<VEAClient> clients; | 1341 ScopedVector<VEAClient> clients; |
1342 base::Thread encoder_thread("EncoderThread"); | 1342 base::Thread encoder_thread("EncoderThread"); |
1343 ASSERT_TRUE(encoder_thread.Start()); | 1343 ASSERT_TRUE(encoder_thread.Start()); |
1344 | 1344 |
1345 if (g_env->test_streams_.size() > 1) | 1345 if (g_env->test_streams_.size() > 1) |
1346 num_concurrent_encoders = g_env->test_streams_.size(); | 1346 num_concurrent_encoders = g_env->test_streams_.size(); |
1347 | 1347 |
1348 // Create all encoders. | 1348 // Create all encoders. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i]))); | 1386 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i]))); |
1387 } | 1387 } |
1388 | 1388 |
1389 // This ensures all tasks have finished. | 1389 // This ensures all tasks have finished. |
1390 encoder_thread.Stop(); | 1390 encoder_thread.Stop(); |
1391 } | 1391 } |
1392 | 1392 |
1393 INSTANTIATE_TEST_CASE_P( | 1393 INSTANTIATE_TEST_CASE_P( |
1394 SimpleEncode, | 1394 SimpleEncode, |
1395 VideoEncodeAcceleratorTest, | 1395 VideoEncodeAcceleratorTest, |
1396 ::testing::Values(MakeTuple(1, true, 0, false, false, false, false))); | 1396 ::testing::Values(base::MakeTuple(1, true, 0, false, false, false, false))); |
1397 | 1397 |
1398 INSTANTIATE_TEST_CASE_P( | 1398 INSTANTIATE_TEST_CASE_P( |
1399 EncoderPerf, | 1399 EncoderPerf, |
1400 VideoEncodeAcceleratorTest, | 1400 VideoEncodeAcceleratorTest, |
1401 ::testing::Values(MakeTuple(1, false, 0, false, true, false, false))); | 1401 ::testing::Values(base::MakeTuple(1, false, 0, false, true, false, false))); |
1402 | 1402 |
1403 INSTANTIATE_TEST_CASE_P( | 1403 INSTANTIATE_TEST_CASE_P( |
1404 ForceKeyframes, | 1404 ForceKeyframes, |
1405 VideoEncodeAcceleratorTest, | 1405 VideoEncodeAcceleratorTest, |
1406 ::testing::Values(MakeTuple(1, false, 10, false, false, false, false))); | 1406 ::testing::Values(base::MakeTuple(1, false, 10, false, false, false, |
| 1407 false))); |
1407 | 1408 |
1408 INSTANTIATE_TEST_CASE_P( | 1409 INSTANTIATE_TEST_CASE_P( |
1409 ForceBitrate, | 1410 ForceBitrate, |
1410 VideoEncodeAcceleratorTest, | 1411 VideoEncodeAcceleratorTest, |
1411 ::testing::Values(MakeTuple(1, false, 0, true, false, false, false))); | 1412 ::testing::Values(base::MakeTuple(1, false, 0, true, false, false, false))); |
1412 | 1413 |
1413 INSTANTIATE_TEST_CASE_P( | 1414 INSTANTIATE_TEST_CASE_P( |
1414 MidStreamParamSwitchBitrate, | 1415 MidStreamParamSwitchBitrate, |
1415 VideoEncodeAcceleratorTest, | 1416 VideoEncodeAcceleratorTest, |
1416 ::testing::Values(MakeTuple(1, false, 0, true, false, true, false))); | 1417 ::testing::Values(base::MakeTuple(1, false, 0, true, false, true, false))); |
1417 | 1418 |
1418 INSTANTIATE_TEST_CASE_P( | 1419 INSTANTIATE_TEST_CASE_P( |
1419 MidStreamParamSwitchFPS, | 1420 MidStreamParamSwitchFPS, |
1420 VideoEncodeAcceleratorTest, | 1421 VideoEncodeAcceleratorTest, |
1421 ::testing::Values(MakeTuple(1, false, 0, true, false, false, true))); | 1422 ::testing::Values(base::MakeTuple(1, false, 0, true, false, false, true))); |
1422 | 1423 |
1423 INSTANTIATE_TEST_CASE_P( | 1424 INSTANTIATE_TEST_CASE_P( |
1424 MultipleEncoders, | 1425 MultipleEncoders, |
1425 VideoEncodeAcceleratorTest, | 1426 VideoEncodeAcceleratorTest, |
1426 ::testing::Values(MakeTuple(3, false, 0, false, false, false, false), | 1427 ::testing::Values(base::MakeTuple(3, false, 0, false, false, false, false), |
1427 MakeTuple(3, false, 0, true, false, false, true), | 1428 base::MakeTuple(3, false, 0, true, false, false, true), |
1428 MakeTuple(3, false, 0, true, false, true, false))); | 1429 base::MakeTuple(3, false, 0, true, false, true, false))); |
1429 | 1430 |
1430 // TODO(posciak): more tests: | 1431 // TODO(posciak): more tests: |
1431 // - async FeedEncoderWithOutput | 1432 // - async FeedEncoderWithOutput |
1432 // - out-of-order return of outputs to encoder | 1433 // - out-of-order return of outputs to encoder |
1433 // - multiple encoders + decoders | 1434 // - multiple encoders + decoders |
1434 // - mid-stream encoder_->Destroy() | 1435 // - mid-stream encoder_->Destroy() |
1435 | 1436 |
1436 } // namespace | 1437 } // namespace |
1437 } // namespace content | 1438 } // namespace content |
1438 | 1439 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 | 1512 |
1512 content::g_env = | 1513 content::g_env = |
1513 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1514 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
1514 testing::AddGlobalTestEnvironment( | 1515 testing::AddGlobalTestEnvironment( |
1515 new content::VideoEncodeAcceleratorTestEnvironment( | 1516 new content::VideoEncodeAcceleratorTestEnvironment( |
1516 test_stream_data.Pass(), log_path, run_at_fps, | 1517 test_stream_data.Pass(), log_path, run_at_fps, |
1517 needs_encode_latency))); | 1518 needs_encode_latency))); |
1518 | 1519 |
1519 return RUN_ALL_TESTS(); | 1520 return RUN_ALL_TESTS(); |
1520 } | 1521 } |
OLD | NEW |