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

Side by Side Diff: media/cdm/ppapi/cdm_adapter.cc

Issue 813683005: Add |legacy_destination_url| back to SessionMessage for EME (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/cdm_adapter.h" 5 #include "media/cdm/ppapi/cdm_adapter.h"
6 6
7 #include "media/base/limits.h" 7 #include "media/base/limits.h"
8 #include "media/cdm/ppapi/cdm_file_io_impl.h" 8 #include "media/cdm/ppapi/cdm_file_io_impl.h"
9 #include "media/cdm/ppapi/cdm_helpers.h" 9 #include "media/cdm/ppapi/cdm_helpers.h"
10 #include "media/cdm/ppapi/cdm_logging.h" 10 #include "media/cdm/ppapi/cdm_logging.h"
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 &CdmAdapter::SendPromiseRejectedInternal, 708 &CdmAdapter::SendPromiseRejectedInternal,
709 promise_id, 709 promise_id,
710 SessionError(error, system_code, error_message))); 710 SessionError(error, system_code, error_message)));
711 } 711 }
712 712
713 // cdm::Host_7 only. 713 // cdm::Host_7 only.
714 void CdmAdapter::OnSessionMessage(const char* session_id, 714 void CdmAdapter::OnSessionMessage(const char* session_id,
715 uint32_t session_id_size, 715 uint32_t session_id_size,
716 cdm::MessageType message_type, 716 cdm::MessageType message_type,
717 const char* message, 717 const char* message,
718 uint32_t message_size) { 718 uint32_t message_size,
719 const char* legacy_destination_url,
720 uint32_t legacy_destination_url_size) {
719 PostOnMain(callback_factory_.NewCallback( 721 PostOnMain(callback_factory_.NewCallback(
720 &CdmAdapter::SendSessionMessageInternal, 722 &CdmAdapter::SendSessionMessageInternal,
721 std::string(session_id, session_id_size), message_type, 723 SessionMessage(
722 std::vector<uint8_t>(message, message + message_size))); 724 std::string(session_id, session_id_size), message_type,
725 std::vector<uint8_t>(message, message + message_size),
726 std::string(legacy_destination_url, legacy_destination_url_size))));
723 } 727 }
724 728
725 // cdm::Host_6 only. 729 // cdm::Host_6 only.
726 void CdmAdapter::OnSessionMessage(const char* session_id, 730 void CdmAdapter::OnSessionMessage(const char* session_id,
727 uint32_t session_id_size, 731 uint32_t session_id_size,
728 const char* message, 732 const char* message,
729 uint32_t message_size, 733 uint32_t message_size,
730 const char* destination_url, 734 const char* destination_url,
731 uint32_t destination_url_size) { 735 uint32_t destination_url_size) {
732 // |destination_url| is no longer passed to EME applications, so it is 736 // |destination_url| is no longer passed to EME applications, so it is
733 // dropped. All messages will appear as license renewals if |destination_url| 737 // dropped. All messages will appear as license renewals if |destination_url|
734 // is provided, license request if not. 738 // is provided, license request if not.
735 cdm::MessageType message_type = (destination_url_size > 0) 739 cdm::MessageType message_type = (destination_url_size > 0)
736 ? cdm::MessageType::kLicenseRenewal 740 ? cdm::MessageType::kLicenseRenewal
737 : cdm::MessageType::kLicenseRequest; 741 : cdm::MessageType::kLicenseRequest;
738 PostOnMain(callback_factory_.NewCallback( 742 PostOnMain(callback_factory_.NewCallback(
739 &CdmAdapter::SendSessionMessageInternal, 743 &CdmAdapter::SendSessionMessageInternal,
740 std::string(session_id, session_id_size), message_type, 744 SessionMessage(std::string(session_id, session_id_size), message_type,
741 std::vector<uint8_t>(message, message + message_size))); 745 std::vector<uint8_t>(message, message + message_size),
746 std::string(destination_url, destination_url_size))));
742 } 747 }
743 748
744 // cdm::Host_7 only. 749 // cdm::Host_7 only.
745 void CdmAdapter::OnSessionKeysChange(const char* session_id, 750 void CdmAdapter::OnSessionKeysChange(const char* session_id,
746 uint32_t session_id_size, 751 uint32_t session_id_size,
747 bool has_additional_usable_key, 752 bool has_additional_usable_key,
748 const cdm::KeyInformation* keys_info, 753 const cdm::KeyInformation* keys_info,
749 uint32_t keys_info_count) { 754 uint32_t keys_info_count) {
750 std::vector<PP_KeyInformation> key_information; 755 std::vector<PP_KeyInformation> key_information;
751 for (uint32_t i = 0; i < keys_info_count; ++i) { 756 for (uint32_t i = 0; i < keys_info_count; ++i) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 uint32_t promise_id, 849 uint32_t promise_id,
845 const SessionError& error) { 850 const SessionError& error) {
846 PP_DCHECK(result == PP_OK); 851 PP_DCHECK(result == PP_OK);
847 pp::ContentDecryptor_Private::PromiseRejected( 852 pp::ContentDecryptor_Private::PromiseRejected(
848 promise_id, 853 promise_id,
849 CdmExceptionTypeToPpCdmExceptionType(error.error), 854 CdmExceptionTypeToPpCdmExceptionType(error.error),
850 error.system_code, 855 error.system_code,
851 error.error_description); 856 error.error_description);
852 } 857 }
853 858
854 void CdmAdapter::SendSessionMessageInternal( 859 void CdmAdapter::SendSessionMessageInternal(int32_t result,
855 int32_t result, 860 const SessionMessage& message) {
856 const std::string& session_id,
857 cdm::MessageType message_type,
858 const std::vector<uint8_t>& message) {
859 PP_DCHECK(result == PP_OK); 861 PP_DCHECK(result == PP_OK);
860 862
861 pp::VarArrayBuffer message_array_buffer(message.size()); 863 pp::VarArrayBuffer message_array_buffer(message.message.size());
862 if (message.size() > 0) { 864 if (message.message.size() > 0) {
863 memcpy(message_array_buffer.Map(), message.data(), message.size()); 865 memcpy(message_array_buffer.Map(), message.message.data(),
866 message.message.size());
864 } 867 }
865 868
866 pp::ContentDecryptor_Private::SessionMessage( 869 pp::ContentDecryptor_Private::SessionMessage(
867 session_id, CdmMessageTypeToPpMessageType(message_type), 870 message.session_id, CdmMessageTypeToPpMessageType(message.message_type),
868 message_array_buffer); 871 message_array_buffer, message.legacy_destination_url);
869 } 872 }
870 873
871 void CdmAdapter::SendSessionClosedInternal(int32_t result, 874 void CdmAdapter::SendSessionClosedInternal(int32_t result,
872 const std::string& session_id) { 875 const std::string& session_id) {
873 PP_DCHECK(result == PP_OK); 876 PP_DCHECK(result == PP_OK);
874 pp::ContentDecryptor_Private::SessionClosed(session_id); 877 pp::ContentDecryptor_Private::SessionClosed(session_id);
875 } 878 }
876 879
877 void CdmAdapter::SendSessionErrorInternal(int32_t result, 880 void CdmAdapter::SendSessionErrorInternal(int32_t result,
878 const std::string& session_id, 881 const std::string& session_id,
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 #endif 1302 #endif
1300 1303
1301 CdmAdapter::SessionError::SessionError(cdm::Error error, 1304 CdmAdapter::SessionError::SessionError(cdm::Error error,
1302 uint32_t system_code, 1305 uint32_t system_code,
1303 std::string error_description) 1306 std::string error_description)
1304 : error(error), 1307 : error(error),
1305 system_code(system_code), 1308 system_code(system_code),
1306 error_description(error_description) { 1309 error_description(error_description) {
1307 } 1310 }
1308 1311
1312 CdmAdapter::SessionMessage::SessionMessage(std::string session_id,
1313 cdm::MessageType message_type,
1314 std::vector<uint8_t> message,
1315 std::string legacy_destination_url)
1316 : session_id(session_id),
1317 message_type(message_type),
1318 message(message),
1319 legacy_destination_url(legacy_destination_url) {
1320 }
1321
1309 void* GetCdmHost(int host_interface_version, void* user_data) { 1322 void* GetCdmHost(int host_interface_version, void* user_data) {
1310 if (!host_interface_version || !user_data) 1323 if (!host_interface_version || !user_data)
1311 return NULL; 1324 return NULL;
1312 1325
1313 static_assert( 1326 static_assert(
1314 cdm::ContentDecryptionModule::Host::kVersion == cdm::Host_7::kVersion, 1327 cdm::ContentDecryptionModule::Host::kVersion == cdm::Host_7::kVersion,
1315 "update the code below"); 1328 "update the code below");
1316 1329
1317 // Ensure IsSupportedCdmHostVersion matches implementation of this function. 1330 // Ensure IsSupportedCdmHostVersion matches implementation of this function.
1318 // Always update this DCHECK when updating this function. 1331 // Always update this DCHECK when updating this function.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 } // namespace media 1380 } // namespace media
1368 1381
1369 namespace pp { 1382 namespace pp {
1370 1383
1371 // Factory function for your specialization of the Module object. 1384 // Factory function for your specialization of the Module object.
1372 Module* CreateModule() { 1385 Module* CreateModule() {
1373 return new media::CdmAdapterModule(); 1386 return new media::CdmAdapterModule();
1374 } 1387 }
1375 1388
1376 } // namespace pp 1389 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698