| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | 55 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, |
| 56 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 | 56 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 const int kAppendWholeFile = -1; | 59 const int kAppendWholeFile = -1; |
| 60 | 60 |
| 61 // Constants for the Media Source config change tests. | 61 // Constants for the Media Source config change tests. |
| 62 const int kAppendTimeSec = 1; | 62 const int kAppendTimeSec = 1; |
| 63 const int kAppendTimeMs = kAppendTimeSec * 1000; | 63 const int kAppendTimeMs = kAppendTimeSec * 1000; |
| 64 const int k320WebMFileDurationMs = 2736; | 64 const int k320WebMFileDurationMs = 2736; |
| 65 const int k640WebMFileDurationMs = 2762; | 65 const int k640WebMFileDurationMs = 2749; |
| 66 const int kOpusEndTrimmingWebMFileDurationMs = 2771; | 66 const int kOpusEndTrimmingWebMFileDurationMs = 2771; |
| 67 const int kVP9WebMFileDurationMs = 2736; | 67 const int kVP9WebMFileDurationMs = 2736; |
| 68 const int kVP8AWebMFileDurationMs = 2734; | 68 const int kVP8AWebMFileDurationMs = 2733; |
| 69 | 69 |
| 70 #if defined(USE_PROPRIETARY_CODECS) | 70 #if defined(USE_PROPRIETARY_CODECS) |
| 71 const int k640IsoFileDurationMs = 2737; | 71 const int k640IsoFileDurationMs = 2737; |
| 72 const int k640IsoCencFileDurationMs = 2736; | 72 const int k640IsoCencFileDurationMs = 2736; |
| 73 const int k1280IsoFileDurationMs = 2736; | 73 const int k1280IsoFileDurationMs = 2736; |
| 74 const int k1280IsoAVC3FileDurationMs = 2736; | 74 const int k1280IsoAVC3FileDurationMs = 2736; |
| 75 #endif // defined(USE_PROPRIETARY_CODECS) | 75 #endif // defined(USE_PROPRIETARY_CODECS) |
| 76 | 76 |
| 77 // Return a timeline offset for bear-320x240-live.webm. | 77 // Return a timeline offset for bear-320x240-live.webm. |
| 78 static base::Time kLiveTimelineOffset() { | 78 static base::Time kLiveTimelineOffset() { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 const bool use_legacy_frame_processor) | 291 const bool use_legacy_frame_processor) |
| 292 : file_path_(GetTestDataFilePath(filename)), | 292 : file_path_(GetTestDataFilePath(filename)), |
| 293 current_position_(0), | 293 current_position_(0), |
| 294 initial_append_size_(initial_append_size), | 294 initial_append_size_(initial_append_size), |
| 295 mimetype_(mimetype), | 295 mimetype_(mimetype), |
| 296 chunk_demuxer_(new ChunkDemuxer( | 296 chunk_demuxer_(new ChunkDemuxer( |
| 297 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), | 297 base::Bind(&MockMediaSource::DemuxerOpened, base::Unretained(this)), |
| 298 base::Bind(&MockMediaSource::DemuxerNeedKey, | 298 base::Bind(&MockMediaSource::DemuxerNeedKey, |
| 299 base::Unretained(this)), | 299 base::Unretained(this)), |
| 300 LogCB(), | 300 LogCB(), |
| 301 false)), | 301 true)), |
| 302 owned_chunk_demuxer_(chunk_demuxer_), | 302 owned_chunk_demuxer_(chunk_demuxer_), |
| 303 use_legacy_frame_processor_(use_legacy_frame_processor) { | 303 use_legacy_frame_processor_(use_legacy_frame_processor) { |
| 304 | 304 |
| 305 file_data_ = ReadTestDataFile(filename); | 305 file_data_ = ReadTestDataFile(filename); |
| 306 | 306 |
| 307 if (initial_append_size_ == kAppendWholeFile) | 307 if (initial_append_size_ == kAppendWholeFile) |
| 308 initial_append_size_ = file_data_->data_size(); | 308 initial_append_size_ = file_data_->data_size(); |
| 309 | 309 |
| 310 DCHECK_GT(initial_append_size_, 0); | 310 DCHECK_GT(initial_append_size_, 0); |
| 311 DCHECK_LE(initial_append_size_, file_data_->data_size()); | 311 DCHECK_LE(initial_append_size_, file_data_->data_size()); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 656 } |
| 657 | 657 |
| 658 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { | 658 TEST_P(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
| 659 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 659 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
| 660 kAppendWholeFile, GetParam()); | 660 kAppendWholeFile, GetParam()); |
| 661 StartPipelineWithMediaSource(&source); | 661 StartPipelineWithMediaSource(&source); |
| 662 source.EndOfStream(); | 662 source.EndOfStream(); |
| 663 | 663 |
| 664 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 664 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 665 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 665 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 666 // TODO(acolwell/wolenetz): Drop the "+ 1" once WebM stream parser always | 666 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
| 667 // emits frames with valid durations (see http://crbug.com/351166) and | |
| 668 // compliant coded frame processor's "highest presentation end timestamp" is | |
| 669 // used to update duration (see http://crbug.com/249422). | |
| 670 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs + 1, | |
| 671 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 667 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 672 Play(); | 668 Play(); |
| 673 | 669 |
| 674 ASSERT_TRUE(WaitUntilOnEnded()); | 670 ASSERT_TRUE(WaitUntilOnEnded()); |
| 675 source.Abort(); | 671 source.Abort(); |
| 676 Stop(); | 672 Stop(); |
| 677 } | 673 } |
| 678 | 674 |
| 679 // Flaky. http://crbug.com/304776 | 675 // Flaky. http://crbug.com/304776 |
| 680 TEST_P(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { | 676 TEST_P(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { |
| 681 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, | 677 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
| 682 kAppendWholeFile, GetParam()); | 678 kAppendWholeFile, GetParam()); |
| 683 StartHashedPipelineWithMediaSource(&source); | 679 StartHashedPipelineWithMediaSource(&source); |
| 684 | 680 |
| 685 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 681 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 686 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 682 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 687 // TODO(acolwell/wolenetz): Drop the "+ 1" once WebM stream parser always | 683 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
| 688 // emits frames with valid durations (see http://crbug.com/351166) and | |
| 689 // compliant coded frame processor's "highest presentation end timestamp" is | |
| 690 // used to update duration (see http://crbug.com/249422). | |
| 691 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs + 1, | |
| 692 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 684 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 693 | 685 |
| 694 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); | 686 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); |
| 695 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); | 687 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); |
| 696 | 688 |
| 697 Play(); | 689 Play(); |
| 698 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); | 690 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); |
| 699 source.Seek(seek_time, 0x1D5, 34017); | 691 source.Seek(seek_time, 0x1D5, 34017); |
| 700 source.EndOfStream(); | 692 source.EndOfStream(); |
| 701 ASSERT_TRUE(Seek(seek_time)); | 693 ASSERT_TRUE(Seek(seek_time)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 scoped_refptr<DecoderBuffer> second_file = | 734 scoped_refptr<DecoderBuffer> second_file = |
| 743 ReadTestDataFile("bear-640x360-av_enc-av.webm"); | 735 ReadTestDataFile("bear-640x360-av_enc-av.webm"); |
| 744 | 736 |
| 745 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 737 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 746 second_file->data(), second_file->data_size()); | 738 second_file->data(), second_file->data_size()); |
| 747 | 739 |
| 748 source.EndOfStream(); | 740 source.EndOfStream(); |
| 749 | 741 |
| 750 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 742 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 751 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 743 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 752 // The "+ 1" is due to estimated audio and video frame durations on the last | 744 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, |
| 753 // frames appended. The unencrypted file has a TrackEntry DefaultDuration | |
| 754 // field for the video track, but the encrypted file does not. | |
| 755 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs + 1, | |
| 756 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 745 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 757 | 746 |
| 758 Play(); | 747 Play(); |
| 759 | 748 |
| 760 EXPECT_TRUE(WaitUntilOnEnded()); | 749 EXPECT_TRUE(WaitUntilOnEnded()); |
| 761 source.Abort(); | 750 source.Abort(); |
| 762 Stop(); | 751 Stop(); |
| 763 } | 752 } |
| 764 | 753 |
| 765 // Config changes from encrypted to clear are not currently supported. | 754 // Config changes from encrypted to clear are not currently supported. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 ReadTestDataFile("bear-640x360.webm"); | 794 ReadTestDataFile("bear-640x360.webm"); |
| 806 | 795 |
| 807 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 796 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 808 second_file->data(), second_file->data_size()); | 797 second_file->data(), second_file->data_size()); |
| 809 | 798 |
| 810 source.EndOfStream(); | 799 source.EndOfStream(); |
| 811 | 800 |
| 812 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 801 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 813 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 802 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 814 // The second video was not added, so its time has not been added. | 803 // The second video was not added, so its time has not been added. |
| 815 // The "+ 1" is due to estimated audio and video frame durations on the last | 804 EXPECT_EQ(k320WebMFileDurationMs, |
| 816 // frames appended. The unencrypted file has a TrackEntry DefaultDuration | |
| 817 // field for the video track, but the encrypted file does not. | |
| 818 EXPECT_EQ(k320WebMFileDurationMs + 1, | |
| 819 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 805 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 820 | 806 |
| 821 Play(); | 807 Play(); |
| 822 | 808 |
| 823 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 809 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
| 824 source.Abort(); | 810 source.Abort(); |
| 825 } | 811 } |
| 826 | 812 |
| 827 #if defined(USE_PROPRIETARY_CODECS) | 813 #if defined(USE_PROPRIETARY_CODECS) |
| 828 TEST_P(PipelineIntegrationTest, MediaSource_ADTS) { | 814 TEST_P(PipelineIntegrationTest, MediaSource_ADTS) { |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 Play(); | 1270 Play(); |
| 1285 ASSERT_TRUE(WaitUntilOnEnded()); | 1271 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1286 } | 1272 } |
| 1287 | 1273 |
| 1288 // TODO(wolenetz): Enable MSE testing of new frame processor based on this flag, | 1274 // TODO(wolenetz): Enable MSE testing of new frame processor based on this flag, |
| 1289 // once the new processor has landed. See http://crbug.com/249422. | 1275 // once the new processor has landed. See http://crbug.com/249422. |
| 1290 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, | 1276 INSTANTIATE_TEST_CASE_P(LegacyFrameProcessor, PipelineIntegrationTest, |
| 1291 Values(true)); | 1277 Values(true)); |
| 1292 | 1278 |
| 1293 } // namespace media | 1279 } // namespace media |
| OLD | NEW |