| Index: media/cdm/aes_decryptor.cc
|
| diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc
|
| index bb5baa48c93c48efa9a5f02b4e7717d3121676a9..8c909e3a2d954777462c661d8b0352beb84f5f87 100644
|
| --- a/media/cdm/aes_decryptor.cc
|
| +++ b/media/cdm/aes_decryptor.cc
|
| @@ -20,6 +20,7 @@
|
| #include "media/base/cdm_promise.h"
|
| #include "media/base/decoder_buffer.h"
|
| #include "media/base/decrypt_config.h"
|
| +#include "media/base/limits.h"
|
| #include "media/base/video_decoder_config.h"
|
| #include "media/base/video_frame.h"
|
| #include "media/cdm/json_web_key.h"
|
| @@ -268,47 +269,46 @@ void AesDecryptor::CreateSessionAndGenerateRequest(
|
| // TODO(jrummell): Validate |session_type|.
|
|
|
| std::vector<uint8_t> message;
|
| - // TODO(jrummell): Since unprefixed will never send NULL, remove this check
|
| - // 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.
|
| + if (init_data.size() < limits::kMinKeyIdLength ||
|
| + init_data.size() > limits::kMaxKeyIdLength) {
|
| + promise->reject(NOT_SUPPORTED_ERROR, 0, "Incorrect length");
|
| + return;
|
| + }
|
| + 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 +416,8 @@ 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;
|
| - }
|
| -
|
| + // See https://crbug.com/416194.
|
| + NOTREACHED() << "AesDecryptor doesn't support persistent sessions.";
|
| promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist.");
|
| }
|
|
|
|
|