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

Side by Side Diff: media/cdm/ppapi/external_clear_key/clear_key_cdm.cc

Issue 2568463003: media: Rename MediaKeys to ContentDecryptionModule (Closed)
Patch Set: comments addressed Created 4 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cdm/ppapi/external_clear_key/clear_key_cdm.h" 5 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <sstream> 9 #include <sstream>
10 #include <utility> 10 #include <utility>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return cdm::kUnknownError; 138 return cdm::kUnknownError;
139 case media::CdmPromise::CLIENT_ERROR: 139 case media::CdmPromise::CLIENT_ERROR:
140 return cdm::kClientError; 140 return cdm::kClientError;
141 case media::CdmPromise::OUTPUT_ERROR: 141 case media::CdmPromise::OUTPUT_ERROR:
142 return cdm::kOutputError; 142 return cdm::kOutputError;
143 } 143 }
144 NOTREACHED(); 144 NOTREACHED();
145 return cdm::kUnknownError; 145 return cdm::kUnknownError;
146 } 146 }
147 147
148 static media::MediaKeys::SessionType ConvertSessionType( 148 static media::ContentDecryptionModule::SessionType ConvertSessionType(
149 cdm::SessionType session_type) { 149 cdm::SessionType session_type) {
150 switch (session_type) { 150 switch (session_type) {
151 case cdm::kTemporary: 151 case cdm::kTemporary:
152 return media::MediaKeys::TEMPORARY_SESSION; 152 return media::ContentDecryptionModule::TEMPORARY_SESSION;
153 case cdm::kPersistentLicense: 153 case cdm::kPersistentLicense:
154 return media::MediaKeys::PERSISTENT_LICENSE_SESSION; 154 return media::ContentDecryptionModule::PERSISTENT_LICENSE_SESSION;
155 case cdm::kPersistentKeyRelease: 155 case cdm::kPersistentKeyRelease:
156 return media::MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION; 156 return media::ContentDecryptionModule::PERSISTENT_RELEASE_MESSAGE_SESSION;
157 } 157 }
158 NOTREACHED(); 158 NOTREACHED();
159 return media::MediaKeys::TEMPORARY_SESSION; 159 return media::ContentDecryptionModule::TEMPORARY_SESSION;
160 } 160 }
161 161
162 static media::EmeInitDataType ConvertInitDataType( 162 static media::EmeInitDataType ConvertInitDataType(
163 cdm::InitDataType init_data_type) { 163 cdm::InitDataType init_data_type) {
164 switch (init_data_type) { 164 switch (init_data_type) {
165 case cdm::kCenc: 165 case cdm::kCenc:
166 return media::EmeInitDataType::CENC; 166 return media::EmeInitDataType::CENC;
167 case cdm::kKeyIds: 167 case cdm::kKeyIds:
168 return media::EmeInitDataType::KEYIDS; 168 return media::EmeInitDataType::KEYIDS;
169 case cdm::kWebM: 169 case cdm::kWebM:
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 new media::CdmCallbackPromise<std::string>( 344 new media::CdmCallbackPromise<std::string>(
345 base::Bind(&ClearKeyCdm::OnSessionLoaded, base::Unretained(this), 345 base::Bind(&ClearKeyCdm::OnSessionLoaded, base::Unretained(this),
346 promise_id), 346 promise_id),
347 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), 347 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
348 promise_id))); 348 promise_id)));
349 // AesDecryptor does not support loading, so create a temporary session to 349 // AesDecryptor does not support loading, so create a temporary session to
350 // represent it in other session-related methods. 350 // represent it in other session-related methods.
351 std::vector<uint8_t> key_id( 351 std::vector<uint8_t> key_id(
352 kLoadableSessionKeyId, 352 kLoadableSessionKeyId,
353 kLoadableSessionKeyId + arraysize(kLoadableSessionKeyId) - 1); 353 kLoadableSessionKeyId + arraysize(kLoadableSessionKeyId) - 1);
354 decryptor_->CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, 354 decryptor_->CreateSessionAndGenerateRequest(
355 EmeInitDataType::WEBM, key_id, 355 ContentDecryptionModule::TEMPORARY_SESSION, EmeInitDataType::WEBM, key_id,
356 std::move(promise)); 356 std::move(promise));
357 } 357 }
358 358
359 void ClearKeyCdm::UpdateSession(uint32_t promise_id, 359 void ClearKeyCdm::UpdateSession(uint32_t promise_id,
360 const char* session_id, 360 const char* session_id,
361 uint32_t session_id_length, 361 uint32_t session_id_length,
362 const uint8_t* response, 362 const uint8_t* response,
363 uint32_t response_size) { 363 uint32_t response_size) {
364 DVLOG(1) << __func__; 364 DVLOG(1) << __func__;
365 std::string web_session_str(session_id, session_id_length); 365 std::string web_session_str(session_id, session_id_length);
366 366
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 new media::CdmCallbackPromise<>( 750 new media::CdmCallbackPromise<>(
751 base::Bind(&ClearKeyCdm::OnLoadSessionUpdated, 751 base::Bind(&ClearKeyCdm::OnLoadSessionUpdated,
752 base::Unretained(this)), 752 base::Unretained(this)),
753 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), 753 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
754 promise_id_for_emulated_loadsession_))); 754 promise_id_for_emulated_loadsession_)));
755 decryptor_->UpdateSession( 755 decryptor_->UpdateSession(
756 session_id_for_emulated_loadsession_, 756 session_id_for_emulated_loadsession_,
757 std::vector<uint8_t>(jwk_set.begin(), jwk_set.end()), std::move(promise)); 757 std::vector<uint8_t>(jwk_set.begin(), jwk_set.end()), std::move(promise));
758 } 758 }
759 759
760 void ClearKeyCdm::OnSessionMessage(const std::string& session_id, 760 void ClearKeyCdm::OnSessionMessage(
761 MediaKeys::MessageType message_type, 761 const std::string& session_id,
762 const std::vector<uint8_t>& message) { 762 ContentDecryptionModule::MessageType message_type,
763 const std::vector<uint8_t>& message) {
763 DVLOG(1) << "OnSessionMessage: " << message.size(); 764 DVLOG(1) << "OnSessionMessage: " << message.size();
764 765
765 // Ignore the message when we are waiting to update the loadable session. 766 // Ignore the message when we are waiting to update the loadable session.
766 if (session_id == session_id_for_emulated_loadsession_) 767 if (session_id == session_id_for_emulated_loadsession_)
767 return; 768 return;
768 769
769 // OnSessionMessage() only called during CreateSession(), so no promise 770 // OnSessionMessage() only called during CreateSession(), so no promise
770 // involved (OnSessionCreated() called to resolve the CreateSession() 771 // involved (OnSessionCreated() called to resolve the CreateSession()
771 // promise). 772 // promise).
772 host_->OnSessionMessage(session_id.data(), session_id.length(), 773 host_->OnSessionMessage(session_id.data(), session_id.length(),
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 is_running_platform_verification_test_ = true; 977 is_running_platform_verification_test_ = true;
977 978
978 std::string service_id = "test_service_id"; 979 std::string service_id = "test_service_id";
979 std::string challenge = "test_challenge"; 980 std::string challenge = "test_challenge";
980 981
981 host_->SendPlatformChallenge(service_id.data(), service_id.size(), 982 host_->SendPlatformChallenge(service_id.data(), service_id.size(),
982 challenge.data(), challenge.size()); 983 challenge.data(), challenge.size());
983 } 984 }
984 985
985 } // namespace media 986 } // namespace media
OLDNEW
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.h ('k') | media/gpu/android_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698