Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/cdm/ppapi/external_clear_key/clear_key_cdm.h" | 5 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 const char kExternalClearKeyRenewalKeySystem[] = | 65 const char kExternalClearKeyRenewalKeySystem[] = |
| 66 "org.chromium.externalclearkey.renewal"; | 66 "org.chromium.externalclearkey.renewal"; |
| 67 const char kExternalClearKeyFileIOTestKeySystem[] = | 67 const char kExternalClearKeyFileIOTestKeySystem[] = |
| 68 "org.chromium.externalclearkey.fileiotest"; | 68 "org.chromium.externalclearkey.fileiotest"; |
| 69 const char kExternalClearKeyOutputProtectionTestKeySystem[] = | 69 const char kExternalClearKeyOutputProtectionTestKeySystem[] = |
| 70 "org.chromium.externalclearkey.outputprotectiontest"; | 70 "org.chromium.externalclearkey.outputprotectiontest"; |
| 71 const char kExternalClearKeyPlatformVerificationTestKeySystem[] = | 71 const char kExternalClearKeyPlatformVerificationTestKeySystem[] = |
| 72 "org.chromium.externalclearkey.platformverificationtest"; | 72 "org.chromium.externalclearkey.platformverificationtest"; |
| 73 const char kExternalClearKeyCrashKeySystem[] = | 73 const char kExternalClearKeyCrashKeySystem[] = |
| 74 "org.chromium.externalclearkey.crash"; | 74 "org.chromium.externalclearkey.crash"; |
| 75 const char kExternalClearKeyCloseOnCrashKeySystem[] = | |
| 76 "org.chromium.externalclearkey.closeoncrash"; | |
| 75 | 77 |
| 76 // Constants for the enumalted session that can be loaded by LoadSession(). | 78 // Constants for the enumalted session that can be loaded by LoadSession(). |
| 77 // These constants need to be in sync with | 79 // These constants need to be in sync with |
| 78 // chrome/test/data/media/encrypted_media_utils.js | 80 // chrome/test/data/media/encrypted_media_utils.js |
| 79 const char kLoadableSessionId[] = "LoadableSession"; | 81 const char kLoadableSessionId[] = "LoadableSession"; |
| 80 const uint8_t kLoadableSessionKeyId[] = "0123456789012345"; | 82 const uint8_t kLoadableSessionKeyId[] = "0123456789012345"; |
| 81 const uint8_t kLoadableSessionKey[] = {0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, | 83 const uint8_t kLoadableSessionKey[] = {0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, |
| 82 0xd2, 0x7b, 0x68, 0xef, 0x12, 0x2a, | 84 0xd2, 0x7b, 0x68, 0xef, 0x12, 0x2a, |
| 83 0xfc, 0xe4, 0xae, 0x3c}; | 85 0xfc, 0xe4, 0xae, 0x3c}; |
| 84 | 86 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 void* user_data) { | 237 void* user_data) { |
| 236 DVLOG(1) << "CreateCdmInstance()"; | 238 DVLOG(1) << "CreateCdmInstance()"; |
| 237 | 239 |
| 238 std::string key_system_string(key_system, key_system_size); | 240 std::string key_system_string(key_system, key_system_size); |
| 239 if (key_system_string != kExternalClearKeyKeySystem && | 241 if (key_system_string != kExternalClearKeyKeySystem && |
| 240 key_system_string != kExternalClearKeyDecryptOnlyKeySystem && | 242 key_system_string != kExternalClearKeyDecryptOnlyKeySystem && |
| 241 key_system_string != kExternalClearKeyRenewalKeySystem && | 243 key_system_string != kExternalClearKeyRenewalKeySystem && |
| 242 key_system_string != kExternalClearKeyFileIOTestKeySystem && | 244 key_system_string != kExternalClearKeyFileIOTestKeySystem && |
| 243 key_system_string != kExternalClearKeyOutputProtectionTestKeySystem && | 245 key_system_string != kExternalClearKeyOutputProtectionTestKeySystem && |
| 244 key_system_string != kExternalClearKeyPlatformVerificationTestKeySystem && | 246 key_system_string != kExternalClearKeyPlatformVerificationTestKeySystem && |
| 245 key_system_string != kExternalClearKeyCrashKeySystem) { | 247 key_system_string != kExternalClearKeyCrashKeySystem && |
| 248 key_system_string != kExternalClearKeyCloseOnCrashKeySystem) { | |
|
xhwang
2016/11/04 22:37:40
Last time when I was here I thought maybe we shoul
jrummell
2016/11/07 22:03:47
No longer adding a key system so this is reverted
| |
| 246 DVLOG(1) << "Unsupported key system:" << key_system_string; | 249 DVLOG(1) << "Unsupported key system:" << key_system_string; |
| 247 return NULL; | 250 return NULL; |
| 248 } | 251 } |
| 249 | 252 |
| 250 if (cdm_interface_version != media::ClearKeyCdmInterface::kVersion) | 253 if (cdm_interface_version != media::ClearKeyCdmInterface::kVersion) |
| 251 return NULL; | 254 return NULL; |
| 252 | 255 |
| 253 media::ClearKeyCdmHost* host = static_cast<media::ClearKeyCdmHost*>( | 256 media::ClearKeyCdmHost* host = static_cast<media::ClearKeyCdmHost*>( |
| 254 get_cdm_host_func(media::ClearKeyCdmHost::kVersion, user_data)); | 257 get_cdm_host_func(media::ClearKeyCdmHost::kVersion, user_data)); |
| 255 if (!host) | 258 if (!host) |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 | 618 |
| 616 return video_decoder_->DecodeFrame(data, size, timestamp, decoded_frame); | 619 return video_decoder_->DecodeFrame(data, size, timestamp, decoded_frame); |
| 617 } | 620 } |
| 618 | 621 |
| 619 cdm::Status ClearKeyCdm::DecryptAndDecodeSamples( | 622 cdm::Status ClearKeyCdm::DecryptAndDecodeSamples( |
| 620 const cdm::InputBuffer& encrypted_buffer, | 623 const cdm::InputBuffer& encrypted_buffer, |
| 621 cdm::AudioFrames* audio_frames) { | 624 cdm::AudioFrames* audio_frames) { |
| 622 DVLOG(1) << "DecryptAndDecodeSamples()"; | 625 DVLOG(1) << "DecryptAndDecodeSamples()"; |
| 623 | 626 |
| 624 // Trigger a crash on purpose for testing purpose. | 627 // Trigger a crash on purpose for testing purpose. |
| 625 if (key_system_ == kExternalClearKeyCrashKeySystem) | 628 if (key_system_ == kExternalClearKeyCrashKeySystem || |
| 629 key_system_ == kExternalClearKeyCloseOnCrashKeySystem) | |
|
xhwang
2016/11/04 22:37:40
It seems odd that two tests execute exactly the sa
jrummell
2016/11/07 22:03:47
Done.
| |
| 626 CHECK(false); | 630 CHECK(false); |
| 627 | 631 |
| 628 scoped_refptr<media::DecoderBuffer> buffer; | 632 scoped_refptr<media::DecoderBuffer> buffer; |
| 629 cdm::Status status = DecryptToMediaDecoderBuffer(encrypted_buffer, &buffer); | 633 cdm::Status status = DecryptToMediaDecoderBuffer(encrypted_buffer, &buffer); |
| 630 | 634 |
| 631 if (status != cdm::kSuccess) | 635 if (status != cdm::kSuccess) |
| 632 return status; | 636 return status; |
| 633 | 637 |
| 634 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) | 638 #if defined(CLEAR_KEY_CDM_USE_FFMPEG_DECODER) |
| 635 const uint8_t* data = NULL; | 639 const uint8_t* data = NULL; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 983 is_running_platform_verification_test_ = true; | 987 is_running_platform_verification_test_ = true; |
| 984 | 988 |
| 985 std::string service_id = "test_service_id"; | 989 std::string service_id = "test_service_id"; |
| 986 std::string challenge = "test_challenge"; | 990 std::string challenge = "test_challenge"; |
| 987 | 991 |
| 988 host_->SendPlatformChallenge(service_id.data(), service_id.size(), | 992 host_->SendPlatformChallenge(service_id.data(), service_id.size(), |
| 989 challenge.data(), challenge.size()); | 993 challenge.data(), challenge.size()); |
| 990 } | 994 } |
| 991 | 995 |
| 992 } // namespace media | 996 } // namespace media |
| OLD | NEW |