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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void CdmSessionAdapter::OnSessionMessage(const std::string& web_session_id, | 122 void CdmSessionAdapter::OnSessionMessage(const std::string& web_session_id, |
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( |
132 bool has_additional_usable_key) { | 133 const std::string& web_session_id, |
| 134 bool has_additional_usable_key, |
| 135 const CdmKeyInformationVector& key_information) { |
| 136 // TODO(jrummell): Pass |key_information| on. |
133 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); | 137 WebContentDecryptionModuleSessionImpl* session = GetSession(web_session_id); |
134 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 138 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
135 << web_session_id; | 139 << web_session_id; |
136 if (session) | 140 if (session) |
137 session->OnSessionKeysChange(has_additional_usable_key); | 141 session->OnSessionKeysChange(has_additional_usable_key); |
138 } | 142 } |
139 | 143 |
140 void CdmSessionAdapter::OnSessionExpirationUpdate( | 144 void CdmSessionAdapter::OnSessionExpirationUpdate( |
141 const std::string& web_session_id, | 145 const std::string& web_session_id, |
142 const base::Time& new_expiry_time) { | 146 const base::Time& new_expiry_time) { |
(...skipping 24 matching lines...) Expand all Loading... |
167 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 171 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
168 const std::string& web_session_id) { | 172 const std::string& web_session_id) { |
169 // Since session objects may get garbage collected, it is possible that there | 173 // 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. | 174 // 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. | 175 // We can not tell if the CDM is firing events at sessions that never existed. |
172 SessionMap::iterator session = sessions_.find(web_session_id); | 176 SessionMap::iterator session = sessions_.find(web_session_id); |
173 return (session != sessions_.end()) ? session->second.get() : NULL; | 177 return (session != sessions_.end()) ? session->second.get() : NULL; |
174 } | 178 } |
175 | 179 |
176 } // namespace media | 180 } // namespace media |
OLD | NEW |