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 // AesDecryptor does not support loading, but we need a real session so create | |
ddorwin
2016/08/11 20:28:32
Is this comment accurate?
jrummell
2016/08/12 19:24:25
How about "AesDecryptor does not support loading,
ddorwin
2016/08/12 21:40:38
Done.
| |
339 // one with fake initData. | |
338 decryptor_->CreateSessionAndGenerateRequest( | 340 decryptor_->CreateSessionAndGenerateRequest( |
339 MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, | 341 MediaKeys::TEMPORARY_SESSION, EmeInitDataType::WEBM, |
340 std::vector<uint8_t>(), std::move(promise)); | 342 std::vector<uint8_t>(16), std::move(promise)); |
ddorwin
2016/08/11 20:28:32
Made this 128 (random) bits. 0 bytes failed the ch
jrummell
2016/08/12 19:24:25
The keyId used is kLoadableSessionKeyId. So it cou
ddorwin
2016/08/12 21:40:38
Done.
| |
341 } | 343 } |
342 | 344 |
343 void ClearKeyCdm::UpdateSession(uint32_t promise_id, | 345 void ClearKeyCdm::UpdateSession(uint32_t promise_id, |
344 const char* session_id, | 346 const char* session_id, |
345 uint32_t session_id_length, | 347 uint32_t session_id_length, |
346 const uint8_t* response, | 348 const uint8_t* response, |
347 uint32_t response_size) { | 349 uint32_t response_size) { |
348 DVLOG(1) << __FUNCTION__; | 350 DVLOG(1) << __FUNCTION__; |
349 std::string web_session_str(session_id, session_id_length); | 351 std::string web_session_str(session_id, session_id_length); |
350 | 352 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
913 void ClearKeyCdm::OnFileIOTestComplete(bool success) { | 915 void ClearKeyCdm::OnFileIOTestComplete(bool success) { |
914 DVLOG(1) << __FUNCTION__ << ": " << success; | 916 DVLOG(1) << __FUNCTION__ << ": " << success; |
915 std::string message = GetFileIOTestResultMessage(success); | 917 std::string message = GetFileIOTestResultMessage(success); |
916 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), | 918 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), |
917 cdm::kLicenseRequest, message.data(), | 919 cdm::kLicenseRequest, message.data(), |
918 message.length(), NULL, 0); | 920 message.length(), NULL, 0); |
919 file_io_test_runner_.reset(); | 921 file_io_test_runner_.reset(); |
920 } | 922 } |
921 | 923 |
922 } // namespace media | 924 } // namespace media |
OLD | NEW |