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; |