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 "content/renderer/media/cdm_session_adapter.h" | 5 #include "content/renderer/media/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 "content/renderer/media/crypto/content_decryption_module_factory.h" | 10 #include "content/renderer/media/crypto/content_decryption_module_factory.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void CdmSessionAdapter::OnSessionClosed(uint32 session_id) { | 122 void CdmSessionAdapter::OnSessionClosed(uint32 session_id) { |
123 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 123 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
124 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 124 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
125 << session_id; | 125 << session_id; |
126 if (session) | 126 if (session) |
127 session->OnSessionClosed(); | 127 session->OnSessionClosed(); |
128 } | 128 } |
129 | 129 |
130 void CdmSessionAdapter::OnSessionError(uint32 session_id, | 130 void CdmSessionAdapter::OnSessionError(uint32 session_id, |
131 media::MediaKeys::KeyError error_code, | 131 media::MediaKeys::KeyError error_code, |
132 int system_code) { | 132 uint32 system_code) { |
133 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 133 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
134 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 134 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
135 << session_id; | 135 << session_id; |
136 if (session) | 136 if (session) |
137 session->OnSessionError(error_code, system_code); | 137 session->OnSessionError(error_code, system_code); |
138 } | 138 } |
139 | 139 |
140 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 140 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
141 uint32 session_id) { | 141 uint32 session_id) { |
142 // Since session objects may get garbage collected, it is possible that there | 142 // Since session objects may get garbage collected, it is possible that there |
143 // are events coming back from the CDM and the session has been unregistered. | 143 // are events coming back from the CDM and the session has been unregistered. |
144 // We can not tell if the CDM is firing events at sessions that never existed. | 144 // We can not tell if the CDM is firing events at sessions that never existed. |
145 SessionMap::iterator session = sessions_.find(session_id); | 145 SessionMap::iterator session = sessions_.find(session_id); |
146 return (session != sessions_.end()) ? session->second : NULL; | 146 return (session != sessions_.end()) ? session->second : NULL; |
147 } | 147 } |
148 | 148 |
149 } // namespace content | 149 } // namespace content |
OLD | NEW |