| 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 |
| 45 // |seek_time| is the time to seek to at the end of the test if the pipeline |
| 46 // successfully reaches that point in the test. If kNoTimestamp, the actual |
| 47 // seek time will be GetStartTime(). |
| 48 base::TimeDelta seek_time; |
| 42 }; | 49 }; |
| 43 | 50 |
| 44 // Used for tests which just need to run without crashing or tooling errors, but | 51 // Used for tests which just need to run without crashing or tooling errors, but |
| 45 // which may have undefined PipelineStatus results. | 52 // which may have undefined PipelineStatus results. |
| 46 struct FlakyRegressionTestData { | 53 struct FlakyRegressionTestData { |
| 47 FlakyRegressionTestData(const char* filename) | 54 FlakyRegressionTestData(const char* filename) |
| 48 : filename(std::string(kRegressionTestDataPathPrefix) + filename) { | 55 : filename(std::string(kRegressionTestDataPathPrefix) + filename) { |
| 49 } | 56 } |
| 50 | 57 |
| 51 std::string filename; | 58 std::string filename; |
| 52 }; | 59 }; |
| 53 | 60 |
| 54 class FFmpegRegressionTest | 61 class FFmpegRegressionTest |
| 55 : public testing::TestWithParam<RegressionTestData>, | 62 : public testing::TestWithParam<RegressionTestData>, |
| 56 public PipelineIntegrationTestBase { | 63 public PipelineIntegrationTestBase { |
| 57 }; | 64 }; |
| 58 | 65 |
| 59 class FlakyFFmpegRegressionTest | 66 class FlakyFFmpegRegressionTest |
| 60 : public testing::TestWithParam<FlakyRegressionTestData>, | 67 : public testing::TestWithParam<FlakyRegressionTestData>, |
| 61 public PipelineIntegrationTestBase { | 68 public PipelineIntegrationTestBase { |
| 62 }; | 69 }; |
| 63 | 70 |
| 71 #define FFMPEG_TEST_CASE_SEEKING(name, fn, init_status, end_status, seek_time) \ |
| 72 INSTANTIATE_TEST_CASE_P(name, FFmpegRegressionTest, \ |
| 73 testing::Values(RegressionTestData( \ |
| 74 fn, init_status, end_status, seek_time))); |
| 75 |
| 64 #define FFMPEG_TEST_CASE(name, fn, init_status, end_status) \ | 76 #define FFMPEG_TEST_CASE(name, fn, init_status, end_status) \ |
| 65 INSTANTIATE_TEST_CASE_P( \ | 77 FFMPEG_TEST_CASE_SEEKING(name, fn, init_status, end_status, kNoTimestamp) |
| 66 name, FFmpegRegressionTest, \ | |
| 67 testing::Values(RegressionTestData(fn, init_status, end_status))); | |
| 68 | 78 |
| 69 #define FLAKY_FFMPEG_TEST_CASE(name, fn) \ | 79 #define FLAKY_FFMPEG_TEST_CASE(name, fn) \ |
| 70 INSTANTIATE_TEST_CASE_P(FLAKY_##name, FlakyFFmpegRegressionTest, \ | 80 INSTANTIATE_TEST_CASE_P(FLAKY_##name, FlakyFFmpegRegressionTest, \ |
| 71 testing::Values(FlakyRegressionTestData(fn))); | 81 testing::Values(FlakyRegressionTestData(fn))); |
| 72 | 82 |
| 73 // Test cases from issues. | 83 // Test cases from issues. |
| 74 FFMPEG_TEST_CASE(Cr47325, "security/47325.mp4", PIPELINE_OK, PIPELINE_OK); | 84 FFMPEG_TEST_CASE(Cr47325, "security/47325.mp4", PIPELINE_OK, PIPELINE_OK); |
| 75 FFMPEG_TEST_CASE(Cr47761, "crbug47761.ogg", PIPELINE_OK, PIPELINE_OK); | 85 FFMPEG_TEST_CASE(Cr47761, "crbug47761.ogg", PIPELINE_OK, PIPELINE_OK); |
| 76 FFMPEG_TEST_CASE(Cr50045, "crbug50045.mp4", PIPELINE_OK, PIPELINE_OK); | 86 FFMPEG_TEST_CASE(Cr50045, "crbug50045.mp4", PIPELINE_OK, PIPELINE_OK); |
| 77 FFMPEG_TEST_CASE(Cr62127, "crbug62127.webm", PIPELINE_OK, PIPELINE_OK); | 87 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, | 174 PIPELINE_OK, |
| 165 PIPELINE_ERROR_DECODE); | 175 PIPELINE_ERROR_DECODE); |
| 166 // TODO(liberato): before crbug.com/658440 was fixed, this would fail if run | 176 // 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 | 177 // 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. | 178 // issues in crbug.com/662118, so it's included anyway. |
| 169 FFMPEG_TEST_CASE(Cr658440, "security/658440.flac", PIPELINE_OK, PIPELINE_OK); | 179 FFMPEG_TEST_CASE(Cr658440, "security/658440.flac", PIPELINE_OK, PIPELINE_OK); |
| 170 FFMPEG_TEST_CASE(Cr665305, | 180 FFMPEG_TEST_CASE(Cr665305, |
| 171 "crbug665305.flac", | 181 "crbug665305.flac", |
| 172 PIPELINE_OK, | 182 PIPELINE_OK, |
| 173 PIPELINE_ERROR_DECODE); | 183 PIPELINE_ERROR_DECODE); |
| 184 FFMPEG_TEST_CASE_SEEKING(Cr666770, |
| 185 "security/666770.mp4", |
| 186 PIPELINE_OK, |
| 187 PIPELINE_OK, |
| 188 base::TimeDelta::FromSecondsD(0.0843)); |
| 189 FFMPEG_TEST_CASE(Cr666874, |
| 190 "security/666874.mp3", |
| 191 DEMUXER_ERROR_COULD_NOT_OPEN, |
| 192 DEMUXER_ERROR_COULD_NOT_OPEN); |
| 193 FFMPEG_TEST_CASE(Cr667063, "security/667063.mp4", PIPELINE_OK, PIPELINE_OK); |
| 174 | 194 |
| 175 // General MP4 test cases. | 195 // General MP4 test cases. |
| 176 FFMPEG_TEST_CASE(MP4_0, | 196 FFMPEG_TEST_CASE(MP4_0, |
| 177 "security/aac.10419.mp4", | 197 "security/aac.10419.mp4", |
| 178 DEMUXER_ERROR_COULD_NOT_OPEN, | 198 DEMUXER_ERROR_COULD_NOT_OPEN, |
| 179 DEMUXER_ERROR_COULD_NOT_OPEN); | 199 DEMUXER_ERROR_COULD_NOT_OPEN); |
| 180 FFMPEG_TEST_CASE(MP4_1, | 200 FFMPEG_TEST_CASE(MP4_1, |
| 181 "security/clockh264aac_200021889.mp4", | 201 "security/clockh264aac_200021889.mp4", |
| 182 DEMUXER_ERROR_COULD_NOT_OPEN, | 202 DEMUXER_ERROR_COULD_NOT_OPEN, |
| 183 DEMUXER_ERROR_COULD_NOT_OPEN); | 203 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"); | 359 FLAKY_FFMPEG_TEST_CASE(OGV_0, "security/big_dims.ogv"); |
| 340 FLAKY_FFMPEG_TEST_CASE(OGV_3, "security/smclock_1_0.ogv"); | 360 FLAKY_FFMPEG_TEST_CASE(OGV_3, "security/smclock_1_0.ogv"); |
| 341 FLAKY_FFMPEG_TEST_CASE(OGV_4, "security/smclock.ogv.1.0.ogv"); | 361 FLAKY_FFMPEG_TEST_CASE(OGV_4, "security/smclock.ogv.1.0.ogv"); |
| 342 FLAKY_FFMPEG_TEST_CASE(OGV_6, "security/smclocktheora_1_10000.ogv"); | 362 FLAKY_FFMPEG_TEST_CASE(OGV_6, "security/smclocktheora_1_10000.ogv"); |
| 343 FLAKY_FFMPEG_TEST_CASE(OGV_13, "security/smclocktheora_1_790.ogv"); | 363 FLAKY_FFMPEG_TEST_CASE(OGV_13, "security/smclocktheora_1_790.ogv"); |
| 344 FLAKY_FFMPEG_TEST_CASE(MP4_3, "security/clockh264aac_300413969.mp4"); | 364 FLAKY_FFMPEG_TEST_CASE(MP4_3, "security/clockh264aac_300413969.mp4"); |
| 345 FLAKY_FFMPEG_TEST_CASE(MP4_4, "security/clockh264aac_301350139.mp4"); | 365 FLAKY_FFMPEG_TEST_CASE(MP4_4, "security/clockh264aac_301350139.mp4"); |
| 346 FLAKY_FFMPEG_TEST_CASE(MP4_12, "security/assert1.mov"); | 366 FLAKY_FFMPEG_TEST_CASE(MP4_12, "security/assert1.mov"); |
| 347 FLAKY_FFMPEG_TEST_CASE(WEBM_3, "security/out.webm.139771.2965"); | 367 FLAKY_FFMPEG_TEST_CASE(WEBM_3, "security/out.webm.139771.2965"); |
| 348 | 368 |
| 369 // Init status flakes between PIPELINE_OK and PIPELINE_ERROR_DECODE, and gives |
| 370 // PIPELINE_ERROR_DECODE later if initialization was PIPELINE_OK. |
| 371 FLAKY_FFMPEG_TEST_CASE(Cr666794, "security/666794.webm"); |
| 372 |
| 349 // Not really flaky, but can't pass the seek test. | 373 // Not really flaky, but can't pass the seek test. |
| 350 FLAKY_FFMPEG_TEST_CASE(MP4_10, "security/null1.m4a"); | 374 FLAKY_FFMPEG_TEST_CASE(MP4_10, "security/null1.m4a"); |
| 351 FLAKY_FFMPEG_TEST_CASE(Cr112670, "security/112670.mp4"); | 375 FLAKY_FFMPEG_TEST_CASE(Cr112670, "security/112670.mp4"); |
| 352 | 376 |
| 353 // Uses ASSERTs to prevent sharded tests from hanging on failure. | 377 // Uses ASSERTs to prevent sharded tests from hanging on failure. |
| 354 TEST_P(FFmpegRegressionTest, BasicPlayback) { | 378 TEST_P(FFmpegRegressionTest, BasicPlayback) { |
| 355 if (GetParam().init_status == PIPELINE_OK) { | 379 if (GetParam().init_status == PIPELINE_OK) { |
| 356 ASSERT_EQ(PIPELINE_OK, Start(GetParam().filename, kClockless)); | 380 ASSERT_EQ(PIPELINE_OK, Start(GetParam().filename, kClockless)); |
| 357 Play(); | 381 Play(); |
| 358 ASSERT_EQ(GetParam().end_status, WaitUntilEndedOrError()); | 382 ASSERT_EQ(GetParam().end_status, WaitUntilEndedOrError()); |
| 359 | 383 |
| 360 // Check for ended if the pipeline is expected to finish okay. | 384 // Check for ended if the pipeline is expected to finish okay. |
| 361 if (GetParam().end_status == PIPELINE_OK) { | 385 if (GetParam().end_status == PIPELINE_OK) { |
| 362 ASSERT_TRUE(ended_); | 386 ASSERT_TRUE(ended_); |
| 363 | 387 |
| 364 // Tack a seek on the end to catch any seeking issues. | 388 // Tack a seek on the end to catch any seeking issues. |
| 365 Seek(GetStartTime()); | 389 Seek(GetParam().seek_time == kNoTimestamp ? GetStartTime() |
| 390 : GetParam().seek_time); |
| 366 } | 391 } |
| 367 } else { | 392 } else { |
| 368 // Don't bother checking the exact status as we only care that the | 393 // Don't bother checking the exact status as we only care that the |
| 369 // pipeline failed to start. | 394 // pipeline failed to start. |
| 370 EXPECT_NE(PIPELINE_OK, Start(GetParam().filename)); | 395 EXPECT_NE(PIPELINE_OK, Start(GetParam().filename)); |
| 371 } | 396 } |
| 372 } | 397 } |
| 373 | 398 |
| 374 TEST_P(FlakyFFmpegRegressionTest, BasicPlayback) { | 399 TEST_P(FlakyFFmpegRegressionTest, BasicPlayback) { |
| 375 if (Start(GetParam().filename, kClockless) == PIPELINE_OK) { | 400 if (Start(GetParam().filename, kClockless) == PIPELINE_OK) { |
| 376 Play(); | 401 Play(); |
| 377 WaitUntilEndedOrError(); | 402 WaitUntilEndedOrError(); |
| 378 } | 403 } |
| 379 } | 404 } |
| 380 | 405 |
| 381 } // namespace media | 406 } // namespace media |
| OLD | NEW |