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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "media/base/decoder_buffer.h" | 11 #include "media/base/decoder_buffer.h" |
12 #include "media/base/test_data_util.h" | 12 #include "media/base/test_data_util.h" |
13 #include "media/crypto/aes_decryptor.h" | 13 #include "media/crypto/aes_decryptor.h" |
14 | 14 |
15 using testing::AtMost; | 15 using testing::AtMost; |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 static const char kSourceId[] = "SourceId"; | 19 static const char kSourceId[] = "SourceId"; |
20 static const char kClearKeySystem[] = "org.w3.clearkey"; | 20 static const char kClearKeySystem[] = "org.w3.clearkey"; |
21 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 21 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
22 | 22 |
23 static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; | 23 static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; |
| 24 static const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; |
24 static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; | 25 static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; |
25 static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; | 26 static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; |
26 static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; | 27 static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; |
27 static const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; | 28 static const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; |
28 static const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 29 static const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
29 static const char kMP4AudioType[] = "audio/mp4"; | 30 static const char kMP4AudioType[] = "audio/mp4"; |
30 static const char kMP4VideoType[] = "video/mp4"; | 31 static const char kMP4VideoType[] = "video/mp4"; |
31 | 32 |
32 // Key used to encrypt test files. | 33 // Key used to encrypt test files. |
33 static const uint8 kSecretKey[] = { | 34 static const uint8 kSecretKey[] = { |
(...skipping 10 matching lines...) Expand all Loading... |
44 static const int kAppendWholeFile = -1; | 45 static const int kAppendWholeFile = -1; |
45 | 46 |
46 // Constants for the Media Source config change tests. | 47 // Constants for the Media Source config change tests. |
47 static const int kAppendTimeSec = 1; | 48 static const int kAppendTimeSec = 1; |
48 static const int kAppendTimeMs = kAppendTimeSec * 1000; | 49 static const int kAppendTimeMs = kAppendTimeSec * 1000; |
49 static const int k320WebMFileDurationMs = 2737; | 50 static const int k320WebMFileDurationMs = 2737; |
50 static const int k640WebMFileDurationMs = 2763; | 51 static const int k640WebMFileDurationMs = 2763; |
51 static const int k640IsoFileDurationMs = 2737; | 52 static const int k640IsoFileDurationMs = 2737; |
52 static const int k640IsoCencFileDurationMs = 2736; | 53 static const int k640IsoCencFileDurationMs = 2736; |
53 static const int k1280IsoFileDurationMs = 2736; | 54 static const int k1280IsoFileDurationMs = 2736; |
| 55 static const int kVP9WebMFileDurationMs = 2736; |
54 | 56 |
55 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. | 57 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. |
56 // They do not exercise the Decrypting{Audio|Video}Decoder path. | 58 // They do not exercise the Decrypting{Audio|Video}Decoder path. |
57 class FakeEncryptedMedia { | 59 class FakeEncryptedMedia { |
58 public: | 60 public: |
59 // Defines the behavior of the "app" that responds to EME events. | 61 // Defines the behavior of the "app" that responds to EME events. |
60 class AppBase { | 62 class AppBase { |
61 public: | 63 public: |
62 virtual ~AppBase() {} | 64 virtual ~AppBase() {} |
63 | 65 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 EXPECT_EQ(k320WebMFileDurationMs, | 450 EXPECT_EQ(k320WebMFileDurationMs, |
449 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 451 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
450 | 452 |
451 Play(); | 453 Play(); |
452 | 454 |
453 ASSERT_TRUE(WaitUntilOnEnded()); | 455 ASSERT_TRUE(WaitUntilOnEnded()); |
454 source.Abort(); | 456 source.Abort(); |
455 Stop(); | 457 Stop(); |
456 } | 458 } |
457 | 459 |
| 460 // TODO(tomfinegan): Enable this test when the VP9 bitstream is finalized, and |
| 461 // http://crbug.com/173333 is fixed. |
| 462 TEST_F(PipelineIntegrationTest, |
| 463 DISABLED_BasicPlayback_MediaSource_VideoOnly_VP9_WebM) { |
| 464 MockMediaSource source("bear-vp9.webm", kWebMVP9, 19324); |
| 465 StartPipelineWithMediaSource(&source); |
| 466 source.EndOfStream(); |
| 467 |
| 468 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
| 469 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
| 470 EXPECT_EQ(kVP9WebMFileDurationMs, |
| 471 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
| 472 |
| 473 Play(); |
| 474 |
| 475 ASSERT_TRUE(WaitUntilOnEnded()); |
| 476 source.Abort(); |
| 477 Stop(); |
| 478 } |
| 479 |
| 480 |
| 481 |
458 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { | 482 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
459 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 483 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
460 kAppendWholeFile); | 484 kAppendWholeFile); |
461 StartPipelineWithMediaSource(&source); | 485 StartPipelineWithMediaSource(&source); |
462 | 486 |
463 scoped_refptr<DecoderBuffer> second_file = | 487 scoped_refptr<DecoderBuffer> second_file = |
464 ReadTestDataFile("bear-640x360.webm"); | 488 ReadTestDataFile("bear-640x360.webm"); |
465 | 489 |
466 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 490 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
467 second_file->GetData(), second_file->GetDataSize()); | 491 second_file->GetData(), second_file->GetDataSize()); |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 // back. | 916 // back. |
893 // Disabled since it might crash or corrupt heap, see http://crbug.com/173333 | 917 // Disabled since it might crash or corrupt heap, see http://crbug.com/173333 |
894 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VP9_Opus_WebM) { | 918 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VP9_Opus_WebM) { |
895 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp9-opus.webm"), | 919 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp9-opus.webm"), |
896 PIPELINE_OK)); | 920 PIPELINE_OK)); |
897 Play(); | 921 Play(); |
898 ASSERT_TRUE(WaitUntilOnEnded()); | 922 ASSERT_TRUE(WaitUntilOnEnded()); |
899 } | 923 } |
900 | 924 |
901 } // namespace media | 925 } // namespace media |
OLD | NEW |