| 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 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 public testing::WithParamInterface<PlaybackTestData> { | 827 public testing::WithParamInterface<PlaybackTestData> { |
| 828 }; | 828 }; |
| 829 | 829 |
| 830 class BasicMSEPlaybackTest | 830 class BasicMSEPlaybackTest |
| 831 : public ::testing::WithParamInterface<MSEPlaybackTestData>, | 831 : public ::testing::WithParamInterface<MSEPlaybackTestData>, |
| 832 public PipelineIntegrationTest {}; | 832 public PipelineIntegrationTest {}; |
| 833 | 833 |
| 834 TEST_P(BasicPlaybackTest, PlayToEnd) { | 834 TEST_P(BasicPlaybackTest, PlayToEnd) { |
| 835 PlaybackTestData data = GetParam(); | 835 PlaybackTestData data = GetParam(); |
| 836 | 836 |
| 837 ASSERT_EQ(PIPELINE_OK, Start(data.filename, kClockless)); | 837 ASSERT_EQ(PIPELINE_OK, |
| 838 Start(data.filename, kClockless | kUnreliableDuration)); |
| 838 EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds()); | 839 EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds()); |
| 839 EXPECT_EQ(data.duration_ms, pipeline_->GetMediaDuration().InMilliseconds()); | 840 EXPECT_EQ(data.duration_ms, pipeline_->GetMediaDuration().InMilliseconds()); |
| 840 | 841 |
| 841 Play(); | 842 Play(); |
| 842 ASSERT_TRUE(WaitUntilOnEnded()); | 843 ASSERT_TRUE(WaitUntilOnEnded()); |
| 843 } | 844 } |
| 844 | 845 |
| 845 TEST_P(BasicMSEPlaybackTest, PlayToEnd) { | 846 TEST_P(BasicMSEPlaybackTest, PlayToEnd) { |
| 846 MSEPlaybackTestData data = GetParam(); | 847 MSEPlaybackTestData data = GetParam(); |
| 847 | 848 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 868 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 869 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 869 | 870 |
| 870 const PlaybackTestData kADTSTests[] = { | 871 const PlaybackTestData kADTSTests[] = { |
| 871 {"bear-audio-main-aac.aac", 0, 2724}, | 872 {"bear-audio-main-aac.aac", 0, 2724}, |
| 872 {"bear-audio-lc-aac.aac", 0, 2858}, | 873 {"bear-audio-lc-aac.aac", 0, 2858}, |
| 873 {"bear-audio-implicit-he-aac-v1.aac", 0, 2812}, | 874 {"bear-audio-implicit-he-aac-v1.aac", 0, 2812}, |
| 874 {"bear-audio-implicit-he-aac-v2.aac", 0, 3047}, | 875 {"bear-audio-implicit-he-aac-v2.aac", 0, 3047}, |
| 875 }; | 876 }; |
| 876 | 877 |
| 877 // TODO(chcunningham): Migrate other basic playback tests to TEST_P. | 878 // TODO(chcunningham): Migrate other basic playback tests to TEST_P. |
| 878 INSTANTIATE_TEST_CASE_P(PropritaryCodecs, | 879 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs, |
| 879 BasicPlaybackTest, | 880 BasicPlaybackTest, |
| 880 testing::ValuesIn(kADTSTests)); | 881 testing::ValuesIn(kADTSTests)); |
| 881 | 882 |
| 882 const MSEPlaybackTestData kMediaSourceADTSTests[] = { | 883 const MSEPlaybackTestData kMediaSourceADTSTests[] = { |
| 883 {"bear-audio-main-aac.aac", kADTS, kAppendWholeFile, 2773}, | 884 {"bear-audio-main-aac.aac", kADTS, kAppendWholeFile, 2773}, |
| 884 {"bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, 2794}, | 885 {"bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, 2794}, |
| 885 {"bear-audio-implicit-he-aac-v1.aac", kADTS, kAppendWholeFile, 2858}, | 886 {"bear-audio-implicit-he-aac-v1.aac", kADTS, kAppendWholeFile, 2858}, |
| 886 {"bear-audio-implicit-he-aac-v2.aac", kADTS, kAppendWholeFile, 2901}, | 887 {"bear-audio-implicit-he-aac-v2.aac", kADTS, kAppendWholeFile, 2901}, |
| 887 }; | 888 }; |
| 888 | 889 |
| 889 // TODO(chcunningham): Migrate other basic MSE playback tests to TEST_P. | 890 // TODO(chcunningham): Migrate other basic MSE playback tests to TEST_P. |
| 890 INSTANTIATE_TEST_CASE_P(PropritaryCodecs, | 891 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs, |
| 891 BasicMSEPlaybackTest, | 892 BasicMSEPlaybackTest, |
| 892 testing::ValuesIn(kMediaSourceADTSTests)); | 893 testing::ValuesIn(kMediaSourceADTSTests)); |
| 893 | 894 |
| 894 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) | 895 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 895 | 896 |
| 896 TEST_F(PipelineIntegrationTest, BasicPlayback) { | 897 TEST_F(PipelineIntegrationTest, BasicPlayback) { |
| 897 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); | 898 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); |
| 898 | 899 |
| 899 Play(); | 900 Play(); |
| 900 | 901 |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2539 source.Shutdown(); | 2540 source.Shutdown(); |
| 2540 Stop(); | 2541 Stop(); |
| 2541 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) | 2542 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) |
| 2542 ->audio_decoder_config() | 2543 ->audio_decoder_config() |
| 2543 .samples_per_second()); | 2544 .samples_per_second()); |
| 2544 } | 2545 } |
| 2545 | 2546 |
| 2546 // Ensures audio-only playback with missing or negative timestamps works. Tests | 2547 // Ensures audio-only playback with missing or negative timestamps works. Tests |
| 2547 // the common live-streaming case for chained ogg. See http://crbug.com/396864. | 2548 // the common live-streaming case for chained ogg. See http://crbug.com/396864. |
| 2548 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { | 2549 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { |
| 2549 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg")); | 2550 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration)); |
| 2550 Play(); | 2551 Play(); |
| 2551 ASSERT_TRUE(WaitUntilOnEnded()); | 2552 ASSERT_TRUE(WaitUntilOnEnded()); |
| 2552 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); | 2553 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); |
| 2553 } | 2554 } |
| 2554 | 2555 |
| 2555 // Ensures audio-video playback with missing or negative timestamps fails softly | 2556 // Ensures audio-video playback with missing or negative timestamps fails softly |
| 2556 // instead of crashing. See http://crbug.com/396864. | 2557 // instead of crashing. See http://crbug.com/396864. |
| 2557 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { | 2558 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { |
| 2558 ASSERT_EQ(PIPELINE_OK, Start("double-bear.ogv")); | 2559 ASSERT_EQ(PIPELINE_OK, Start("double-bear.ogv", kUnreliableDuration)); |
| 2559 Play(); | 2560 Play(); |
| 2560 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 2561 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
| 2561 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); | 2562 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); |
| 2562 } | 2563 } |
| 2563 | 2564 |
| 2564 // Tests that we signal ended even when audio runs longer than video track. | 2565 // Tests that we signal ended even when audio runs longer than video track. |
| 2565 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { | 2566 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { |
| 2566 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv")); | 2567 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv")); |
| 2567 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher | 2568 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher |
| 2568 // of the two. | 2569 // of the two. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2583 | 2584 |
| 2584 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 2585 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 2585 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); | 2586 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); |
| 2586 Play(); | 2587 Play(); |
| 2587 ASSERT_TRUE(WaitUntilOnEnded()); | 2588 ASSERT_TRUE(WaitUntilOnEnded()); |
| 2588 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 2589 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 2589 demuxer_->GetStartTime()); | 2590 demuxer_->GetStartTime()); |
| 2590 } | 2591 } |
| 2591 | 2592 |
| 2592 } // namespace media | 2593 } // namespace media |
| OLD | NEW |