Chromium Code Reviews| Index: media/cdm/aes_decryptor.cc |
| diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc |
| index ec0de28945080a31fad28b785617525007c4758d..6f7d1da54f4db62f50c85480225bedeaf470e0f1 100644 |
| --- a/media/cdm/aes_decryptor.cc |
| +++ b/media/cdm/aes_decryptor.cc |
| @@ -242,8 +242,7 @@ AesDecryptor::~AesDecryptor() { |
| key_map_.clear(); |
| } |
| -void AesDecryptor::SetServerCertificate(const uint8* certificate_data, |
| - int certificate_data_length, |
| +void AesDecryptor::SetServerCertificate(const std::vector<uint8>& certificate, |
| scoped_ptr<SimpleCdmPromise> promise) { |
| promise->reject( |
| NOT_SUPPORTED_ERROR, 0, "SetServerCertificate() is not supported."); |
| @@ -252,8 +251,7 @@ void AesDecryptor::SetServerCertificate(const uint8* certificate_data, |
| void AesDecryptor::CreateSessionAndGenerateRequest( |
| SessionType session_type, |
| EmeInitDataType init_data_type, |
| - const uint8* init_data, |
| - int init_data_length, |
| + const std::vector<uint8>& init_data, |
| scoped_ptr<NewSessionCdmPromise> promise) { |
| std::string session_id(base::UintToString(next_session_id_++)); |
| valid_sessions_.insert(session_id); |
| @@ -264,24 +262,24 @@ void AesDecryptor::CreateSessionAndGenerateRequest( |
| std::vector<uint8> message; |
| // TODO(jrummell): Since unprefixed will never send NULL, remove this check |
| // when prefixed EME is removed (http://crbug.com/249976). |
| - if (init_data && init_data_length) { |
| + if (init_data.size() > 0) { |
|
xhwang
2015/04/21 04:47:11
!empty()
jrummell
2015/04/21 22:59:36
Done.
|
| std::vector<std::vector<uint8>> keys; |
| switch (init_data_type) { |
| case EmeInitDataType::WEBM: |
| // |init_data| is simply the key needed. |
| - keys.push_back( |
| - std::vector<uint8>(init_data, init_data + init_data_length)); |
| + keys.push_back(init_data); |
| break; |
| case EmeInitDataType::CENC: |
| // |init_data| is a set of 0 or more concatenated 'pssh' boxes. |
| - if (!GetKeyIdsForCommonSystemId(init_data, init_data_length, &keys)) { |
| + if (!GetKeyIdsForCommonSystemId(vector_as_array(&init_data), |
| + init_data.size(), &keys)) { |
|
xhwang
2015/04/21 04:47:11
Can you make GetKeyIdsForCommonSystemId() taking v
jrummell
2015/04/21 22:59:36
Done.
|
| promise->reject(NOT_SUPPORTED_ERROR, 0, |
| "No supported PSSH box found."); |
| return; |
| } |
| break; |
| case EmeInitDataType::KEYIDS: { |
| - std::string init_data_string(init_data, init_data + init_data_length); |
| + std::string init_data_string(init_data.begin(), init_data.end()); |
| std::string error_message; |
| if (!ExtractKeyIdsFromKeyIdsInitData(init_data_string, &keys, |
| &error_message)) { |
| @@ -315,11 +313,9 @@ void AesDecryptor::LoadSession(SessionType session_type, |
| } |
| void AesDecryptor::UpdateSession(const std::string& session_id, |
| - const uint8* response, |
| - int response_length, |
| + const std::vector<uint8>& response, |
| scoped_ptr<SimpleCdmPromise> promise) { |
| - CHECK(response); |
| - CHECK_GT(response_length, 0); |
| + CHECK_GT(response.size(), 0u); |
|
xhwang
2015/04/21 04:47:11
!empty()
jrummell
2015/04/21 22:59:36
Done.
|
| // TODO(jrummell): Convert back to a DCHECK once prefixed EME is removed. |
| if (valid_sessions_.find(session_id) == valid_sessions_.end()) { |
| @@ -327,8 +323,7 @@ void AesDecryptor::UpdateSession(const std::string& session_id, |
| return; |
| } |
| - std::string key_string(reinterpret_cast<const char*>(response), |
| - response_length); |
| + std::string key_string(response.begin(), response.end()); |
| KeyIdAndKeyPairs keys; |
| SessionType session_type = MediaKeys::TEMPORARY_SESSION; |