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..4711a042dd29fd070a6708a46e21d9881aeab642 100644 |
--- a/content/renderer/media/crypto/proxy_decryptor.cc |
+++ b/content/renderer/media/crypto/proxy_decryptor.cc |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2013 T/Chromium Authors. All rights reserved. |
ddorwin
2014/02/10 19:05:25
oops
xhwang
2014/02/10 22:30:55
Done.
|
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -83,17 +83,31 @@ 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; |
+ |
+ 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. |
+ return media_keys_->LoadSession( |
+ session_id, |
+ std::string(reinterpret_cast<const char*>( |
+ init_data + kPrefixedApiLoadSessionHeaderLength), |
+ init_data_length - kPrefixedApiLoadSessionHeaderLength)); |
} |
- return true; |
+ return media_keys_->CreateSession( |
+ session_id, content_type, init_data, init_data_length); |
} |
void ProxyDecryptor::AddKey(const uint8* key, |