Chromium Code Reviews| 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\""; | |
|
Tom Finegan
2013/04/04 22:09:57
Should I use VP9 here (to be consistent with test
acolwell GONE FROM CHROMIUM
2013/04/04 22:49:28
I'd prefer VP9 here and below. I feel it's equival
Tom Finegan
2013/04/05 03:35:06
Done.
| |
| 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; | |
|
Tom Finegan
2013/04/04 22:09:57
Ditto.
Tom Finegan
2013/04/05 03:35:06
Done.
| |
| 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. | |
|
Tom Finegan
2013/04/04 22:09:57
This is really about crbug.com/173333
Should I up
acolwell GONE FROM CHROMIUM
2013/04/04 22:49:28
Please update the comment to point to the bug.
Tom Finegan
2013/04/05 03:35:06
Done.
| |
| 461 TEST_F(PipelineIntegrationTest, | |
| 462 DISABLED_BasicPlayback_MediaSource_VideoOnly_VP9_WebM) { | |
| 463 MockMediaSource source("bear-vp9.webm", kWebMVp9, 19324); | |
| 464 StartPipelineWithMediaSource(&source); | |
| 465 source.EndOfStream(); | |
| 466 | |
| 467 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | |
| 468 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | |
| 469 EXPECT_EQ(kVp9WebMFileDurationMs, | |
| 470 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | |
| 471 | |
| 472 Play(); | |
| 473 | |
| 474 ASSERT_TRUE(WaitUntilOnEnded()); | |
| 475 source.Abort(); | |
| 476 Stop(); | |
| 477 } | |
| 478 | |
| 479 | |
| 480 | |
| 458 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { | 481 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { |
| 459 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, | 482 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, |
| 460 kAppendWholeFile); | 483 kAppendWholeFile); |
| 461 StartPipelineWithMediaSource(&source); | 484 StartPipelineWithMediaSource(&source); |
| 462 | 485 |
| 463 scoped_refptr<DecoderBuffer> second_file = | 486 scoped_refptr<DecoderBuffer> second_file = |
| 464 ReadTestDataFile("bear-640x360.webm"); | 487 ReadTestDataFile("bear-640x360.webm"); |
| 465 | 488 |
| 466 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), | 489 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), |
| 467 second_file->GetData(), second_file->GetDataSize()); | 490 second_file->GetData(), second_file->GetDataSize()); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 892 // back. | 915 // back. |
| 893 // Disabled since it might crash or corrupt heap, see http://crbug.com/173333 | 916 // Disabled since it might crash or corrupt heap, see http://crbug.com/173333 |
| 894 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VP9_Opus_WebM) { | 917 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VP9_Opus_WebM) { |
| 895 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp9-opus.webm"), | 918 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp9-opus.webm"), |
| 896 PIPELINE_OK)); | 919 PIPELINE_OK)); |
| 897 Play(); | 920 Play(); |
| 898 ASSERT_TRUE(WaitUntilOnEnded()); | 921 ASSERT_TRUE(WaitUntilOnEnded()); |
| 899 } | 922 } |
| 900 | 923 |
| 901 } // namespace media | 924 } // namespace media |
| OLD | NEW |