Chromium Code Reviews| Index: media/cdm/ppapi/cdm_adapter.cc |
| diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc |
| index 284f1e32a980a42961c8a99b0129eddb1fa5ca57..6b3b265ed81333deac5f8906ef51a66ce9368d84 100644 |
| --- a/media/cdm/ppapi/cdm_adapter.cc |
| +++ b/media/cdm/ppapi/cdm_adapter.cc |
| @@ -232,6 +232,19 @@ cdm::SessionType PpSessionTypeToCdmSessionType(PP_SessionType session_type) { |
| return cdm::kTemporary; |
| } |
| +cdm::InitDataType InitDataTypeToCdmInitDataType( |
| + const std::string& init_data_type) { |
| + if (init_data_type == "cenc") |
| + return cdm::kCenc; |
| + if (init_data_type == "webm") |
| + return cdm::kWebM; |
| + if (init_data_type == "keyids") |
| + return cdm::kKeyIds; |
| + |
| + PP_NOTREACHED(); |
| + return cdm::kWebM; |
|
ddorwin
2015/03/20 00:05:22
perhaps kKeyIds since it's not supported in existi
jrummell
2015/03/20 18:05:09
Done.
|
| +} |
| + |
| PP_CdmExceptionCode CdmExceptionTypeToPpCdmExceptionType(cdm::Error error) { |
| switch (error) { |
| case cdm::kNotSupportedError: |
| @@ -278,6 +291,10 @@ PP_CdmKeyStatus CdmKeyStatusToPpKeyStatus(cdm::KeyStatus status) { |
| return PP_CDMKEYSTATUS_EXPIRED; |
| case cdm::kOutputNotAllowed: |
| return PP_CDMKEYSTATUS_OUTPUTNOTALLOWED; |
| + case cdm::kOutputDownscaled: |
| + return PP_CDMKEYSTATUS_OUTPUTDOWNSCALED; |
| + case cdm::kStatusPending: |
| + return PP_CDMKEYSTATUS_STATUSPENDING; |
| } |
| PP_NOTREACHED(); |
| @@ -368,6 +385,7 @@ void CdmAdapter::Initialize(const std::string& key_system, |
| key_system_ = key_system; |
| allow_distinctive_identifier_ = allow_distinctive_identifier; |
| allow_persistent_state_ = allow_persistent_state; |
| + cdm_->Initialize(allow_distinctive_identifier, allow_persistent_state); |
| } |
| void CdmAdapter::SetServerCertificate(uint32_t promise_id, |
| @@ -399,6 +417,8 @@ void CdmAdapter::SetServerCertificate(uint32_t promise_id, |
| promise_id, server_certificate_ptr, server_certificate_size); |
| } |
| +// TODO(jrummell): |init_data_type| should be an enum all the way through |
| +// Chromium. http://crbug.com/417440 |
|
ddorwin
2015/03/20 00:05:22
Not sure that's the right bug. We probably need a
jrummell
2015/03/20 18:05:09
417440 is the bug referenced in webmediaplayer_imp
ddorwin
2015/03/20 18:26:29
Okay, but please do file a separate bug for the Pe
jrummell
2015/03/20 18:49:34
Opened bug 469228.
|
| void CdmAdapter::CreateSessionAndGenerateRequest( |
| uint32_t promise_id, |
| PP_SessionType session_type, |
| @@ -419,7 +439,7 @@ void CdmAdapter::CreateSessionAndGenerateRequest( |
| cdm_->CreateSessionAndGenerateRequest( |
| promise_id, PpSessionTypeToCdmSessionType(session_type), |
| - init_data_type.data(), init_data_type.size(), |
| + InitDataTypeToCdmInitDataType(init_data_type), |
| static_cast<const uint8_t*>(init_data.Map()), init_data.ByteLength()); |
| } |
| @@ -678,14 +698,6 @@ void CdmAdapter::OnResolvePromise(uint32_t promise_id) { |
| &CdmAdapter::SendPromiseResolvedInternal, promise_id)); |
| } |
| -// cdm::Host_6 only |
| -void CdmAdapter::OnResolveKeyIdsPromise(uint32_t promise_id, |
| - const cdm::BinaryData* usable_key_ids, |
| - uint32_t usable_key_ids_size) { |
| - // This should never be called as GetUsableKeyIds() has been removed. |
| - PP_NOTREACHED(); |
| -} |
| - |
| void CdmAdapter::OnRejectPromise(uint32_t promise_id, |
| cdm::Error error, |
| uint32_t system_code, |
| @@ -716,7 +728,6 @@ void CdmAdapter::RejectPromise(uint32_t promise_id, |
| SessionError(error, system_code, error_message))); |
| } |
| -// cdm::Host_7 only. |
| void CdmAdapter::OnSessionMessage(const char* session_id, |
| uint32_t session_id_size, |
| cdm::MessageType message_type, |
| @@ -738,27 +749,6 @@ void CdmAdapter::OnSessionMessage(const char* session_id, |
| std::string(legacy_destination_url, legacy_destination_url_size)))); |
| } |
| -// cdm::Host_6 only. |
| -void CdmAdapter::OnSessionMessage(const char* session_id, |
| - uint32_t session_id_size, |
| - const char* message, |
| - uint32_t message_size, |
| - const char* destination_url, |
| - uint32_t destination_url_size) { |
| - // |destination_url| is no longer passed to unprefixed EME applications, |
| - // so it will be dropped. All messages will appear as license renewals |
| - // if |destination_url| is provided, license request if not. |
| - cdm::MessageType message_type = (destination_url_size > 0) |
| - ? cdm::MessageType::kLicenseRenewal |
| - : cdm::MessageType::kLicenseRequest; |
| - PostOnMain(callback_factory_.NewCallback( |
| - &CdmAdapter::SendSessionMessageInternal, |
| - SessionMessage(std::string(session_id, session_id_size), message_type, |
| - message, message_size, |
| - std::string(destination_url, destination_url_size)))); |
| -} |
| - |
| -// cdm::Host_7 only. |
| void CdmAdapter::OnSessionKeysChange(const char* session_id, |
| uint32_t session_id_size, |
| bool has_additional_usable_key, |
| @@ -790,16 +780,6 @@ void CdmAdapter::OnSessionKeysChange(const char* session_id, |
| key_information)); |
| } |
| -// cdm::Host_6 only. |
| -void CdmAdapter::OnSessionUsableKeysChange(const char* session_id, |
| - uint32_t session_id_size, |
| - bool has_additional_usable_key) { |
| - PostOnMain(callback_factory_.NewCallback( |
| - &CdmAdapter::SendSessionKeysChangeInternal, |
| - std::string(session_id, session_id_size), has_additional_usable_key, |
| - std::vector<PP_KeyInformation>())); |
| -} |
| - |
| void CdmAdapter::OnExpirationChange(const char* session_id, |
| uint32_t session_id_size, |
| cdm::Time new_expiry_time) { |
| @@ -815,29 +795,17 @@ void CdmAdapter::OnSessionClosed(const char* session_id, |
| std::string(session_id, session_id_size))); |
| } |
| -// cdm::Host_6 only. |
| -void CdmAdapter::OnSessionError(const char* session_id, |
| - uint32_t session_id_size, |
| - cdm::Error error, |
| - uint32_t system_code, |
| - const char* error_message, |
| - uint32_t error_message_size) { |
| - PostOnMain(callback_factory_.NewCallback( |
| - &CdmAdapter::SendSessionErrorInternal, |
| - std::string(session_id, session_id_size), |
| - SessionError(error, system_code, |
| - std::string(error_message, error_message_size)))); |
| -} |
| - |
| -// cdm::Host_7 only. |
| void CdmAdapter::OnLegacySessionError(const char* session_id, |
| uint32_t session_id_size, |
| cdm::Error error, |
| uint32_t system_code, |
| const char* error_message, |
| uint32_t error_message_size) { |
| - OnSessionError(session_id, session_id_size, error, system_code, error_message, |
| - error_message_size); |
| + PostOnMain(callback_factory_.NewCallback( |
| + &CdmAdapter::SendSessionErrorInternal, |
| + std::string(session_id, session_id_size), |
| + SessionError(error, system_code, |
| + std::string(error_message, error_message_size)))); |
| } |
| // Helpers to pass the event to Pepper. |
| @@ -1346,7 +1314,7 @@ void* GetCdmHost(int host_interface_version, void* user_data) { |
| return NULL; |
| static_assert( |
| - cdm::ContentDecryptionModule::Host::kVersion == cdm::Host_7::kVersion, |
| + cdm::ContentDecryptionModule::Host::kVersion == cdm::Host_8::kVersion, |
| "update the code below"); |
| // Ensure IsSupportedCdmHostVersion matches implementation of this function. |
| @@ -1356,22 +1324,22 @@ void* GetCdmHost(int host_interface_version, void* user_data) { |
| PP_DCHECK( |
| // Future version is not supported. |
| - !IsSupportedCdmHostVersion(cdm::Host_7::kVersion + 1) && |
| + !IsSupportedCdmHostVersion(cdm::Host_8::kVersion + 1) && |
| // Current version is supported. |
| - IsSupportedCdmHostVersion(cdm::Host_7::kVersion) && |
| + IsSupportedCdmHostVersion(cdm::Host_8::kVersion) && |
| // Include all previous supported versions (if any) here. |
| - IsSupportedCdmHostVersion(cdm::Host_6::kVersion) && |
| + IsSupportedCdmHostVersion(cdm::Host_7::kVersion) && |
| // One older than the oldest supported version is not supported. |
| - !IsSupportedCdmHostVersion(cdm::Host_6::kVersion - 1)); |
| + !IsSupportedCdmHostVersion(cdm::Host_7::kVersion - 1)); |
| PP_DCHECK(IsSupportedCdmHostVersion(host_interface_version)); |
| CdmAdapter* cdm_adapter = static_cast<CdmAdapter*>(user_data); |
| CDM_DLOG() << "Create CDM Host with version " << host_interface_version; |
| switch (host_interface_version) { |
| + case cdm::Host_8::kVersion: |
| + return static_cast<cdm::Host_8*>(cdm_adapter); |
| case cdm::Host_7::kVersion: |
| return static_cast<cdm::Host_7*>(cdm_adapter); |
| - case cdm::Host_6::kVersion: |
| - return static_cast<cdm::Host_6*>(cdm_adapter); |
| default: |
| PP_NOTREACHED(); |
| return NULL; |