| 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..0ab386c84741cc8a5cdca2a1ed13aa0e1f9b9a5e 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::kKeyIds;
|
| +}
|
| +
|
| 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();
|
| @@ -340,6 +357,8 @@ void CdmAdapter::Initialize(const std::string& key_system,
|
| bool allow_distinctive_identifier,
|
| bool allow_persistent_state) {
|
| PP_DCHECK(!key_system.empty());
|
| + // TODO(jrummell): Remove this check when CDM creation is asynchronous.
|
| + // http://crbug.com/469003
|
| PP_DCHECK(key_system_.empty() || (key_system_ == key_system && cdm_));
|
|
|
| #if defined(CHECK_DOCUMENT_URL)
|
| @@ -368,6 +387,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 +419,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/469228
|
| void CdmAdapter::CreateSessionAndGenerateRequest(
|
| uint32_t promise_id,
|
| PP_SessionType session_type,
|
| @@ -419,7 +441,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 +700,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 +730,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 +751,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 +782,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 +797,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 +1316,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 +1326,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;
|
|
|