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 // ffmpeg_unittests verify that the parts of the FFmpeg API that Chromium uses | 5 // ffmpeg_unittests verify that the parts of the FFmpeg API that Chromium uses |
6 // function as advertised for each media format that Chromium supports. This | 6 // function as advertised for each media format that Chromium supports. This |
7 // mostly includes stuff like reporting proper timestamps, seeking to | 7 // mostly includes stuff like reporting proper timestamps, seeking to |
8 // keyframes, and supporting certain features like reordered_opaque. | 8 // keyframes, and supporting certain features like reordered_opaque. |
9 // | 9 // |
10 | 10 |
11 #include <limits> | 11 #include <limits> |
12 #include <queue> | 12 #include <queue> |
13 | 13 |
14 #include "base/base_paths.h" | 14 #include "base/base_paths.h" |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/files/memory_mapped_file.h" | 17 #include "base/files/memory_mapped_file.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/test/perf_test_suite.h" | 21 #include "base/test/perf_test_suite.h" |
22 #include "base/test/perftimer.h" | 22 #include "base/test/perf_time_logger.h" |
23 #include "media/base/media.h" | 23 #include "media/base/media.h" |
24 #include "media/ffmpeg/ffmpeg_common.h" | 24 #include "media/ffmpeg/ffmpeg_common.h" |
25 #include "media/filters/ffmpeg_glue.h" | 25 #include "media/filters/ffmpeg_glue.h" |
26 #include "media/filters/in_memory_url_protocol.h" | 26 #include "media/filters/in_memory_url_protocol.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
28 | 28 |
29 int main(int argc, char** argv) { | 29 int main(int argc, char** argv) { |
30 return base::PerfTestSuite(argc, argv).Run(); | 30 return base::PerfTestSuite(argc, argv).Run(); |
31 } | 31 } |
32 | 32 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 FFMPEG_TEST_CASE(sync2, mp4); | 417 FFMPEG_TEST_CASE(sync2, mp4); |
418 FFMPEG_TEST_CASE(sync2, ogg); | 418 FFMPEG_TEST_CASE(sync2, ogg); |
419 FFMPEG_TEST_CASE(sync2, ogv); | 419 FFMPEG_TEST_CASE(sync2, ogv); |
420 FFMPEG_TEST_CASE(sync2, webm); | 420 FFMPEG_TEST_CASE(sync2, webm); |
421 | 421 |
422 // Covers our LayoutTest file. | 422 // Covers our LayoutTest file. |
423 FFMPEG_TEST_CASE(counting, ogv); | 423 FFMPEG_TEST_CASE(counting, ogv); |
424 | 424 |
425 TEST_P(FFmpegTest, Perf) { | 425 TEST_P(FFmpegTest, Perf) { |
426 { | 426 { |
427 PerfTimeLogger timer("Opening file"); | 427 base::PerfTimeLogger timer("Opening file"); |
428 OpenFile(GetParam()); | 428 OpenFile(GetParam()); |
429 } | 429 } |
430 { | 430 { |
431 PerfTimeLogger timer("Opening codecs"); | 431 base::PerfTimeLogger timer("Opening codecs"); |
432 OpenCodecs(); | 432 OpenCodecs(); |
433 } | 433 } |
434 { | 434 { |
435 PerfTimeLogger timer("Reading file"); | 435 base::PerfTimeLogger timer("Reading file"); |
436 ReadRemainingFile(); | 436 ReadRemainingFile(); |
437 } | 437 } |
438 if (has_audio()) { | 438 if (has_audio()) { |
439 PerfTimeLogger timer("Decoding audio"); | 439 base::PerfTimeLogger timer("Decoding audio"); |
440 DecodeRemainingAudio(); | 440 DecodeRemainingAudio(); |
441 } | 441 } |
442 if (has_video()) { | 442 if (has_video()) { |
443 PerfTimeLogger timer("Decoding video"); | 443 base::PerfTimeLogger timer("Decoding video"); |
444 DecodeRemainingVideo(); | 444 DecodeRemainingVideo(); |
445 } | 445 } |
446 { | 446 { |
447 PerfTimeLogger timer("Seeking to zero"); | 447 base::PerfTimeLogger timer("Seeking to zero"); |
448 SeekTo(0); | 448 SeekTo(0); |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 TEST_P(FFmpegTest, Loop_Audio) { | 452 TEST_P(FFmpegTest, Loop_Audio) { |
453 OpenAndReadFile(GetParam()); | 453 OpenAndReadFile(GetParam()); |
454 if (!has_audio()) { | 454 if (!has_audio()) { |
455 return; | 455 return; |
456 } | 456 } |
457 | 457 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 EXPECT_TRUE(StepDecodeVideo()); | 580 EXPECT_TRUE(StepDecodeVideo()); |
581 VLOG(1) << decoded_video_time(); | 581 VLOG(1) << decoded_video_time(); |
582 | 582 |
583 SeekTo(0.4); | 583 SeekTo(0.4); |
584 ReadRemainingFile(); | 584 ReadRemainingFile(); |
585 EXPECT_TRUE(StepDecodeVideo()); | 585 EXPECT_TRUE(StepDecodeVideo()); |
586 VLOG(1) << decoded_video_time(); | 586 VLOG(1) << decoded_video_time(); |
587 } | 587 } |
588 | 588 |
589 } // namespace media | 589 } // namespace media |
OLD | NEW |