| 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 "media/blink/cdm_session_adapter.h" | 5 #include "media/blink/cdm_session_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "media/base/cdm_factory.h" | 11 #include "media/base/cdm_factory.h" |
| 12 #include "media/base/cdm_key_information.h" |
| 12 #include "media/base/cdm_promise.h" | 13 #include "media/base/cdm_promise.h" |
| 13 #include "media/base/key_systems.h" | 14 #include "media/base/key_systems.h" |
| 14 #include "media/base/media_keys.h" | 15 #include "media/base/media_keys.h" |
| 15 #include "media/blink/webcontentdecryptionmodulesession_impl.h" | 16 #include "media/blink/webcontentdecryptionmodulesession_impl.h" |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 namespace media { | 19 namespace media { |
| 19 | 20 |
| 20 const char kMediaEME[] = "Media.EME."; | 21 const char kMediaEME[] = "Media.EME."; |
| 21 const char kDot[] = "."; | 22 const char kDot[] = "."; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const std::vector<uint8>& message, | 123 const std::vector<uint8>& message, |
| 123 const GURL& destination_url) { | 124 const GURL& destination_url) { |
| 124 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 125 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
| 125 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 126 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
| 126 << web_session_id; | 127 << web_session_id; |
| 127 if (session) | 128 if (session) |
| 128 session->OnSessionMessage(message, destination_url); | 129 session->OnSessionMessage(message, destination_url); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id, | 132 void CdmSessionAdapter::OnSessionKeysChange(const std::string& web_session_id, |
| 132 bool has_additional_usable_key) { | 133 bool has_additional_usable_key, |
| 134 const CdmKeysInfo& keys_info) { |
| 135 // TODO(jrummell): Pass |keys_info| on. |
| 133 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 136 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
| 134 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 137 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
| 135 << web_session_id; | 138 << web_session_id; |
| 136 if (session) | 139 if (session) |
| 137 session->OnSessionKeysChange(has_additional_usable_key); | 140 session->OnSessionKeysChange(has_additional_usable_key); |
| 138 } | 141 } |
| 139 | 142 |
| 140 void CdmSessionAdapter::OnSessionExpirationUpdate( | 143 void CdmSessionAdapter::OnSessionExpirationUpdate( |
| 141 const std::string& web_session_id, | 144 const std::string& web_session_id, |
| 142 const base::Time& new_expiry_time) { | 145 const base::Time& new_expiry_time) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 167 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 170 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
| 168 const std::string& web_session_id) { | 171 const std::string& web_session_id) { |
| 169 // Since session objects may get garbage collected, it is possible that there | 172 // Since session objects may get garbage collected, it is possible that there |
| 170 // are events coming back from the CDM and the session has been unregistered. | 173 // are events coming back from the CDM and the session has been unregistered. |
| 171 // We can not tell if the CDM is firing events at sessions that never existed. | 174 // We can not tell if the CDM is firing events at sessions that never existed. |
| 172 SessionMap::iterator session = sessions_.find(web_session_id); | 175 SessionMap::iterator session = sessions_.find(web_session_id); |
| 173 return (session != sessions_.end()) ? session->second.get() : NULL; | 176 return (session != sessions_.end()) ? session->second.get() : NULL; |
| 174 } | 177 } |
| 175 | 178 |
| 176 } // namespace media | 179 } // namespace media |
| OLD | NEW |