Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/crypto/proxy_decryptor.h" | 5 #include "content/renderer/media/crypto/proxy_decryptor.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 std::string(reinterpret_cast<const char*>( | 121 std::string(reinterpret_cast<const char*>( |
| 122 init_data + strlen(kPrefixedApiLoadSessionHeader)), | 122 init_data + strlen(kPrefixedApiLoadSessionHeader)), |
| 123 init_data_length - strlen(kPrefixedApiLoadSessionHeader)), | 123 init_data_length - strlen(kPrefixedApiLoadSessionHeader)), |
| 124 promise.Pass()); | 124 promise.Pass()); |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 media::MediaKeys::SessionType session_type = | 128 media::MediaKeys::SessionType session_type = |
| 129 persistent ? media::MediaKeys::PERSISTENT_SESSION | 129 persistent ? media::MediaKeys::PERSISTENT_SESSION |
| 130 : media::MediaKeys::TEMPORARY_SESSION; | 130 : media::MediaKeys::TEMPORARY_SESSION; |
| 131 media_keys_->CreateSession( | 131 |
| 132 content_type, init_data, init_data_length, session_type, promise.Pass()); | 132 // Translate content types. |
|
ddorwin
2014/08/13 21:43:34
nit: "Convert MIME type's used in the prefixed imp
sandersd (OOO until July 31)
2014/08/13 21:50:58
Done.
| |
| 133 std::string init_data_type; | |
| 134 if (content_type == "audio/mp4" || content_type == "video/mp4") { | |
| 135 init_data_type = "cenc"; | |
| 136 } else if (content_type == "audio/webm" || content_type == "video/webm") { | |
| 137 init_data_type = "webm"; | |
| 138 } else { | |
| 139 init_data_type = content_type; | |
|
ddorwin
2014/08/13 21:43:34
I wonder if we can add NOTREACHED(). If it only co
sandersd (OOO until July 31)
2014/08/13 21:50:58
Well, it's worth a try.
| |
| 140 } | |
| 141 | |
| 142 media_keys_->CreateSession(init_data_type, init_data, init_data_length, | |
| 143 session_type, promise.Pass()); | |
| 133 return true; | 144 return true; |
| 134 } | 145 } |
| 135 | 146 |
| 136 void ProxyDecryptor::AddKey(const uint8* key, | 147 void ProxyDecryptor::AddKey(const uint8* key, |
| 137 int key_length, | 148 int key_length, |
| 138 const uint8* init_data, | 149 const uint8* init_data, |
| 139 int init_data_length, | 150 int init_data_length, |
| 140 const std::string& web_session_id) { | 151 const std::string& web_session_id) { |
| 141 DVLOG(1) << "AddKey()"; | 152 DVLOG(1) << "AddKey()"; |
| 142 | 153 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 } | 296 } |
| 286 key_error_cb_.Run(web_session_id, error_code, system_code); | 297 key_error_cb_.Run(web_session_id, error_code, system_code); |
| 287 } | 298 } |
| 288 | 299 |
| 289 void ProxyDecryptor::SetSessionId(bool persistent, | 300 void ProxyDecryptor::SetSessionId(bool persistent, |
| 290 const std::string& web_session_id) { | 301 const std::string& web_session_id) { |
| 291 active_sessions_.insert(std::make_pair(web_session_id, persistent)); | 302 active_sessions_.insert(std::make_pair(web_session_id, persistent)); |
| 292 } | 303 } |
| 293 | 304 |
| 294 } // namespace content | 305 } // namespace content |
| OLD | NEW |