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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 scoped_refptr<DecoderBuffer> second_file = | 647 scoped_refptr<DecoderBuffer> second_file = |
648 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 648 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
649 | 649 |
650 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 650 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
651 second_file->data(), second_file->data_size()); | 651 second_file->data(), second_file->data_size()); |
652 | 652 |
653 source.EndOfStream(); | 653 source.EndOfStream(); |
654 | 654 |
655 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 655 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
656 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 656 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
657 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, | 657 // The "+ 1" is due to estimated audio and video frame durations on the last |
| 658 // frames appended. The unencrypted file has a TrackEntry DefaultDuration |
| 659 // field for the video track, but the encrypted file does not. |
| 660 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs + 1, |
658 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 661 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
659 | 662 |
660 Play(); | 663 Play(); |
661 | 664 |
662 EXPECT_TRUE(WaitUntilOnEnded()); | 665 EXPECT_TRUE(WaitUntilOnEnded()); |
663 source.Abort(); | 666 source.Abort(); |
664 Stop(); | 667 Stop(); |
665 } | 668 } |
666 | 669 |
667 // Config changes from encrypted to clear are not currently supported. | 670 // Config changes from encrypted to clear are not currently supported. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 ReadTestDataFile("bear-640x360.webm"); | 710 ReadTestDataFile("bear-640x360.webm"); |
708 | 711 |
709 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 712 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
710 second_file->data(), second_file->data_size()); | 713 second_file->data(), second_file->data_size()); |
711 | 714 |
712 source.EndOfStream(); | 715 source.EndOfStream(); |
713 | 716 |
714 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 717 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
715 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 718 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
716 // The second video was not added, so its time has not been added. | 719 // The second video was not added, so its time has not been added. |
717 EXPECT_EQ(k320WebMFileDurationMs, | 720 // The "+ 1" is due to estimated audio and video frame durations on the last |
| 721 // frames appended. The unencrypted file has a TrackEntry DefaultDuration |
| 722 // field for the video track, but the encrypted file does not. |
| 723 EXPECT_EQ(k320WebMFileDurationMs + 1, |
718 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 724 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
719 | 725 |
720 Play(); | 726 Play(); |
721 | 727 |
722 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 728 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
723 source.Abort(); | 729 source.Abort(); |
724 } | 730 } |
725 | 731 |
726 #if defined(USE_PROPRIETARY_CODECS) | 732 #if defined(USE_PROPRIETARY_CODECS) |
727 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { | 733 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 8192, | 1124 8192, |
1119 base::TimeDelta::FromMilliseconds(464), | 1125 base::TimeDelta::FromMilliseconds(464), |
1120 base::TimeDelta::FromMilliseconds(617), | 1126 base::TimeDelta::FromMilliseconds(617), |
1121 0x10CA, 19730)); | 1127 0x10CA, 19730)); |
1122 } | 1128 } |
1123 | 1129 |
1124 // Verify video decoder & renderer can handle aborted demuxer reads. | 1130 // Verify video decoder & renderer can handle aborted demuxer reads. |
1125 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { | 1131 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { |
1126 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, | 1132 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, |
1127 32768, | 1133 32768, |
1128 base::TimeDelta::FromMilliseconds(200), | 1134 base::TimeDelta::FromMilliseconds(167), |
1129 base::TimeDelta::FromMilliseconds(1668), | 1135 base::TimeDelta::FromMilliseconds(1668), |
1130 0x1C896, 65536)); | 1136 0x1C896, 65536)); |
1131 } | 1137 } |
1132 | 1138 |
1133 // Verify that Opus audio in WebM containers can be played back. | 1139 // Verify that Opus audio in WebM containers can be played back. |
1134 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { | 1140 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { |
1135 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus-end-trimming.webm"), | 1141 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus-end-trimming.webm"), |
1136 PIPELINE_OK)); | 1142 PIPELINE_OK)); |
1137 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 1143 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
1138 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 1144 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 // Verify that VP8 video with inband text track can be played back. | 1188 // Verify that VP8 video with inband text track can be played back. |
1183 TEST_F(PipelineIntegrationTest, | 1189 TEST_F(PipelineIntegrationTest, |
1184 BasicPlayback_VP8_WebVTT_WebM) { | 1190 BasicPlayback_VP8_WebVTT_WebM) { |
1185 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), | 1191 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
1186 PIPELINE_OK)); | 1192 PIPELINE_OK)); |
1187 Play(); | 1193 Play(); |
1188 ASSERT_TRUE(WaitUntilOnEnded()); | 1194 ASSERT_TRUE(WaitUntilOnEnded()); |
1189 } | 1195 } |
1190 | 1196 |
1191 } // namespace media | 1197 } // namespace media |
OLD | NEW |