Chromium Code Reviews| 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, |