| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = 2736; | 62 const int k320WebMFileDurationMs = 2736; |
| 63 const int k640WebMFileDurationMs = 2762; | 63 const int k640WebMFileDurationMs = 2749; |
| 64 const int kOpusEndTrimmingWebMFileDurationMs = 2771; | 64 const int kOpusEndTrimmingWebMFileDurationMs = 2771; |
| 65 const int kVP9WebMFileDurationMs = 2736; | 65 const int kVP9WebMFileDurationMs = 2736; |
| 66 const int kVP8AWebMFileDurationMs = 2734; | 66 const int kVP8AWebMFileDurationMs = 2733; |
| 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 = 2736; | 72 const int k1280IsoAVC3FileDurationMs = 2736; |
| 73 #endif // defined(USE_PROPRIETARY_CODECS) | 73 #endif // defined(USE_PROPRIETARY_CODECS) |
| 74 | 74 |
| 75 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 75 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
| 76 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 76 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 int initial_append_size) | 257 int initial_append_size) |
| 258 : file_path_(GetTestDataFilePath(filename)), | 258 : file_path_(GetTestDataFilePath(filename)), |
| 259 current_position_(0), | 259 current_position_(0), |
| 260 initial_append_size_(initial_append_size), | 260 initial_append_size_(initial_append_size), |
| 261 mimetype_(mimetype), | 261 mimetype_(mimetype), |
| 262 chunk_demuxer_(new ChunkDemuxer( | 262 chunk_demuxer_(new ChunkDemuxer( |
| 263 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), | 263 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), |
| 264 base::Bind(&MockMediaSource::DemuxerNeedKey, | 264 base::Bind(&MockMediaSource::DemuxerNeedKey, |
| 265 base::Unretained(this)), | 265 base::Unretained(this)), |
| 266 LogCB(), | 266 LogCB(), |
| 267 false)), | 267 true)), |
| 268 owned_chunk_demuxer_(chunk_demuxer_) { | 268 owned_chunk_demuxer_(chunk_demuxer_) { |
| 269 | 269 |
| 270 file_data_ = ReadTestDataFile(filename); | 270 file_data_ = ReadTestDataFile(filename); |
| 271 | 271 |
| 272 if (initial_append_size_ == kAppendWholeFile) | 272 if (initial_append_size_ == kAppendWholeFile) |
| 273 initial_append_size_ = file_data_->data_size(); | 273 initial_append_size_ = file_data_->data_size(); |
| 274 | 274 |
| 275 DCHECK_GT(initial_append_size_, 0); | 275 DCHECK_GT(initial_append_size_, 0); |
| 276 DCHECK_LE(initial_append_size_, file_data_->data_size()); | 276 DCHECK_LE(initial_append_size_, file_data_->data_size()); |
| 277 } | 277 } |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { | 569 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
| 570 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); | 570 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); |
| 571 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 571 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
| 572 kAppendWholeFile); | 572 kAppendWholeFile); |
| 573 StartPipelineWithMediaSource(&source); | 573 StartPipelineWithMediaSource(&source); |
| 574 source.EndOfStream(); | 574 source.EndOfStream(); |
| 575 | 575 |
| 576 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 576 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 577 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 577 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 578 // TODO(acolwell/wolenetz): Drop the "+ 1" once WebM stream parser always | 578 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
| 579 // emits frames with valid durations (see http://crbug.com/351166) and | |
| 580 // compliant coded frame processor's "highest presentation end timestamp" is | |
| 581 // used to update duration (see http://crbug.com/249422). | |
| 582 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs + 1, | |
| 583 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 579 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 584 Play(); | 580 Play(); |
| 585 | 581 |
| 586 ASSERT_TRUE(WaitUntilOnEnded()); | 582 ASSERT_TRUE(WaitUntilOnEnded()); |
| 587 source.Abort(); | 583 source.Abort(); |
| 588 Stop(); | 584 Stop(); |
| 589 } | 585 } |
| 590 | 586 |
| 591 // Flaky. http://crbug.com/304776 | 587 // Flaky. http://crbug.com/304776 |
| 592 TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { | 588 TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
| 593 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); | 589 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); |
| 594 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 590 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
| 595 kAppendWholeFile); | 591 kAppendWholeFile); |
| 596 StartHashedPipelineWithMediaSource(&source); | 592 StartHashedPipelineWithMediaSource(&source); |
| 597 | 593 |
| 598 | 594 |
| 599 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 595 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 600 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 596 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 601 // TODO(acolwell/wolenetz): Drop the "+ 1" once WebM stream parser always | 597 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
| 602 // emits frames with valid durations (see http://crbug.com/351166) and | |
| 603 // compliant coded frame processor's "highest presentation end timestamp" is | |
| 604 // used to update duration (see http://crbug.com/249422). | |
| 605 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs + 1, | |
| 606 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 598 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 607 | 599 |
| 608 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); | 600 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); |
| 609 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); | 601 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); |
| 610 | 602 |
| 611 Play(); | 603 Play(); |
| 612 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); | 604 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
| 613 source.Seek(seek_time, 0x1D5, 34017); | 605 source.Seek(seek_time, 0x1D5, 34017); |
| 614 source.EndOfStream(); | 606 source.EndOfStream(); |
| 615 ASSERT_TRUE(Seek(seek_time)); | 607 ASSERT_TRUE(Seek(seek_time)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 scoped_refptr<DecoderBuffer> second_file = | 648 scoped_refptr<DecoderBuffer> second_file = |
| 657 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 649 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
| 658 | 650 |
| 659 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 651 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 660 second_file->data(), second_file->data_size()); | 652 second_file->data(), second_file->data_size()); |
| 661 | 653 |
| 662 source.EndOfStream(); | 654 source.EndOfStream(); |
| 663 | 655 |
| 664 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 656 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 665 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 657 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 666 // The "+ 1" is due to estimated audio and video frame durations on the last | 658 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
| 667 // frames appended. The unencrypted file has a TrackEntry DefaultDuration | |
| 668 // field for the video track, but the encrypted file does not. | |
| 669 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs + 1, | |
| 670 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 659 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 671 | 660 |
| 672 Play(); | 661 Play(); |
| 673 | 662 |
| 674 EXPECT_TRUE(WaitUntilOnEnded()); | 663 EXPECT_TRUE(WaitUntilOnEnded()); |
| 675 source.Abort(); | 664 source.Abort(); |
| 676 Stop(); | 665 Stop(); |
| 677 } | 666 } |
| 678 | 667 |
| 679 // Config changes from encrypted to clear are not currently supported. | 668 // Config changes from encrypted to clear are not currently supported. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 ReadTestDataFile("bear-640x360.webm"); | 708 ReadTestDataFile("bear-640x360.webm"); |
| 720 | 709 |
| 721 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 710 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 722 second_file->data(), second_file->data_size()); | 711 second_file->data(), second_file->data_size()); |
| 723 | 712 |
| 724 source.EndOfStream(); | 713 source.EndOfStream(); |
| 725 | 714 |
| 726 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 715 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 727 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 716 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 728 // The second video was not added, so its time has not been added. | 717 // The second video was not added, so its time has not been added. |
| 729 // The "+ 1" is due to estimated audio and video frame durations on the last | 718 EXPECT_EQ(k320WebMFileDurationMs, |
| 730 // frames appended. The unencrypted file has a TrackEntry DefaultDuration | |
| 731 // field for the video track, but the encrypted file does not. | |
| 732 EXPECT_EQ(k320WebMFileDurationMs + 1, | |
| 733 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 719 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 734 | 720 |
| 735 Play(); | 721 Play(); |
| 736 | 722 |
| 737 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 723 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
| 738 source.Abort(); | 724 source.Abort(); |
| 739 } | 725 } |
| 740 | 726 |
| 741 #if defined(USE_PROPRIETARY_CODECS) | 727 #if defined(USE_PROPRIETARY_CODECS) |
| 742 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { | 728 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 // Verify that VP8 video with inband text track can be played back. | 1183 // Verify that VP8 video with inband text track can be played back. |
| 1198 TEST_F(PipelineIntegrationTest, | 1184 TEST_F(PipelineIntegrationTest, |
| 1199 BasicPlayback_VP8_WebVTT_WebM) { | 1185 BasicPlayback_VP8_WebVTT_WebM) { |
| 1200 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), | 1186 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
| 1201 PIPELINE_OK)); | 1187 PIPELINE_OK)); |
| 1202 Play(); | 1188 Play(); |
| 1203 ASSERT_TRUE(WaitUntilOnEnded()); | 1189 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1204 } | 1190 } |
| 1205 | 1191 |
| 1206 } // namespace media | 1192 } // namespace media |
| OLD | NEW |