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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 const uint8 kKeyId[] = { | 52 const uint8 kKeyId[] = { |
53 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | 53 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
54 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 | 54 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 |
55 }; | 55 }; |
56 | 56 |
57 const int kAppendWholeFile = -1; | 57 const int kAppendWholeFile = -1; |
58 | 58 |
59 // Constants for the Media Source config change tests. | 59 // Constants for the Media Source config change tests. |
60 const int kAppendTimeSec = 1; | 60 const int kAppendTimeSec = 1; |
61 const int kAppendTimeMs = kAppendTimeSec * 1000; | 61 const int kAppendTimeMs = kAppendTimeSec * 1000; |
62 const int k320WebMFileDurationMs = 2737; | 62 const int k320WebMFileDurationMs = 2736; |
63 const int k640WebMFileDurationMs = 2763; | 63 const int k640WebMFileDurationMs = 2762; |
64 const int kOpusEndTrimmingWebMFileDurationMs = 2771; | 64 const int kOpusEndTrimmingWebMFileDurationMs = 2771; |
65 const int kVP9WebMFileDurationMs = 2703; | 65 const int kVP9WebMFileDurationMs = 2703; |
66 const int kVP8AWebMFileDurationMs = 2700; | 66 const int kVP8AWebMFileDurationMs = 2700; |
67 | 67 |
68 #if defined(USE_PROPRIETARY_CODECS) | 68 #if defined(USE_PROPRIETARY_CODECS) |
69 const int k640IsoFileDurationMs = 2737; | 69 const int k640IsoFileDurationMs = 2737; |
70 const int k640IsoCencFileDurationMs = 2736; | 70 const int k640IsoCencFileDurationMs = 2736; |
71 const int k1280IsoFileDurationMs = 2736; | 71 const int k1280IsoFileDurationMs = 2736; |
72 const int k1280IsoAVC3FileDurationMs = 2735; | 72 const int k1280IsoAVC3FileDurationMs = 2735; |
73 #endif // defined(USE_PROPRIETARY_CODECS) | 73 #endif // defined(USE_PROPRIETARY_CODECS) |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 scoped_refptr<DecoderBuffer> second_file = | 648 scoped_refptr<DecoderBuffer> second_file = |
649 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 649 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
650 | 650 |
651 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 651 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
652 second_file->data(), second_file->data_size()); | 652 second_file->data(), second_file->data_size()); |
653 | 653 |
654 source.EndOfStream(); | 654 source.EndOfStream(); |
655 | 655 |
656 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 656 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
657 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 657 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
658 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, | 658 // The "+ 1" is due to estimated audio and video frame durations on the last |
| 659 // frames appended. The unencrypted file has a TrackEntry DefaultDuration |
| 660 // field for the video track, but the encrypted file does not. |
| 661 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs + 1, |
659 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 662 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
660 | 663 |
661 Play(); | 664 Play(); |
662 | 665 |
663 EXPECT_TRUE(WaitUntilOnEnded()); | 666 EXPECT_TRUE(WaitUntilOnEnded()); |
664 source.Abort(); | 667 source.Abort(); |
665 Stop(); | 668 Stop(); |
666 } | 669 } |
667 | 670 |
668 // Config changes from encrypted to clear are not currently supported. | 671 // Config changes from encrypted to clear are not currently supported. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 ReadTestDataFile("bear-640x360.webm"); | 711 ReadTestDataFile("bear-640x360.webm"); |
709 | 712 |
710 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 713 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
711 second_file->data(), second_file->data_size()); | 714 second_file->data(), second_file->data_size()); |
712 | 715 |
713 source.EndOfStream(); | 716 source.EndOfStream(); |
714 | 717 |
715 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 718 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
716 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 719 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
717 // The second video was not added, so its time has not been added. | 720 // The second video was not added, so its time has not been added. |
718 EXPECT_EQ(k320WebMFileDurationMs, | 721 // The "+ 1" is due to estimated audio and video frame durations on the last |
| 722 // frames appended. The unencrypted file has a TrackEntry DefaultDuration |
| 723 // field for the video track, but the encrypted file does not. |
| 724 EXPECT_EQ(k320WebMFileDurationMs + 1, |
719 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 725 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
720 | 726 |
721 Play(); | 727 Play(); |
722 | 728 |
723 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 729 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
724 source.Abort(); | 730 source.Abort(); |
725 } | 731 } |
726 | 732 |
727 #if defined(USE_PROPRIETARY_CODECS) | 733 #if defined(USE_PROPRIETARY_CODECS) |
728 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { | 734 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 8192, | 1125 8192, |
1120 base::TimeDelta::FromMilliseconds(464), | 1126 base::TimeDelta::FromMilliseconds(464), |
1121 base::TimeDelta::FromMilliseconds(617), | 1127 base::TimeDelta::FromMilliseconds(617), |
1122 0x10CA, 19730)); | 1128 0x10CA, 19730)); |
1123 } | 1129 } |
1124 | 1130 |
1125 // Verify video decoder & renderer can handle aborted demuxer reads. | 1131 // Verify video decoder & renderer can handle aborted demuxer reads. |
1126 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 1132 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
1127 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, | 1133 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
1128 32768, | 1134 32768, |
1129 base::TimeDelta::FromMilliseconds(200), | 1135 base::TimeDelta::FromMilliseconds(167), |
1130 base::TimeDelta::FromMilliseconds(1668), | 1136 base::TimeDelta::FromMilliseconds(1668), |
1131 0x1C896, 65536)); | 1137 0x1C896, 65536)); |
1132 } | 1138 } |
1133 | 1139 |
1134 // Verify that Opus audio in WebM containers can be played back. | 1140 // Verify that Opus audio in WebM containers can be played back. |
1135 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { | 1141 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { |
1136 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus-end-trimming.webm"), | 1142 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus-end-trimming.webm"), |
1137 PIPELINE_OK)); | 1143 PIPELINE_OK)); |
1138 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1144 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1139 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1145 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 // Verify that VP8 video with inband text track can be played back. | 1189 // Verify that VP8 video with inband text track can be played back. |
1184 TEST_F(PipelineIntegrationTest, | 1190 TEST_F(PipelineIntegrationTest, |
1185 BasicPlayback_VP8_WebVTT_WebM) { | 1191 BasicPlayback_VP8_WebVTT_WebM) { |
1186 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), | 1192 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
1187 PIPELINE_OK)); | 1193 PIPELINE_OK)); |
1188 Play(); | 1194 Play(); |
1189 ASSERT_TRUE(WaitUntilOnEnded()); | 1195 ASSERT_TRUE(WaitUntilOnEnded()); |
1190 } | 1196 } |
1191 | 1197 |
1192 } // namespace media | 1198 } // namespace media |
OLD | NEW |