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

Unified Diff: content/renderer/media/crypto/proxy_decryptor.cc

Issue 131653003: Support LoadSession() in MediaKeys and PPP_ContentDecryptor_Private interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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: content/renderer/media/crypto/proxy_decryptor.cc
diff --git a/content/renderer/media/crypto/proxy_decryptor.cc b/content/renderer/media/crypto/proxy_decryptor.cc
index 2e1b81a3df39e32ecea75909c9b411035f1feba6..4dd64aae7e6faa455e81df283ab88b893f89a77c 100644
--- a/content/renderer/media/crypto/proxy_decryptor.cc
+++ b/content/renderer/media/crypto/proxy_decryptor.cc
@@ -83,17 +83,32 @@ bool ProxyDecryptor::InitializeCDM(const std::string& key_system,
return true;
}
-bool ProxyDecryptor::GenerateKeyRequest(const std::string& type,
+bool ProxyDecryptor::GenerateKeyRequest(const std::string& content_type,
const uint8* init_data,
int init_data_length) {
// Use a unique reference id for this request.
uint32 session_id = next_session_id_++;
- if (!media_keys_->CreateSession(
- session_id, type, init_data, init_data_length)) {
- return false;
+
+ const uint8 kPrefixedApiLoadSessionHeader[] = "LOAD_SESSION|";
+ const int kPrefixedApiLoadSessionHeaderLength =
+ sizeof(kPrefixedApiLoadSessionHeader) - 1;
dcheng 2014/02/11 23:12:25 Nit: I'd prefer strlen here. It has the benefit of
xhwang 2014/02/12 02:22:45 kPrefixedApiLoadSessionHeader is uint8 array. So t
+
+ if (init_data_length > kPrefixedApiLoadSessionHeaderLength &&
+ std::equal(init_data,
+ init_data + kPrefixedApiLoadSessionHeaderLength,
+ kPrefixedApiLoadSessionHeader)) {
+ // TODO(xhwang): Track loadable session to handle OnSessionClosed().
+ // See: http://crbug.com/340859.
+ media_keys_->LoadSession(
+ session_id,
+ std::string(reinterpret_cast<const char*>(
+ init_data + kPrefixedApiLoadSessionHeaderLength),
+ init_data_length - kPrefixedApiLoadSessionHeaderLength));
+ return true;
}
- return true;
+ return media_keys_->CreateSession(
+ session_id, content_type, init_data, init_data_length);
}
void ProxyDecryptor::AddKey(const uint8* key,
« no previous file with comments | « content/renderer/media/crypto/ppapi_decryptor.cc ('k') | content/renderer/pepper/content_decryptor_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698