Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 2645953004: Update duration when demuxed packets exceed known duration. (Closed)
Patch Set: Remux and encode test.ogv. Fixes bad duration. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 public testing::WithParamInterface<PlaybackTestData> { 826 public testing::WithParamInterface<PlaybackTestData> {
827 }; 827 };
828 828
829 class BasicMSEPlaybackTest 829 class BasicMSEPlaybackTest
830 : public ::testing::WithParamInterface<MSEPlaybackTestData>, 830 : public ::testing::WithParamInterface<MSEPlaybackTestData>,
831 public PipelineIntegrationTest {}; 831 public PipelineIntegrationTest {};
832 832
833 TEST_P(BasicPlaybackTest, PlayToEnd) { 833 TEST_P(BasicPlaybackTest, PlayToEnd) {
834 PlaybackTestData data = GetParam(); 834 PlaybackTestData data = GetParam();
835 835
836 ASSERT_EQ(PIPELINE_OK, Start(data.filename, kClockless)); 836 ASSERT_EQ(PIPELINE_OK,
837 Start(data.filename, kClockless | kUnreliableDuration));
837 EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds()); 838 EXPECT_EQ(data.start_time_ms, demuxer_->GetStartTime().InMilliseconds());
838 EXPECT_EQ(data.duration_ms, pipeline_->GetMediaDuration().InMilliseconds()); 839 EXPECT_EQ(data.duration_ms, pipeline_->GetMediaDuration().InMilliseconds());
839 840
840 Play(); 841 Play();
841 ASSERT_TRUE(WaitUntilOnEnded()); 842 ASSERT_TRUE(WaitUntilOnEnded());
842 } 843 }
843 844
844 TEST_P(BasicMSEPlaybackTest, PlayToEnd) { 845 TEST_P(BasicMSEPlaybackTest, PlayToEnd) {
845 MSEPlaybackTestData data = GetParam(); 846 MSEPlaybackTestData data = GetParam();
846 847
(...skipping 20 matching lines...) Expand all
867 #if defined(USE_PROPRIETARY_CODECS) 868 #if defined(USE_PROPRIETARY_CODECS)
868 869
869 const PlaybackTestData kADTSTests[] = { 870 const PlaybackTestData kADTSTests[] = {
870 {"bear-audio-main-aac.aac", 0, 2724}, 871 {"bear-audio-main-aac.aac", 0, 2724},
871 {"bear-audio-lc-aac.aac", 0, 2858}, 872 {"bear-audio-lc-aac.aac", 0, 2858},
872 {"bear-audio-implicit-he-aac-v1.aac", 0, 2812}, 873 {"bear-audio-implicit-he-aac-v1.aac", 0, 2812},
873 {"bear-audio-implicit-he-aac-v2.aac", 0, 3047}, 874 {"bear-audio-implicit-he-aac-v2.aac", 0, 3047},
874 }; 875 };
875 876
876 // TODO(chcunningham): Migrate other basic playback tests to TEST_P. 877 // TODO(chcunningham): Migrate other basic playback tests to TEST_P.
877 INSTANTIATE_TEST_CASE_P(PropritaryCodecs, 878 INSTANTIATE_TEST_CASE_P(ProprietaryCodecs,
878 BasicPlaybackTest, 879 BasicPlaybackTest,
879 testing::ValuesIn(kADTSTests)); 880 testing::ValuesIn(kADTSTests));
880 881
881 const MSEPlaybackTestData kMediaSourceADTSTests[] = { 882 const MSEPlaybackTestData kMediaSourceADTSTests[] = {
882 {"bear-audio-main-aac.aac", kADTS, kAppendWholeFile, 2773}, 883 {"bear-audio-main-aac.aac", kADTS, kAppendWholeFile, 2773},
883 {"bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, 2794}, 884 {"bear-audio-lc-aac.aac", kADTS, kAppendWholeFile, 2794},
884 {"bear-audio-implicit-he-aac-v1.aac", kADTS, kAppendWholeFile, 2858}, 885 {"bear-audio-implicit-he-aac-v1.aac", kADTS, kAppendWholeFile, 2858},
885 {"bear-audio-implicit-he-aac-v2.aac", kADTS, kAppendWholeFile, 2901}, 886 {"bear-audio-implicit-he-aac-v2.aac", kADTS, kAppendWholeFile, 2901},
886 }; 887 };
887 888
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 source.Shutdown(); 2539 source.Shutdown();
2539 Stop(); 2540 Stop();
2540 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) 2541 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO)
2541 ->audio_decoder_config() 2542 ->audio_decoder_config()
2542 .samples_per_second()); 2543 .samples_per_second());
2543 } 2544 }
2544 2545
2545 // Ensures audio-only playback with missing or negative timestamps works. Tests 2546 // Ensures audio-only playback with missing or negative timestamps works. Tests
2546 // the common live-streaming case for chained ogg. See http://crbug.com/396864. 2547 // the common live-streaming case for chained ogg. See http://crbug.com/396864.
2547 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { 2548 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) {
2548 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg")); 2549 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration));
2549 Play(); 2550 Play();
2550 ASSERT_TRUE(WaitUntilOnEnded()); 2551 ASSERT_TRUE(WaitUntilOnEnded());
2551 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); 2552 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
2552 } 2553 }
2553 2554
2554 // Ensures audio-video playback with missing or negative timestamps fails softly 2555 // Ensures audio-video playback with missing or negative timestamps fails softly
2555 // instead of crashing. See http://crbug.com/396864. 2556 // instead of crashing. See http://crbug.com/396864.
2556 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { 2557 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) {
2557 ASSERT_EQ(PIPELINE_OK, Start("double-bear.ogv")); 2558 ASSERT_EQ(PIPELINE_OK, Start("double-bear.ogv", kUnreliableDuration));
2558 Play(); 2559 Play();
2559 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 2560 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
2560 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); 2561 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
2561 } 2562 }
2562 2563
2563 // Tests that we signal ended even when audio runs longer than video track. 2564 // Tests that we signal ended even when audio runs longer than video track.
2564 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) { 2565 TEST_F(PipelineIntegrationTest, BasicPlaybackAudioLongerThanVideo) {
2565 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv")); 2566 ASSERT_EQ(PIPELINE_OK, Start("bear_audio_longer_than_video.ogv"));
2566 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher 2567 // Audio track is 2000ms. Video track is 1001ms. Duration should be higher
2567 // of the two. 2568 // of the two.
(...skipping 14 matching lines...) Expand all
2582 2583
2583 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2584 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2584 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2585 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2585 Play(); 2586 Play();
2586 ASSERT_TRUE(WaitUntilOnEnded()); 2587 ASSERT_TRUE(WaitUntilOnEnded());
2587 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2588 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2588 demuxer_->GetStartTime()); 2589 demuxer_->GetStartTime());
2589 } 2590 }
2590 2591
2591 } // namespace media 2592 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698