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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | 54 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
55 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 | 55 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 |
56 }; | 56 }; |
57 | 57 |
58 const int kAppendWholeFile = -1; | 58 const int kAppendWholeFile = -1; |
59 | 59 |
60 // Constants for the Media Source config change tests. | 60 // Constants for the Media Source config change tests. |
61 const int kAppendTimeSec = 1; | 61 const int kAppendTimeSec = 1; |
62 const int kAppendTimeMs = kAppendTimeSec * 1000; | 62 const int kAppendTimeMs = kAppendTimeSec * 1000; |
63 const int k320WebMFileDurationMs = 2736; | 63 const int k320WebMFileDurationMs = 2736; |
64 const int k640WebMFileDurationMs = 2762; | 64 const int k640WebMFileDurationMs = 2749; |
65 const int kOpusEndTrimmingWebMFileDurationMs = 2771; | 65 const int kOpusEndTrimmingWebMFileDurationMs = 2771; |
66 const int kVP9WebMFileDurationMs = 2736; | 66 const int kVP9WebMFileDurationMs = 2736; |
67 const int kVP8AWebMFileDurationMs = 2734; | 67 const int kVP8AWebMFileDurationMs = 2733; |
68 | 68 |
69 #if defined(USE_PROPRIETARY_CODECS) | 69 #if defined(USE_PROPRIETARY_CODECS) |
70 const int k640IsoFileDurationMs = 2737; | 70 const int k640IsoFileDurationMs = 2737; |
71 const int k640IsoCencFileDurationMs = 2736; | 71 const int k640IsoCencFileDurationMs = 2736; |
72 const int k1280IsoFileDurationMs = 2736; | 72 const int k1280IsoFileDurationMs = 2736; |
73 const int k1280IsoAVC3FileDurationMs = 2736; | 73 const int k1280IsoAVC3FileDurationMs = 2736; |
74 #endif // defined(USE_PROPRIETARY_CODECS) | 74 #endif // defined(USE_PROPRIETARY_CODECS) |
75 | 75 |
76 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 76 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
77 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 77 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 const bool use_legacy_frame_processor) | 259 const bool use_legacy_frame_processor) |
260 : file_path_(GetTestDataFilePath(filename)), | 260 : file_path_(GetTestDataFilePath(filename)), |
261 current_position_(0), | 261 current_position_(0), |
262 initial_append_size_(initial_append_size), | 262 initial_append_size_(initial_append_size), |
263 mimetype_(mimetype), | 263 mimetype_(mimetype), |
264 chunk_demuxer_(new ChunkDemuxer( | 264 chunk_demuxer_(new ChunkDemuxer( |
265 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), | 265 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), |
266 base::Bind(&MockMediaSource::DemuxerNeedKey, | 266 base::Bind(&MockMediaSource::DemuxerNeedKey, |
267 base::Unretained(this)), | 267 base::Unretained(this)), |
268 LogCB(), | 268 LogCB(), |
269 false)), | 269 true)), |
270 owned_chunk_demuxer_(chunk_demuxer_), | 270 owned_chunk_demuxer_(chunk_demuxer_), |
271 use_legacy_frame_processor_(use_legacy_frame_processor) { | 271 use_legacy_frame_processor_(use_legacy_frame_processor) { |
272 | 272 |
273 file_data_ = ReadTestDataFile(filename); | 273 file_data_ = ReadTestDataFile(filename); |
274 | 274 |
275 if (initial_append_size_ == kAppendWholeFile) | 275 if (initial_append_size_ == kAppendWholeFile) |
276 initial_append_size_ = file_data_->data_size(); | 276 initial_append_size_ = file_data_->data_size(); |
277 | 277 |
278 DCHECK_GT(initial_append_size_, 0); | 278 DCHECK_GT(initial_append_size_, 0); |
279 DCHECK_LE(initial_append_size_, file_data_->data_size()); | 279 DCHECK_LE(initial_append_size_, file_data_->data_size()); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { | 585 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
586 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); | 586 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); |
587 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 587 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
588 kAppendWholeFile, GetParam()); | 588 kAppendWholeFile, GetParam()); |
589 StartPipelineWithMediaSource(&source); | 589 StartPipelineWithMediaSource(&source); |
590 source.EndOfStream(); | 590 source.EndOfStream(); |
591 | 591 |
592 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 592 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
593 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 593 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
594 // TODO(acolwell/wolenetz): Drop the "+ 1" once WebM stream parser always | 594 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
595 // emits frames with valid durations (see http://crbug.com/351166) and | |
596 // compliant coded frame processor's "highest presentation end timestamp" is | |
597 // used to update duration (see http://crbug.com/249422). | |
598 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs + 1, | |
599 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 595 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
600 Play(); | 596 Play(); |
601 | 597 |
602 ASSERT_TRUE(WaitUntilOnEnded()); | 598 ASSERT_TRUE(WaitUntilOnEnded()); |
603 source.Abort(); | 599 source.Abort(); |
604 Stop(); | 600 Stop(); |
605 } | 601 } |
606 | 602 |
607 // Flaky. http://crbug.com/304776 | 603 // Flaky. http://crbug.com/304776 |
608 TEST_P(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { | 604 TEST_P(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
609 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); | 605 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); |
610 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 606 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
611 kAppendWholeFile, GetParam()); | 607 kAppendWholeFile, GetParam()); |
612 StartHashedPipelineWithMediaSource(&source); | 608 StartHashedPipelineWithMediaSource(&source); |
613 | 609 |
614 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 610 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
615 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 611 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
616 // TODO(acolwell/wolenetz): Drop the "+ 1" once WebM stream parser always | 612 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
617 // emits frames with valid durations (see http://crbug.com/351166) and | |
618 // compliant coded frame processor's "highest presentation end timestamp" is | |
619 // used to update duration (see http://crbug.com/249422). | |
620 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs + 1, | |
621 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 613 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
622 | 614 |
623 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); | 615 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); |
624 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); | 616 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); |
625 | 617 |
626 Play(); | 618 Play(); |
627 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); | 619 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
628 source.Seek(seek_time, 0x1D5, 34017); | 620 source.Seek(seek_time, 0x1D5, 34017); |
629 source.EndOfStream(); | 621 source.EndOfStream(); |
630 ASSERT_TRUE(Seek(seek_time)); | 622 ASSERT_TRUE(Seek(seek_time)); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 scoped_refptr<DecoderBuffer> second_file = | 663 scoped_refptr<DecoderBuffer> second_file = |
672 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 664 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
673 | 665 |
674 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 666 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
675 second_file->data(), second_file->data_size()); | 667 second_file->data(), second_file->data_size()); |
676 | 668 |
677 source.EndOfStream(); | 669 source.EndOfStream(); |
678 | 670 |
679 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 671 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
680 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 672 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
681 // The "+ 1" is due to estimated audio and video frame durations on the last | 673 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
682 // frames appended. The unencrypted file has a TrackEntry DefaultDuration | |
683 // field for the video track, but the encrypted file does not. | |
684 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs + 1, | |
685 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 674 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
686 | 675 |
687 Play(); | 676 Play(); |
688 | 677 |
689 EXPECT_TRUE(WaitUntilOnEnded()); | 678 EXPECT_TRUE(WaitUntilOnEnded()); |
690 source.Abort(); | 679 source.Abort(); |
691 Stop(); | 680 Stop(); |
692 } | 681 } |
693 | 682 |
694 // Config changes from encrypted to clear are not currently supported. | 683 // Config changes from encrypted to clear are not currently supported. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 ReadTestDataFile("bear-640x360.webm"); | 723 ReadTestDataFile("bear-640x360.webm"); |
735 | 724 |
736 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 725 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
737 second_file->data(), second_file->data_size()); | 726 second_file->data(), second_file->data_size()); |
738 | 727 |
739 source.EndOfStream(); | 728 source.EndOfStream(); |
740 | 729 |
741 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 730 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
742 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 731 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
743 // The second video was not added, so its time has not been added. | 732 // The second video was not added, so its time has not been added. |
744 // The "+ 1" is due to estimated audio and video frame durations on the last | 733 EXPECT_EQ(k320WebMFileDurationMs, |
745 // frames appended. The unencrypted file has a TrackEntry DefaultDuration | |
746 // field for the video track, but the encrypted file does not. | |
747 EXPECT_EQ(k320WebMFileDurationMs + 1, | |
748 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 734 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
749 | 735 |
750 Play(); | 736 Play(); |
751 | 737 |
752 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 738 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
753 source.Abort(); | 739 source.Abort(); |
754 } | 740 } |
755 | 741 |
756 #if defined(USE_PROPRIETARY_CODECS) | 742 #if defined(USE_PROPRIETARY_CODECS) |
757 TEST_P(PipelineIntegrationTest, MediaSource_ADTS) { | 743 TEST_P(PipelineIntegrationTest, MediaSource_ADTS) { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 Play(); | 1201 Play(); |
1216 ASSERT_TRUE(WaitUntilOnEnded()); | 1202 ASSERT_TRUE(WaitUntilOnEnded()); |
1217 } | 1203 } |
1218 | 1204 |
1219 // TODO(wolenetz): Enable MSE testing of new frame processor based on this flag, | 1205 // TODO(wolenetz): Enable MSE testing of new frame processor based on this flag, |
1220 // once the new processor has landed. See http://crbug.com/249422. | 1206 // once the new processor has landed. See http://crbug.com/249422. |
1221 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, | 1207 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, |
1222 Values(true)); | 1208 Values(true)); |
1223 | 1209 |
1224 } // namespace media | 1210 } // namespace media |
OLD | NEW |