| 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 <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "media/base/cdm_callback_promise.h" | 17 #include "media/base/cdm_callback_promise.h" |
| 18 #include "media/base/cdm_key_information.h" |
| 18 #include "media/base/decoder_buffer.h" | 19 #include "media/base/decoder_buffer.h" |
| 19 #include "media/base/decrypt_config.h" | 20 #include "media/base/decrypt_config.h" |
| 20 #include "media/cdm/json_web_key.h" | 21 #include "media/cdm/json_web_key.h" |
| 21 #include "media/cdm/ppapi/cdm_file_io_test.h" | 22 #include "media/cdm/ppapi/cdm_file_io_test.h" |
| 22 #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" | 23 #include "media/cdm/ppapi/external_clear_key/cdm_video_decoder.h" |
| 23 | 24 |
| 24 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | 25 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) |
| 25 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
| 26 const int64 kNoTimestamp = kint64min; | 27 const int64 kNoTimestamp = kint64min; |
| 27 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER | 28 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // involved (OnSessionCreated() called to resolve the CreateSession() | 683 // involved (OnSessionCreated() called to resolve the CreateSession() |
| 683 // promise). | 684 // promise). |
| 684 host_->OnSessionMessage(web_session_id.data(), | 685 host_->OnSessionMessage(web_session_id.data(), |
| 685 web_session_id.length(), | 686 web_session_id.length(), |
| 686 reinterpret_cast<const char*>(message.data()), | 687 reinterpret_cast<const char*>(message.data()), |
| 687 message.size(), | 688 message.size(), |
| 688 destination_url.spec().data(), | 689 destination_url.spec().data(), |
| 689 destination_url.spec().size()); | 690 destination_url.spec().size()); |
| 690 } | 691 } |
| 691 | 692 |
| 692 void ClearKeyCdm::OnSessionKeysChange(const std::string& web_session_id, | 693 void ClearKeyCdm::OnSessionKeysChange( |
| 693 bool has_additional_usable_key) { | 694 const std::string& web_session_id, |
| 695 bool has_additional_usable_key, |
| 696 const CdmKeyInformationVector& key_information) { |
| 694 // Ignore the message when we are waiting to update the loadable session. | 697 // Ignore the message when we are waiting to update the loadable session. |
| 695 if (web_session_id == session_id_for_emulated_loadsession_) | 698 if (web_session_id == session_id_for_emulated_loadsession_) |
| 696 return; | 699 return; |
| 697 | 700 |
| 701 // TODO(jrummell): Pass |key_information| on. |
| 698 host_->OnSessionUsableKeysChange(web_session_id.data(), | 702 host_->OnSessionUsableKeysChange(web_session_id.data(), |
| 699 web_session_id.length(), | 703 web_session_id.length(), |
| 700 has_additional_usable_key); | 704 has_additional_usable_key); |
| 701 } | 705 } |
| 702 | 706 |
| 703 void ClearKeyCdm::OnSessionClosed(const std::string& web_session_id) { | 707 void ClearKeyCdm::OnSessionClosed(const std::string& web_session_id) { |
| 704 host_->OnSessionClosed(web_session_id.data(), web_session_id.length()); | 708 host_->OnSessionClosed(web_session_id.data(), web_session_id.length()); |
| 705 } | 709 } |
| 706 | 710 |
| 707 void ClearKeyCdm::OnSessionCreated(uint32 promise_id, | 711 void ClearKeyCdm::OnSessionCreated(uint32 promise_id, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 host_->OnSessionMessage(last_session_id_.data(), | 844 host_->OnSessionMessage(last_session_id_.data(), |
| 841 last_session_id_.length(), | 845 last_session_id_.length(), |
| 842 message.data(), | 846 message.data(), |
| 843 message.length(), | 847 message.length(), |
| 844 NULL, | 848 NULL, |
| 845 0); | 849 0); |
| 846 file_io_test_runner_.reset(); | 850 file_io_test_runner_.reset(); |
| 847 } | 851 } |
| 848 | 852 |
| 849 } // namespace media | 853 } // namespace media |
| OLD | NEW |