Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1701)

Side by Side Diff: content/renderer/media/cdm_session_adapter.cc

Issue 193523002: Encrypted Media: Implement IPC based SetCdm(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 void CdmSessionAdapter::ReleaseSession(uint32 session_id) { 86 void CdmSessionAdapter::ReleaseSession(uint32 session_id) {
87 DCHECK(sessions_.find(session_id) != sessions_.end()); 87 DCHECK(sessions_.find(session_id) != sessions_.end());
88 media_keys_->ReleaseSession(session_id); 88 media_keys_->ReleaseSession(session_id);
89 } 89 }
90 90
91 media::Decryptor* CdmSessionAdapter::GetDecryptor() { 91 media::Decryptor* CdmSessionAdapter::GetDecryptor() {
92 return media_keys_->GetDecryptor(); 92 return media_keys_->GetDecryptor();
93 } 93 }
94 94
95 int CdmSessionAdapter::GetCdmId() {
96 return media_keys_->GetCdmId();
97 }
98
95 void CdmSessionAdapter::OnSessionCreated(uint32 session_id, 99 void CdmSessionAdapter::OnSessionCreated(uint32 session_id,
96 const std::string& web_session_id) { 100 const std::string& web_session_id) {
97 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); 101 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id);
98 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " 102 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session "
99 << session_id; 103 << session_id;
100 if (session) 104 if (session)
101 session->OnSessionCreated(web_session_id); 105 session->OnSessionCreated(web_session_id);
102 } 106 }
103 107
104 void CdmSessionAdapter::OnSessionMessage(uint32 session_id, 108 void CdmSessionAdapter::OnSessionMessage(uint32 session_id,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( 144 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession(
141 uint32 session_id) { 145 uint32 session_id) {
142 // Since session objects may get garbage collected, it is possible that there 146 // 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. 147 // 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. 148 // We can not tell if the CDM is firing events at sessions that never existed.
145 SessionMap::iterator session = sessions_.find(session_id); 149 SessionMap::iterator session = sessions_.find(session_id);
146 return (session != sessions_.end()) ? session->second : NULL; 150 return (session != sessions_.end()) ? session->second : NULL;
147 } 151 }
148 152
149 } // namespace content 153 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698