Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Regression tests for FFmpeg. Test files can be found in the internal media | 5 // Regression tests for FFmpeg. Test files can be found in the internal media |
| 6 // test data directory: | 6 // test data directory: |
| 7 // | 7 // |
| 8 // https://chrome-internal.googlesource.com/chrome/data/media | 8 // https://chrome-internal.googlesource.com/chrome/data/media |
| 9 // | 9 // |
| 10 // Simply add the custom_dep below to your gclient and sync: | 10 // Simply add the custom_dep below to your gclient and sync: |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #include "base/bind.h" | 24 #include "base/bind.h" |
| 25 #include "media/test/pipeline_integration_test_base.h" | 25 #include "media/test/pipeline_integration_test_base.h" |
| 26 | 26 |
| 27 namespace media { | 27 namespace media { |
| 28 | 28 |
| 29 const char kRegressionTestDataPathPrefix[] = "internal/"; | 29 const char kRegressionTestDataPathPrefix[] = "internal/"; |
| 30 | 30 |
| 31 struct RegressionTestData { | 31 struct RegressionTestData { |
| 32 RegressionTestData(const char* filename, | 32 RegressionTestData(const char* filename, |
| 33 PipelineStatus init_status, | 33 PipelineStatus init_status, |
| 34 PipelineStatus end_status) | 34 PipelineStatus end_status, |
| 35 base::TimeDelta seek_time) | |
| 35 : filename(std::string(kRegressionTestDataPathPrefix) + filename), | 36 : filename(std::string(kRegressionTestDataPathPrefix) + filename), |
| 36 init_status(init_status), | 37 init_status(init_status), |
| 37 end_status(end_status) {} | 38 end_status(end_status), |
| 39 seek_time(seek_time) {} | |
| 38 | 40 |
| 39 std::string filename; | 41 std::string filename; |
| 40 PipelineStatus init_status; | 42 PipelineStatus init_status; |
| 41 PipelineStatus end_status; | 43 PipelineStatus end_status; |
| 44 base::TimeDelta seek_time; | |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 // Used for tests which just need to run without crashing or tooling errors, but | 47 // Used for tests which just need to run without crashing or tooling errors, but |
| 45 // which may have undefined PipelineStatus results. | 48 // which may have undefined PipelineStatus results. |
| 46 struct FlakyRegressionTestData { | 49 struct FlakyRegressionTestData { |
| 47 FlakyRegressionTestData(const char* filename) | 50 FlakyRegressionTestData(const char* filename) |
| 48 : filename(std::string(kRegressionTestDataPathPrefix) + filename) { | 51 : filename(std::string(kRegressionTestDataPathPrefix) + filename) { |
| 49 } | 52 } |
| 50 | 53 |
| 51 std::string filename; | 54 std::string filename; |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 class FFmpegRegressionTest | 57 class FFmpegRegressionTest |
| 55 : public testing::TestWithParam<RegressionTestData>, | 58 : public testing::TestWithParam<RegressionTestData>, |
| 56 public PipelineIntegrationTestBase { | 59 public PipelineIntegrationTestBase { |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 class FlakyFFmpegRegressionTest | 62 class FlakyFFmpegRegressionTest |
| 60 : public testing::TestWithParam<FlakyRegressionTestData>, | 63 : public testing::TestWithParam<FlakyRegressionTestData>, |
| 61 public PipelineIntegrationTestBase { | 64 public PipelineIntegrationTestBase { |
| 62 }; | 65 }; |
| 63 | 66 |
| 67 #define FFMPEG_TEST_CASE_SEEKING(name, fn, init_status, end_status, seek_time) \ | |
| 68 INSTANTIATE_TEST_CASE_P(name, FFmpegRegressionTest, \ | |
| 69 testing::Values(RegressionTestData( \ | |
| 70 fn, init_status, end_status, seek_time))); | |
| 71 | |
| 64 #define FFMPEG_TEST_CASE(name, fn, init_status, end_status) \ | 72 #define FFMPEG_TEST_CASE(name, fn, init_status, end_status) \ |
| 65 INSTANTIATE_TEST_CASE_P( \ | 73 FFMPEG_TEST_CASE_SEEKING(name, fn, init_status, end_status, base::TimeDelta()) |
|
chcunningham
2016/12/08 18:34:24
I'm wondering about the base::TimeDelta() default.
wolenetz
2016/12/08 19:12:52
Good catch! I'll change to default of kNoTimeStamp
wolenetz
2016/12/08 19:36:49
Done.
| |
| 66 name, FFmpegRegressionTest, \ | |
| 67 testing::Values(RegressionTestData(fn, init_status, end_status))); | |
| 68 | 74 |
| 69 #define FLAKY_FFMPEG_TEST_CASE(name, fn) \ | 75 #define FLAKY_FFMPEG_TEST_CASE(name, fn) \ |
| 70 INSTANTIATE_TEST_CASE_P(FLAKY_##name, FlakyFFmpegRegressionTest, \ | 76 INSTANTIATE_TEST_CASE_P(FLAKY_##name, FlakyFFmpegRegressionTest, \ |
| 71 testing::Values(FlakyRegressionTestData(fn))); | 77 testing::Values(FlakyRegressionTestData(fn))); |
| 72 | 78 |
| 73 // Test cases from issues. | 79 // Test cases from issues. |
| 74 FFMPEG_TEST_CASE(Cr47325, "security/47325.mp4", PIPELINE_OK, PIPELINE_OK); | 80 FFMPEG_TEST_CASE(Cr47325, "security/47325.mp4", PIPELINE_OK, PIPELINE_OK); |
| 75 FFMPEG_TEST_CASE(Cr47761, "crbug47761.ogg", PIPELINE_OK, PIPELINE_OK); | 81 FFMPEG_TEST_CASE(Cr47761, "crbug47761.ogg", PIPELINE_OK, PIPELINE_OK); |
| 76 FFMPEG_TEST_CASE(Cr50045, "crbug50045.mp4", PIPELINE_OK, PIPELINE_OK); | 82 FFMPEG_TEST_CASE(Cr50045, "crbug50045.mp4", PIPELINE_OK, PIPELINE_OK); |
| 77 FFMPEG_TEST_CASE(Cr62127, "crbug62127.webm", PIPELINE_OK, PIPELINE_OK); | 83 FFMPEG_TEST_CASE(Cr62127, "crbug62127.webm", PIPELINE_OK, PIPELINE_OK); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 PIPELINE_OK, | 170 PIPELINE_OK, |
| 165 PIPELINE_ERROR_DECODE); | 171 PIPELINE_ERROR_DECODE); |
| 166 // TODO(liberato): before crbug.com/658440 was fixed, this would fail if run | 172 // TODO(liberato): before crbug.com/658440 was fixed, this would fail if run |
| 167 // twice under ASAN. If run once, then it doesn't. However, it still catches | 173 // twice under ASAN. If run once, then it doesn't. However, it still catches |
| 168 // issues in crbug.com/662118, so it's included anyway. | 174 // issues in crbug.com/662118, so it's included anyway. |
| 169 FFMPEG_TEST_CASE(Cr658440, "security/658440.flac", PIPELINE_OK, PIPELINE_OK); | 175 FFMPEG_TEST_CASE(Cr658440, "security/658440.flac", PIPELINE_OK, PIPELINE_OK); |
| 170 FFMPEG_TEST_CASE(Cr665305, | 176 FFMPEG_TEST_CASE(Cr665305, |
| 171 "crbug665305.flac", | 177 "crbug665305.flac", |
| 172 PIPELINE_OK, | 178 PIPELINE_OK, |
| 173 PIPELINE_ERROR_DECODE); | 179 PIPELINE_ERROR_DECODE); |
| 180 FFMPEG_TEST_CASE_SEEKING(Cr666770, | |
| 181 "security/666770.mp4", | |
| 182 PIPELINE_OK, | |
| 183 PIPELINE_OK, | |
| 184 base::TimeDelta::FromSecondsD(0.0843)); | |
| 185 FFMPEG_TEST_CASE(Cr666874, | |
| 186 "security/666874.mp3", | |
| 187 DEMUXER_ERROR_COULD_NOT_OPEN, | |
| 188 DEMUXER_ERROR_COULD_NOT_OPEN); | |
| 189 FFMPEG_TEST_CASE(Cr667063, "security/667063.mp4", PIPELINE_OK, PIPELINE_OK); | |
| 174 | 190 |
| 175 // General MP4 test cases. | 191 // General MP4 test cases. |
| 176 FFMPEG_TEST_CASE(MP4_0, | 192 FFMPEG_TEST_CASE(MP4_0, |
| 177 "security/aac.10419.mp4", | 193 "security/aac.10419.mp4", |
| 178 DEMUXER_ERROR_COULD_NOT_OPEN, | 194 DEMUXER_ERROR_COULD_NOT_OPEN, |
| 179 DEMUXER_ERROR_COULD_NOT_OPEN); | 195 DEMUXER_ERROR_COULD_NOT_OPEN); |
| 180 FFMPEG_TEST_CASE(MP4_1, | 196 FFMPEG_TEST_CASE(MP4_1, |
| 181 "security/clockh264aac_200021889.mp4", | 197 "security/clockh264aac_200021889.mp4", |
| 182 DEMUXER_ERROR_COULD_NOT_OPEN, | 198 DEMUXER_ERROR_COULD_NOT_OPEN, |
| 183 DEMUXER_ERROR_COULD_NOT_OPEN); | 199 DEMUXER_ERROR_COULD_NOT_OPEN); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 FLAKY_FFMPEG_TEST_CASE(OGV_0, "security/big_dims.ogv"); | 355 FLAKY_FFMPEG_TEST_CASE(OGV_0, "security/big_dims.ogv"); |
| 340 FLAKY_FFMPEG_TEST_CASE(OGV_3, "security/smclock_1_0.ogv"); | 356 FLAKY_FFMPEG_TEST_CASE(OGV_3, "security/smclock_1_0.ogv"); |
| 341 FLAKY_FFMPEG_TEST_CASE(OGV_4, "security/smclock.ogv.1.0.ogv"); | 357 FLAKY_FFMPEG_TEST_CASE(OGV_4, "security/smclock.ogv.1.0.ogv"); |
| 342 FLAKY_FFMPEG_TEST_CASE(OGV_6, "security/smclocktheora_1_10000.ogv"); | 358 FLAKY_FFMPEG_TEST_CASE(OGV_6, "security/smclocktheora_1_10000.ogv"); |
| 343 FLAKY_FFMPEG_TEST_CASE(OGV_13, "security/smclocktheora_1_790.ogv"); | 359 FLAKY_FFMPEG_TEST_CASE(OGV_13, "security/smclocktheora_1_790.ogv"); |
| 344 FLAKY_FFMPEG_TEST_CASE(MP4_3, "security/clockh264aac_300413969.mp4"); | 360 FLAKY_FFMPEG_TEST_CASE(MP4_3, "security/clockh264aac_300413969.mp4"); |
| 345 FLAKY_FFMPEG_TEST_CASE(MP4_4, "security/clockh264aac_301350139.mp4"); | 361 FLAKY_FFMPEG_TEST_CASE(MP4_4, "security/clockh264aac_301350139.mp4"); |
| 346 FLAKY_FFMPEG_TEST_CASE(MP4_12, "security/assert1.mov"); | 362 FLAKY_FFMPEG_TEST_CASE(MP4_12, "security/assert1.mov"); |
| 347 FLAKY_FFMPEG_TEST_CASE(WEBM_3, "security/out.webm.139771.2965"); | 363 FLAKY_FFMPEG_TEST_CASE(WEBM_3, "security/out.webm.139771.2965"); |
| 348 | 364 |
| 365 // Init status flakes between PIPELINE_OK and PIPELINE_ERROR_DECODE, and gives | |
| 366 // PIPELINE_ERROR_DECODE later if initialization was PIPELINE_OK. | |
| 367 FLAKY_FFMPEG_TEST_CASE(Cr666794, "security/666794.webm"); | |
| 368 | |
| 349 // Not really flaky, but can't pass the seek test. | 369 // Not really flaky, but can't pass the seek test. |
| 350 FLAKY_FFMPEG_TEST_CASE(MP4_10, "security/null1.m4a"); | 370 FLAKY_FFMPEG_TEST_CASE(MP4_10, "security/null1.m4a"); |
| 351 FLAKY_FFMPEG_TEST_CASE(Cr112670, "security/112670.mp4"); | 371 FLAKY_FFMPEG_TEST_CASE(Cr112670, "security/112670.mp4"); |
| 352 | 372 |
| 353 // Uses ASSERTs to prevent sharded tests from hanging on failure. | 373 // Uses ASSERTs to prevent sharded tests from hanging on failure. |
| 354 TEST_P(FFmpegRegressionTest, BasicPlayback) { | 374 TEST_P(FFmpegRegressionTest, BasicPlayback) { |
| 355 if (GetParam().init_status == PIPELINE_OK) { | 375 if (GetParam().init_status == PIPELINE_OK) { |
| 356 ASSERT_EQ(PIPELINE_OK, Start(GetParam().filename, kClockless)); | 376 ASSERT_EQ(PIPELINE_OK, Start(GetParam().filename, kClockless)); |
| 357 Play(); | 377 Play(); |
| 358 ASSERT_EQ(GetParam().end_status, WaitUntilEndedOrError()); | 378 ASSERT_EQ(GetParam().end_status, WaitUntilEndedOrError()); |
| 359 | 379 |
| 360 // Check for ended if the pipeline is expected to finish okay. | 380 // Check for ended if the pipeline is expected to finish okay. |
| 361 if (GetParam().end_status == PIPELINE_OK) { | 381 if (GetParam().end_status == PIPELINE_OK) { |
| 362 ASSERT_TRUE(ended_); | 382 ASSERT_TRUE(ended_); |
| 363 | 383 |
| 364 // Tack a seek on the end to catch any seeking issues. | 384 // Tack a seek on the end to catch any seeking issues. |
| 365 Seek(GetStartTime()); | 385 Seek(GetParam().seek_time); |
|
DaleCurtis
2016/12/08 19:07:47
Doesn't this change all the existing tests? Seems
wolenetz
2016/12/08 19:12:52
Good catch ditto of chcunningham@'s catch. Thank y
wolenetz
2016/12/08 19:36:49
Done.
| |
| 366 } | 386 } |
| 367 } else { | 387 } else { |
| 368 // Don't bother checking the exact status as we only care that the | 388 // Don't bother checking the exact status as we only care that the |
| 369 // pipeline failed to start. | 389 // pipeline failed to start. |
| 370 EXPECT_NE(PIPELINE_OK, Start(GetParam().filename)); | 390 EXPECT_NE(PIPELINE_OK, Start(GetParam().filename)); |
| 371 } | 391 } |
| 372 } | 392 } |
| 373 | 393 |
| 374 TEST_P(FlakyFFmpegRegressionTest, BasicPlayback) { | 394 TEST_P(FlakyFFmpegRegressionTest, BasicPlayback) { |
| 375 if (Start(GetParam().filename, kClockless) == PIPELINE_OK) { | 395 if (Start(GetParam().filename, kClockless) == PIPELINE_OK) { |
| 376 Play(); | 396 Play(); |
| 377 WaitUntilEndedOrError(); | 397 WaitUntilEndedOrError(); |
| 378 } | 398 } |
| 379 } | 399 } |
| 380 | 400 |
| 381 } // namespace media | 401 } // namespace media |
| OLD | NEW |