| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 using testing::_; | 23 using testing::_; |
| 24 using testing::AnyNumber; | 24 using testing::AnyNumber; |
| 25 using testing::AtLeast; | 25 using testing::AtLeast; |
| 26 using testing::AtMost; | 26 using testing::AtMost; |
| 27 using testing::SaveArg; | 27 using testing::SaveArg; |
| 28 | 28 |
| 29 namespace media { | 29 namespace media { |
| 30 | 30 |
| 31 const char kSourceId[] = "SourceId"; | 31 const char kSourceId[] = "SourceId"; |
| 32 const char kCencInitDataType[] = "cenc"; | |
| 33 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 32 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
| 34 | 33 |
| 35 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; | 34 const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; |
| 36 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; | 35 const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; |
| 37 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; | 36 const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; |
| 38 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; | 37 const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\""; |
| 39 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; | 38 const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; |
| 39 const char kMP4VideoType[] = "video/mp4"; |
| 40 const char kMP4AudioType[] = "audio/mp4"; |
| 40 #if defined(USE_PROPRIETARY_CODECS) | 41 #if defined(USE_PROPRIETARY_CODECS) |
| 41 const char kADTS[] = "audio/aac"; | 42 const char kADTS[] = "audio/aac"; |
| 42 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; | 43 const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; |
| 43 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; | 44 const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; |
| 44 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\""; | 45 const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\""; |
| 45 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 46 const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
| 46 const char kMP3[] = "audio/mpeg"; | 47 const char kMP3[] = "audio/mpeg"; |
| 47 #endif // defined(USE_PROPRIETARY_CODECS) | 48 #endif // defined(USE_PROPRIETARY_CODECS) |
| 48 | 49 |
| 49 // Key used to encrypt test files. | 50 // Key used to encrypt test files. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 MediaKeys::TEMPORARY_SESSION, | 260 MediaKeys::TEMPORARY_SESSION, |
| 260 CreateSessionPromise(RESOLVED)); | 261 CreateSessionPromise(RESOLVED)); |
| 261 EXPECT_FALSE(current_session_id_.empty()); | 262 EXPECT_FALSE(current_session_id_.empty()); |
| 262 } | 263 } |
| 263 | 264 |
| 264 // Clear Key really needs the key ID in |init_data|. For WebM, they are the | 265 // Clear Key really needs the key ID in |init_data|. For WebM, they are the |
| 265 // same, but this is not the case for ISO CENC. Therefore, provide the | 266 // same, but this is not the case for ISO CENC. Therefore, provide the |
| 266 // correct key ID. | 267 // correct key ID. |
| 267 const uint8* key_id = init_data.empty() ? NULL : &init_data[0]; | 268 const uint8* key_id = init_data.empty() ? NULL : &init_data[0]; |
| 268 size_t key_id_length = init_data.size(); | 269 size_t key_id_length = init_data.size(); |
| 269 if (type == kCencInitDataType) { | 270 if (type == kMP4AudioType || type == kMP4VideoType) { |
| 270 key_id = kKeyId; | 271 key_id = kKeyId; |
| 271 key_id_length = arraysize(kKeyId); | 272 key_id_length = arraysize(kKeyId); |
| 272 } | 273 } |
| 273 | 274 |
| 274 // Convert key into a JSON structure and then add it. | 275 // Convert key into a JSON structure and then add it. |
| 275 std::string jwk = GenerateJWKSet( | 276 std::string jwk = GenerateJWKSet( |
| 276 kSecretKey, arraysize(kSecretKey), key_id, key_id_length); | 277 kSecretKey, arraysize(kSecretKey), key_id, key_id_length); |
| 277 decryptor->UpdateSession(current_session_id_, | 278 decryptor->UpdateSession(current_session_id_, |
| 278 reinterpret_cast<const uint8*>(jwk.data()), | 279 reinterpret_cast<const uint8*>(jwk.data()), |
| 279 jwk.size(), | 280 jwk.size(), |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { | 1608 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { |
| 1608 ASSERT_TRUE( | 1609 ASSERT_TRUE( |
| 1609 Start(GetTestDataFilePath("nonzero-start-time.webm"), PIPELINE_OK)); | 1610 Start(GetTestDataFilePath("nonzero-start-time.webm"), PIPELINE_OK)); |
| 1610 Play(); | 1611 Play(); |
| 1611 ASSERT_TRUE(WaitUntilOnEnded()); | 1612 ASSERT_TRUE(WaitUntilOnEnded()); |
| 1612 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), | 1613 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), |
| 1613 demuxer_->GetStartTime()); | 1614 demuxer_->GetStartTime()); |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 } // namespace media | 1617 } // namespace media |
| OLD | NEW |