Chromium Code Reviews| Index: media/cdm/aes_decryptor.cc |
| diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc |
| index bb5baa48c93c48efa9a5f02b4e7717d3121676a9..6f867e0b675f925a227c6d6875c7c1d71b6e5d52 100644 |
| --- a/media/cdm/aes_decryptor.cc |
| +++ b/media/cdm/aes_decryptor.cc |
| @@ -268,47 +268,41 @@ void AesDecryptor::CreateSessionAndGenerateRequest( |
| // TODO(jrummell): Validate |session_type|. |
| std::vector<uint8_t> message; |
| - // TODO(jrummell): Since unprefixed will never send NULL, remove this check |
|
ddorwin
2016/06/23 01:06:47
I think we could have removed this before when we
|
| - // when prefixed EME is removed (http://crbug.com/249976). |
| - if (!init_data.empty()) { |
| - std::vector<std::vector<uint8_t>> keys; |
| - switch (init_data_type) { |
| - case EmeInitDataType::WEBM: |
| - // |init_data| is simply the key needed. |
| - keys.push_back(init_data); |
| - break; |
| - case EmeInitDataType::CENC: |
| + std::vector<std::vector<uint8_t>> keys; |
| + switch (init_data_type) { |
| + case EmeInitDataType::WEBM: |
| + // |init_data| is simply the key needed. |
| + keys.push_back(init_data); |
| + break; |
| + case EmeInitDataType::CENC: |
| #if defined(USE_PROPRIETARY_CODECS) |
| - // |init_data| is a set of 0 or more concatenated 'pssh' boxes. |
| - if (!GetKeyIdsForCommonSystemId(init_data, &keys)) { |
| - promise->reject(NOT_SUPPORTED_ERROR, 0, |
| - "No supported PSSH box found."); |
| - return; |
| - } |
| - break; |
| -#else |
| - promise->reject(NOT_SUPPORTED_ERROR, 0, |
| - "Initialization data type CENC is not supported."); |
| + // |init_data| is a set of 0 or more concatenated 'pssh' boxes. |
| + if (!GetKeyIdsForCommonSystemId(init_data, &keys)) { |
| + promise->reject(NOT_SUPPORTED_ERROR, 0, "No supported PSSH box found."); |
| return; |
| -#endif |
| - case EmeInitDataType::KEYIDS: { |
| - std::string init_data_string(init_data.begin(), init_data.end()); |
| - std::string error_message; |
| - if (!ExtractKeyIdsFromKeyIdsInitData(init_data_string, &keys, |
| - &error_message)) { |
| - promise->reject(NOT_SUPPORTED_ERROR, 0, error_message); |
| - return; |
| - } |
| - break; |
| } |
| - default: |
| - NOTREACHED(); |
| - promise->reject(NOT_SUPPORTED_ERROR, 0, |
| - "init_data_type not supported."); |
| + break; |
| +#else |
| + promise->reject(NOT_SUPPORTED_ERROR, 0, |
| + "Initialization data type CENC is not supported."); |
| + return; |
| +#endif |
| + case EmeInitDataType::KEYIDS: { |
| + std::string init_data_string(init_data.begin(), init_data.end()); |
| + std::string error_message; |
| + if (!ExtractKeyIdsFromKeyIdsInitData(init_data_string, &keys, |
| + &error_message)) { |
| + promise->reject(NOT_SUPPORTED_ERROR, 0, error_message); |
| return; |
| + } |
| + break; |
| } |
| - CreateLicenseRequest(keys, session_type, &message); |
| + default: |
| + NOTREACHED(); |
| + promise->reject(NOT_SUPPORTED_ERROR, 0, "init_data_type not supported."); |
| + return; |
| } |
| + CreateLicenseRequest(keys, session_type, &message); |
| promise->resolve(session_id); |
| @@ -416,20 +410,7 @@ void AesDecryptor::CloseSession(const std::string& session_id, |
| void AesDecryptor::RemoveSession(const std::string& session_id, |
| std::unique_ptr<SimpleCdmPromise> promise) { |
| - // AesDecryptor doesn't keep any persistent data, so this should be |
| - // NOT_REACHED(). |
| - // TODO(jrummell): Make sure persistent session types are rejected. |
| - // http://crbug.com/384152. |
| - // |
| - // However, v0.1b calls to CancelKeyRequest() will call this, so close the |
| - // session, if it exists. |
| - // TODO(jrummell): Remove the close() call when prefixed EME is removed. |
| - // http://crbug.com/249976. |
| - if (valid_sessions_.find(session_id) != valid_sessions_.end()) { |
| - CloseSession(session_id, std::move(promise)); |
| - return; |
| - } |
| - |
| + NOTREACHED() << "AesDecryptor doesn't support persistent sessions."; |
| promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist."); |
| } |