Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1071)

Unified Diff: media/cdm/aes_decryptor.cc

Issue 1920433003: EME: Address TODOs related to the removal of prefixed EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update per crbug.com/616166: Remove NOTREACHED and re-enable test. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cdm/aes_decryptor.cc
diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc
index f8e12e5b3e39bee068a68b27b9dd8e0857f16d0a..f2aa2be70c8a8e18fff1e47700b8a59941cbc913 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);
@@ -423,20 +423,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;
- }
-
+ NOTIMPLEMENTED() << "Need to address https://crbug.com/616166.";
promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist.");
}
« no previous file with comments | « media/base/android/java/src/org/chromium/media/MediaDrmBridge.java ('k') | media/cdm/aes_decryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698