| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/media/cdm/cast_cdm.h" | 5 #include "chromecast/media/cdm/cast_cdm.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "chromecast/media/base/decrypt_context_impl.h" | 14 #include "chromecast/media/base/decrypt_context_impl.h" |
| 15 #include "chromecast/media/base/media_resource_tracker.h" | 15 #include "chromecast/media/base/media_resource_tracker.h" |
| 16 #include "media/base/cdm_key_information.h" | 16 #include "media/base/cdm_key_information.h" |
| 17 #include "media/base/decryptor.h" | 17 #include "media/base/decryptor.h" |
| 18 #include "media/cdm/player_tracker_impl.h" | 18 #include "media/cdm/player_tracker_impl.h" |
| 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 namespace chromecast { | 21 namespace chromecast { |
| 21 namespace media { | 22 namespace media { |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 class CastCdmContextImpl : public CastCdmContext { | 25 class CastCdmContextImpl : public CastCdmContext { |
| 25 public: | 26 public: |
| 26 explicit CastCdmContextImpl(CastCdm* cast_cdm) : cast_cdm_(cast_cdm) { | 27 explicit CastCdmContextImpl(CastCdm* cast_cdm) : cast_cdm_(cast_cdm) { |
| 27 DCHECK(cast_cdm_); | 28 DCHECK(cast_cdm_); |
| 28 } | 29 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 DCHECK(thread_checker_.CalledOnValidThread()); | 103 DCHECK(thread_checker_.CalledOnValidThread()); |
| 103 player_tracker_impl_->UnregisterPlayer(registration_id); | 104 player_tracker_impl_->UnregisterPlayer(registration_id); |
| 104 } | 105 } |
| 105 | 106 |
| 106 ::media::CdmContext* CastCdm::GetCdmContext() { | 107 ::media::CdmContext* CastCdm::GetCdmContext() { |
| 107 return cast_cdm_context_.get(); | 108 return cast_cdm_context_.get(); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void CastCdm::OnSessionMessage(const std::string& session_id, | 111 void CastCdm::OnSessionMessage(const std::string& session_id, |
| 111 const std::vector<uint8_t>& message, | 112 const std::vector<uint8_t>& message, |
| 112 const GURL& destination_url, | |
| 113 ::media::MediaKeys::MessageType message_type) { | 113 ::media::MediaKeys::MessageType message_type) { |
| 114 session_message_cb_.Run(session_id, message_type, message, destination_url); | 114 session_message_cb_.Run(session_id, message_type, message, GURL::EmptyGURL()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void CastCdm::OnSessionClosed(const std::string& session_id) { | 117 void CastCdm::OnSessionClosed(const std::string& session_id) { |
| 118 session_closed_cb_.Run(session_id); | 118 session_closed_cb_.Run(session_id); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void CastCdm::OnSessionKeysChange(const std::string& session_id, | 121 void CastCdm::OnSessionKeysChange(const std::string& session_id, |
| 122 bool newly_usable_keys, | 122 bool newly_usable_keys, |
| 123 ::media::CdmKeysInfo keys_info) { | 123 ::media::CdmKeysInfo keys_info) { |
| 124 session_keys_change_cb_.Run(session_id, newly_usable_keys, | 124 session_keys_change_cb_.Run(session_id, newly_usable_keys, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 138 keys_info->push_back(cdm_key_information.release()); | 138 keys_info->push_back(cdm_key_information.release()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 // A default empty implementation for subclasses that don't need to provide | 142 // A default empty implementation for subclasses that don't need to provide |
| 143 // any key system specific initialization. | 143 // any key system specific initialization. |
| 144 void CastCdm::InitializeInternal() {} | 144 void CastCdm::InitializeInternal() {} |
| 145 | 145 |
| 146 } // namespace media | 146 } // namespace media |
| 147 } // namespace chromecast | 147 } // namespace chromecast |
| OLD | NEW |