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

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

Issue 2255943002: EME: Remove obsolete legacy APIs related to versions of prefixed EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build and add bug reference for obsoletes Created 4 years, 4 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
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 if (cdm_interface_version != media::ClearKeyCdmInterface::kVersion) 247 if (cdm_interface_version != media::ClearKeyCdmInterface::kVersion)
248 return NULL; 248 return NULL;
249 249
250 media::ClearKeyCdmHost* host = static_cast<media::ClearKeyCdmHost*>( 250 media::ClearKeyCdmHost* host = static_cast<media::ClearKeyCdmHost*>(
251 get_cdm_host_func(media::ClearKeyCdmHost::kVersion, user_data)); 251 get_cdm_host_func(media::ClearKeyCdmHost::kVersion, user_data));
252 if (!host) 252 if (!host)
253 return NULL; 253 return NULL;
254 254
255 // TODO(jrummell): Obtain the proper origin for this instance. 255 // TODO(jrummell): Obtain the proper origin for this instance.
256 GURL empty_gurl; 256 GURL empty_origin;
dcheng 2016/08/19 18:38:59 GURLs aren't origins =)
ddorwin 2016/08/19 18:54:16 Just being consistent with the TODO and constructo
dcheng 2016/08/19 18:56:14 Actually, we do now: url::Origin. To be clear thou
257 return new media::ClearKeyCdm(host, key_system_string, empty_gurl); 257 return new media::ClearKeyCdm(host, key_system_string, empty_origin);
258 } 258 }
259 259
260 const char* GetCdmVersion() { 260 const char* GetCdmVersion() {
261 return kClearKeyCdmVersion; 261 return kClearKeyCdmVersion;
262 } 262 }
263 263
264 namespace media { 264 namespace media {
265 265
266 ClearKeyCdm::ClearKeyCdm(ClearKeyCdmHost* host, 266 ClearKeyCdm::ClearKeyCdm(ClearKeyCdmHost* host,
267 const std::string& key_system, 267 const std::string& key_system,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 457
458 DCHECK(renewal_timer_set_); 458 DCHECK(renewal_timer_set_);
459 std::string renewal_message; 459 std::string renewal_message;
460 if (!next_renewal_message_.empty() && 460 if (!next_renewal_message_.empty() &&
461 context == &next_renewal_message_[0]) { 461 context == &next_renewal_message_[0]) {
462 renewal_message = next_renewal_message_; 462 renewal_message = next_renewal_message_;
463 } else { 463 } else {
464 renewal_message = "ERROR: Invalid timer context found!"; 464 renewal_message = "ERROR: Invalid timer context found!";
465 } 465 }
466 466
467 // This URL is only used for testing the code path for defaultURL.
468 // There is no service at this URL, so applications should ignore it.
469 const char url[] = "http://test.externalclearkey.chromium.org";
470
471 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), 467 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(),
472 cdm::kLicenseRenewal, renewal_message.data(), 468 cdm::kLicenseRenewal, renewal_message.data(),
473 renewal_message.length(), url, arraysize(url) - 1); 469 renewal_message.length(), nullptr, 0);
474 470
475 ScheduleNextRenewal(); 471 ScheduleNextRenewal();
476 } 472 }
477 473
478 static void CopyDecryptResults( 474 static void CopyDecryptResults(
479 media::Decryptor::Status* status_copy, 475 media::Decryptor::Status* status_copy,
480 scoped_refptr<media::DecoderBuffer>* buffer_copy, 476 scoped_refptr<media::DecoderBuffer>* buffer_copy,
481 media::Decryptor::Status status, 477 media::Decryptor::Status status,
482 const scoped_refptr<media::DecoderBuffer>& buffer) { 478 const scoped_refptr<media::DecoderBuffer>& buffer) {
483 *status_copy = status; 479 *status_copy = status;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 base::Unretained(this)), 738 base::Unretained(this)),
743 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), 739 base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this),
744 promise_id_for_emulated_loadsession_))); 740 promise_id_for_emulated_loadsession_)));
745 decryptor_->UpdateSession( 741 decryptor_->UpdateSession(
746 session_id_for_emulated_loadsession_, 742 session_id_for_emulated_loadsession_,
747 std::vector<uint8_t>(jwk_set.begin(), jwk_set.end()), std::move(promise)); 743 std::vector<uint8_t>(jwk_set.begin(), jwk_set.end()), std::move(promise));
748 } 744 }
749 745
750 void ClearKeyCdm::OnSessionMessage(const std::string& session_id, 746 void ClearKeyCdm::OnSessionMessage(const std::string& session_id,
751 MediaKeys::MessageType message_type, 747 MediaKeys::MessageType message_type,
752 const std::vector<uint8_t>& message, 748 const std::vector<uint8_t>& message) {
753 const GURL& legacy_destination_url) {
754 DVLOG(1) << "OnSessionMessage: " << message.size(); 749 DVLOG(1) << "OnSessionMessage: " << message.size();
755 750
756 // Ignore the message when we are waiting to update the loadable session. 751 // Ignore the message when we are waiting to update the loadable session.
757 if (session_id == session_id_for_emulated_loadsession_) 752 if (session_id == session_id_for_emulated_loadsession_)
758 return; 753 return;
759 754
760 // OnSessionMessage() only called during CreateSession(), so no promise 755 // OnSessionMessage() only called during CreateSession(), so no promise
761 // involved (OnSessionCreated() called to resolve the CreateSession() 756 // involved (OnSessionCreated() called to resolve the CreateSession()
762 // promise). 757 // promise).
763 host_->OnSessionMessage(session_id.data(), session_id.length(), 758 host_->OnSessionMessage(session_id.data(), session_id.length(),
764 cdm::kLicenseRequest, 759 cdm::kLicenseRequest,
765 reinterpret_cast<const char*>(message.data()), 760 reinterpret_cast<const char*>(message.data()),
766 message.size(), legacy_destination_url.spec().data(), 761 message.size(), nullptr, 0);
767 legacy_destination_url.spec().size());
768 } 762 }
769 763
770 void ClearKeyCdm::OnSessionKeysChange(const std::string& session_id, 764 void ClearKeyCdm::OnSessionKeysChange(const std::string& session_id,
771 bool has_additional_usable_key, 765 bool has_additional_usable_key,
772 CdmKeysInfo keys_info) { 766 CdmKeysInfo keys_info) {
773 DVLOG(1) << "OnSessionKeysChange: " << keys_info.size(); 767 DVLOG(1) << "OnSessionKeysChange: " << keys_info.size();
774 768
775 std::string new_session_id = session_id; 769 std::string new_session_id = session_id;
776 if (new_session_id == session_id_for_emulated_loadsession_) { 770 if (new_session_id == session_id_for_emulated_loadsession_) {
777 // Save |keys_info| if the loadable session is still being created. This 771 // Save |keys_info| if the loadable session is still being created. This
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 total_samples_generated_ += samples_generated; 928 total_samples_generated_ += samples_generated;
935 929
936 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess; 930 return samples_generated == 0 ? cdm::kNeedMoreData : cdm::kSuccess;
937 } 931 }
938 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER 932 #endif // CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER
939 933
940 void ClearKeyCdm::OnUnitTestComplete(bool success) { 934 void ClearKeyCdm::OnUnitTestComplete(bool success) {
941 std::string message = GetUnitTestResultMessage(success); 935 std::string message = GetUnitTestResultMessage(success);
942 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), 936 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(),
943 cdm::kLicenseRequest, message.data(), 937 cdm::kLicenseRequest, message.data(),
944 message.length(), NULL, 0); 938 message.length(), nullptr, 0);
945 } 939 }
946 940
947 void ClearKeyCdm::StartFileIOTest() { 941 void ClearKeyCdm::StartFileIOTest() {
948 file_io_test_runner_.reset(new FileIOTestRunner( 942 file_io_test_runner_.reset(new FileIOTestRunner(
949 base::Bind(&ClearKeyCdmHost::CreateFileIO, base::Unretained(host_)))); 943 base::Bind(&ClearKeyCdmHost::CreateFileIO, base::Unretained(host_))));
950 file_io_test_runner_->RunAllTests( 944 file_io_test_runner_->RunAllTests(
951 base::Bind(&ClearKeyCdm::OnFileIOTestComplete, base::Unretained(this))); 945 base::Bind(&ClearKeyCdm::OnFileIOTestComplete, base::Unretained(this)));
952 } 946 }
953 947
954 void ClearKeyCdm::OnFileIOTestComplete(bool success) { 948 void ClearKeyCdm::OnFileIOTestComplete(bool success) {
955 DVLOG(1) << __FUNCTION__ << ": " << success; 949 DVLOG(1) << __FUNCTION__ << ": " << success;
956 OnUnitTestComplete(success); 950 OnUnitTestComplete(success);
957 file_io_test_runner_.reset(); 951 file_io_test_runner_.reset();
958 } 952 }
959 953
960 void ClearKeyCdm::StartOutputProtectionTest() { 954 void ClearKeyCdm::StartOutputProtectionTest() {
961 is_running_output_protection_test_ = true; 955 is_running_output_protection_test_ = true;
962 host_->QueryOutputProtectionStatus(); 956 host_->QueryOutputProtectionStatus();
963 } 957 }
964 958
965 } // namespace media 959 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698