| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 static const char kSourceId[] = "SourceId"; | 24 static const char kSourceId[] = "SourceId"; |
| 25 static const char kClearKeySystem[] = "org.w3.clearkey"; | 25 static const char kClearKeySystem[] = "org.w3.clearkey"; |
| 26 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 26 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
| 27 | 27 |
| 28 static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; | 28 static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; |
| 29 static const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; | 29 static const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; |
| 30 static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; | 30 static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; |
| 31 static const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; |
| 31 static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; | 32 static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; |
| 32 static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; | 33 static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; |
| 33 static const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; | 34 static const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; |
| 34 static const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 35 static const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
| 35 static const char kMP4AudioType[] = "audio/mp4"; | 36 static const char kMP4AudioType[] = "audio/mp4"; |
| 36 static const char kMP4VideoType[] = "video/mp4"; | 37 static const char kMP4VideoType[] = "video/mp4"; |
| 37 static const char kMP3[] = "audio/mpeg"; | 38 static const char kMP3[] = "audio/mpeg"; |
| 38 | 39 |
| 39 // Key used to encrypt test files. | 40 // Key used to encrypt test files. |
| 40 static const uint8 kSecretKey[] = { | 41 static const uint8 kSecretKey[] = { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 static const int kAppendWholeFile = -1; | 52 static const int kAppendWholeFile = -1; |
| 52 | 53 |
| 53 // Constants for the Media Source config change tests. | 54 // Constants for the Media Source config change tests. |
| 54 static const int kAppendTimeSec = 1; | 55 static const int kAppendTimeSec = 1; |
| 55 static const int kAppendTimeMs = kAppendTimeSec * 1000; | 56 static const int kAppendTimeMs = kAppendTimeSec * 1000; |
| 56 static const int k320WebMFileDurationMs = 2737; | 57 static const int k320WebMFileDurationMs = 2737; |
| 57 static const int k640WebMFileDurationMs = 2763; | 58 static const int k640WebMFileDurationMs = 2763; |
| 58 static const int k640IsoFileDurationMs = 2737; | 59 static const int k640IsoFileDurationMs = 2737; |
| 59 static const int k640IsoCencFileDurationMs = 2736; | 60 static const int k640IsoCencFileDurationMs = 2736; |
| 60 static const int k1280IsoFileDurationMs = 2736; | 61 static const int k1280IsoFileDurationMs = 2736; |
| 62 static const int kOpusEndTrimmingWebMFileDurationMs = 2771; |
| 63 static const uint32 kOpusEndTrimmingWebMFileAudioBytes = 528676; |
| 61 static const int kVP9WebMFileDurationMs = 2735; | 64 static const int kVP9WebMFileDurationMs = 2735; |
| 62 static const int kVP8AWebMFileDurationMs = 2700; | 65 static const int kVP8AWebMFileDurationMs = 2700; |
| 63 | 66 |
| 64 // Command line switch for runtime adjustment of audio file to be benchmarked. | 67 // Command line switch for runtime adjustment of audio file to be benchmarked. |
| 65 static const char kBenchmarkAudioFile[] = "benchmark-audio-file"; | 68 static const char kBenchmarkAudioFile[] = "benchmark-audio-file"; |
| 66 | 69 |
| 67 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 70 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
| 68 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 71 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
| 69 class FakeEncryptedMedia { | 72 class FakeEncryptedMedia { |
| 70 public: | 73 public: |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 EXPECT_EQ(kVP8AWebMFileDurationMs, | 530 EXPECT_EQ(kVP8AWebMFileDurationMs, |
| 528 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 531 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 529 | 532 |
| 530 Play(); | 533 Play(); |
| 531 | 534 |
| 532 ASSERT_TRUE(WaitUntilOnEnded()); | 535 ASSERT_TRUE(WaitUntilOnEnded()); |
| 533 source.Abort(); | 536 source.Abort(); |
| 534 Stop(); | 537 Stop(); |
| 535 } | 538 } |
| 536 | 539 |
| 540 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { |
| 541 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber()); |
| 542 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, |
| 543 kAppendWholeFile); |
| 544 StartPipelineWithMediaSource(&source); |
| 545 source.EndOfStream(); |
| 546 |
| 547 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 548 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 549 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, |
| 550 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 551 Play(); |
| 552 |
| 553 ASSERT_TRUE(WaitUntilOnEnded()); |
| 554 EXPECT_EQ(kOpusEndTrimmingWebMFileAudioBytes, |
| 555 pipeline_->GetStatistics().audio_bytes_decoded); |
| 556 source.Abort(); |
| 557 Stop(); |
| 558 } |
| 559 |
| 537 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { | 560 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
| 538 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 561 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
| 539 kAppendWholeFile); | 562 kAppendWholeFile); |
| 540 StartPipelineWithMediaSource(&source); | 563 StartPipelineWithMediaSource(&source); |
| 541 | 564 |
| 542 scoped_refptr<DecoderBuffer> second_file = | 565 scoped_refptr<DecoderBuffer> second_file = |
| 543 ReadTestDataFile("bear-640x360.webm"); | 566 ReadTestDataFile("bear-640x360.webm"); |
| 544 | 567 |
| 545 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 568 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 546 second_file->data(), second_file->data_size()); | 569 second_file->data(), second_file->data_size()); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 | 1035 |
| 1013 // Verify that VP8 video with inband text track can be played back. | 1036 // Verify that VP8 video with inband text track can be played back. |
| 1014 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { | 1037 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { |
| 1015 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), | 1038 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), |
| 1016 PIPELINE_OK)); | 1039 PIPELINE_OK)); |
| 1017 Play(); | 1040 Play(); |
| 1018 ASSERT_TRUE(WaitUntilOnEnded()); | 1041 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1019 } | 1042 } |
| 1020 | 1043 |
| 1021 } // namespace media | 1044 } // namespace media |
| OLD | NEW |