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

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: simplify prefixed 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
Index: media/cdm/proxy_decryptor.cc
diff --git a/media/cdm/proxy_decryptor.cc b/media/cdm/proxy_decryptor.cc
index 28143f9fba16e26f7b58ff0792d254f1b3525bb6..8093da2fcc27345a219e2db989a36f49c554370b 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,13 @@ void ProxyDecryptor::OnLegacySessionError(const std::string& session_id,
void ProxyDecryptor::SetSessionId(SessionCreationType session_type,
const std::string& session_id) {
+ // Load() returns empty |session_id| if the session is not found, so
ddorwin 2015/07/09 00:29:35 LoadSession
jrummell 2015/07/10 00:16:49 Done.
+ // convert this into an error.
+ if (session_type == LoadSession && session_id.empty()) {
+ key_error_cb_.Run(session_id, MediaKeys::kUnknownError, 0);
ddorwin 2015/07/09 00:29:35 Should we call OnLegacySessionError() for consiste
jrummell 2015/07/10 00:16:49 Sure. then it matches what was previously returned
+ return;
+ }
+
// Loaded sessions are considered persistent.
bool is_persistent =
session_type == PersistentSession || session_type == LoadSession;

Powered by Google App Engine
This is Rietveld 408576698