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 "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" | 5 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <utility> | 10 #include <utility> |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 // Only allowed to successfully load this session once. | 329 // Only allowed to successfully load this session once. |
330 DCHECK(session_id_for_emulated_loadsession_.empty()); | 330 DCHECK(session_id_for_emulated_loadsession_.empty()); |
331 | 331 |
332 std::unique_ptr<media::NewSessionCdmPromise> promise( | 332 std::unique_ptr<media::NewSessionCdmPromise> promise( |
333 new media::CdmCallbackPromise<std::string>( | 333 new media::CdmCallbackPromise<std::string>( |
334 base::Bind(&ClearKeyCdm::OnSessionLoaded, base::Unretained(this), | 334 base::Bind(&ClearKeyCdm::OnSessionLoaded, base::Unretained(this), |
335 promise_id), | 335 promise_id), |
336 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), | 336 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), |
337 promise_id))); | 337 promise_id))); |
338 decryptor_->CreateSessionAndGenerateRequest( | 338 // AesDecryptor does not support loading, so create a temporary session to |
339 MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, | 339 // represent it in other session-related methods. |
340 std::vector<uint8_t>(), std::move(promise)); | 340 std::vector<uint8_t> key_id( |
| 341 kLoadableSessionKeyId, |
| 342 kLoadableSessionKeyId + arraysize(kLoadableSessionKeyId) - 1); |
| 343 decryptor_->CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, |
| 344 EmeInitDataType::WEBM, key_id, |
| 345 std::move(promise)); |
341 } | 346 } |
342 | 347 |
343 void ClearKeyCdm::UpdateSession(uint32_t promise_id, | 348 void ClearKeyCdm::UpdateSession(uint32_t promise_id, |
344 const char* session_id, | 349 const char* session_id, |
345 uint32_t session_id_length, | 350 uint32_t session_id_length, |
346 const uint8_t* response, | 351 const uint8_t* response, |
347 uint32_t response_size) { | 352 uint32_t response_size) { |
348 DVLOG(1) << __FUNCTION__; | 353 DVLOG(1) << __FUNCTION__; |
349 std::string web_session_str(session_id, session_id_length); | 354 std::string web_session_str(session_id, session_id_length); |
350 | 355 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 void ClearKeyCdm::OnFileIOTestComplete(bool success) { | 918 void ClearKeyCdm::OnFileIOTestComplete(bool success) { |
914 DVLOG(1) << __FUNCTION__ << ": " << success; | 919 DVLOG(1) << __FUNCTION__ << ": " << success; |
915 std::string message = GetFileIOTestResultMessage(success); | 920 std::string message = GetFileIOTestResultMessage(success); |
916 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), | 921 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), |
917 cdm::kLicenseRequest, message.data(), | 922 cdm::kLicenseRequest, message.data(), |
918 message.length(), NULL, 0); | 923 message.length(), NULL, 0); |
919 file_io_test_runner_.reset(); | 924 file_io_test_runner_.reset(); |
920 } | 925 } |
921 | 926 |
922 } // namespace media | 927 } // namespace media |
OLD | NEW |