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 "media/filters/pipeline_integration_test_base.h" | 5 #include "media/filters/pipeline_integration_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
845 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 845 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
846 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 846 EXPECT_EQ(325, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
847 | 847 |
848 Play(); | 848 Play(); |
849 | 849 |
850 EXPECT_TRUE(WaitUntilOnEnded()); | 850 EXPECT_TRUE(WaitUntilOnEnded()); |
851 } | 851 } |
852 | 852 |
853 TEST_P(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { | 853 TEST_P(PipelineIntegrationTest, MediaSource_ADTS_TimestampOffset) { |
854 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile, GetParam()); | 854 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile, GetParam()); |
855 StartPipelineWithMediaSource(&source); | 855 StartHashedPipelineWithMediaSource(&source); |
856 EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds()); | 856 EXPECT_EQ(325, source.last_timestamp_offset().InMilliseconds()); |
857 | 857 |
858 // Trim off multiple frames off the beginning of the segment which will cause | |
859 // the first decoded frame to be incorrect if preroll isn't implemented. | |
wolenetz
2014/05/16 20:06:16
nit: By "preroll", do you really mean partial appe
DaleCurtis
2014/05/16 20:11:56
No I mean preroll as in this won't work if partial
wolenetz
2014/05/16 20:17:32
I understand and lgtm if you meant "this test will
| |
860 const base::TimeDelta adts_preroll_duration = | |
861 base::TimeDelta::FromSecondsD(2.5 * 1024 / 44100); | |
862 const base::TimeDelta append_time = | |
863 source.last_timestamp_offset() - adts_preroll_duration; | |
864 | |
858 scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.adts"); | 865 scoped_refptr<DecoderBuffer> second_file = ReadTestDataFile("sfx.adts"); |
859 source.AppendAtTime( | 866 source.AppendAtTimeWithWindow(append_time, |
860 source.last_timestamp_offset() - base::TimeDelta::FromMilliseconds(10), | 867 append_time + adts_preroll_duration, |
861 second_file->data(), | 868 kInfiniteDuration(), |
862 second_file->data_size()); | 869 second_file->data(), |
870 second_file->data_size()); | |
863 source.EndOfStream(); | 871 source.EndOfStream(); |
864 | 872 |
865 EXPECT_EQ(640, source.last_timestamp_offset().InMilliseconds()); | 873 EXPECT_EQ(592, source.last_timestamp_offset().InMilliseconds()); |
866 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 874 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
867 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 875 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
868 EXPECT_EQ(640, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 876 EXPECT_EQ(592, pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
869 | 877 |
870 Play(); | 878 Play(); |
871 | 879 |
872 EXPECT_TRUE(WaitUntilOnEnded()); | 880 EXPECT_TRUE(WaitUntilOnEnded()); |
881 | |
882 // If preroll is not implemented this would be: | |
883 // 5.85,3.25,5.35,1.45,4.75,1.88, | |
884 EXPECT_EQ("-0.81,0.97,-1.22,-0.70,-1.76,-0.34,", GetAudioHash()); | |
873 } | 885 } |
874 | 886 |
875 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { | 887 TEST_F(PipelineIntegrationTest, BasicPlaybackHashed_MP3) { |
876 ASSERT_TRUE(Start(GetTestDataFilePath("sfx.mp3"), PIPELINE_OK, kHashed)); | 888 ASSERT_TRUE(Start(GetTestDataFilePath("sfx.mp3"), PIPELINE_OK, kHashed)); |
877 | 889 |
878 Play(); | 890 Play(); |
879 | 891 |
880 ASSERT_TRUE(WaitUntilOnEnded()); | 892 ASSERT_TRUE(WaitUntilOnEnded()); |
881 | 893 |
882 // Verify codec delay and preroll are stripped. | 894 // Verify codec delay and preroll are stripped. |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1318 Play(); | 1330 Play(); |
1319 ASSERT_TRUE(WaitUntilOnEnded()); | 1331 ASSERT_TRUE(WaitUntilOnEnded()); |
1320 } | 1332 } |
1321 | 1333 |
1322 // TODO(wolenetz): Enable MSE testing of new frame processor based on this flag, | 1334 // TODO(wolenetz): Enable MSE testing of new frame processor based on this flag, |
1323 // once the new processor has landed. See http://crbug.com/249422. | 1335 // once the new processor has landed. See http://crbug.com/249422. |
1324 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, | 1336 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, |
1325 Values(true)); | 1337 Values(true)); |
1326 | 1338 |
1327 } // namespace media | 1339 } // namespace media |
OLD | NEW |