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