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

Unified Diff: media/cdm/proxy_decryptor.cc

Issue 1224053003: Clear Key CDM should resolve the promise if session not found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes Created 5 years, 5 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
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/test/data/eme_player_js/globals.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/proxy_decryptor.cc
diff --git a/media/cdm/proxy_decryptor.cc b/media/cdm/proxy_decryptor.cc
index 28143f9fba16e26f7b58ff0792d254f1b3525bb6..321a4a2c63e94beab75fed29df6d5f6e7ddd4021 100644
--- a/media/cdm/proxy_decryptor.cc
+++ b/media/cdm/proxy_decryptor.cc
@@ -133,13 +133,14 @@ void ProxyDecryptor::GenerateKeyRequest(EmeInitDataType init_data_type,
// Returns true if |data| is prefixed with |header| and has data after the
// |header|.
-bool HasHeader(const std::vector<uint8>& data, const std::string& header) {
+static bool HasHeader(const std::vector<uint8>& data,
+ const std::string& header) {
return data.size() > header.size() &&
std::equal(header.begin(), header.end(), data.begin());
}
// Removes the first |length| items from |data|.
-void StripHeader(std::vector<uint8>& data, size_t length) {
+static void StripHeader(std::vector<uint8>& data, size_t length) {
data.erase(data.begin(), data.begin() + length);
}
@@ -391,6 +392,14 @@ void ProxyDecryptor::OnLegacySessionError(const std::string& session_id,
void ProxyDecryptor::SetSessionId(SessionCreationType session_type,
const std::string& session_id) {
+ // LoadSession() returns empty |session_id| if the session is not found, so
+ // convert this into an error.
+ if (session_type == LoadSession && session_id.empty()) {
+ OnLegacySessionError(session_id, MediaKeys::INVALID_ACCESS_ERROR, 0,
+ "Incorrect session id specified for LoadSession().");
ddorwin 2015/07/10 00:35:12 * s/Incorrect/Unknown/ or something like that. * L
+ return;
+ }
+
// Loaded sessions are considered persistent.
bool is_persistent =
session_type == PersistentSession || session_type == LoadSession;
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/test/data/eme_player_js/globals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698