| Index: media/cdm/ppapi/cdm_wrapper.h
|
| diff --git a/media/cdm/ppapi/cdm_wrapper.h b/media/cdm/ppapi/cdm_wrapper.h
|
| index 99e5c0468410587a6d793d6ccab264aee9d39491..818f0e14f859c5f6820abca39d945cb294bb77c5 100644
|
| --- a/media/cdm/ppapi/cdm_wrapper.h
|
| +++ b/media/cdm/ppapi/cdm_wrapper.h
|
| @@ -53,10 +53,15 @@ class CdmWrapper {
|
| virtual ~CdmWrapper() {};
|
|
|
| virtual void CreateSession(uint32_t session_id,
|
| - const char* type,
|
| - uint32_t type_size,
|
| + const char* content_type,
|
| + uint32_t content_type_size,
|
| const uint8_t* init_data,
|
| uint32_t init_data_size) = 0;
|
| + // Returns whether LoadSesson() is supported by the CDM.
|
| + // TODO(xhwang): Remove the return value when CDM_1 and CDM_2 are deprecated.
|
| + virtual bool LoadSession(uint32_t session_id,
|
| + const char* web_session_id,
|
| + uint32_t web_session_id_size) = 0;
|
| virtual Result UpdateSession(uint32_t session_id,
|
| const uint8_t* response,
|
| uint32_t response_size) = 0;
|
| @@ -148,28 +153,19 @@ class CdmWrapperImpl : public CdmWrapper {
|
| }
|
|
|
| virtual void CreateSession(uint32_t session_id,
|
| - const char* type,
|
| - uint32_t type_size,
|
| + const char* content_type,
|
| + uint32_t content_type_size,
|
| const uint8_t* init_data,
|
| uint32_t init_data_size) OVERRIDE {
|
| - // TODO(xhwang): Update the full MediaKeys stack to support LoadSession.
|
| - // See: http://crbug.com/338831
|
| - const uint8_t kPrefixedApiLoadSessionHeader[] = "LOAD_SESSION|";
|
| - const size_t kPrefixedApiLoadSessionHeaderSize =
|
| - sizeof(kPrefixedApiLoadSessionHeader) - 1;
|
| -
|
| - if (init_data_size > kPrefixedApiLoadSessionHeaderSize &&
|
| - std::equal(init_data,
|
| - init_data + kPrefixedApiLoadSessionHeaderSize,
|
| - kPrefixedApiLoadSessionHeader)) {
|
| - cdm_->LoadSession(session_id,
|
| - reinterpret_cast<const char*>(
|
| - init_data + kPrefixedApiLoadSessionHeaderSize),
|
| - init_data_size - kPrefixedApiLoadSessionHeaderSize);
|
| - return;
|
| - }
|
| + cdm_->CreateSession(
|
| + session_id, content_type, content_type_size, init_data, init_data_size);
|
| + }
|
|
|
| - cdm_->CreateSession(session_id, type, type_size, init_data, init_data_size);
|
| + virtual bool LoadSession(uint32_t session_id,
|
| + const char* web_session_id,
|
| + uint32_t web_session_id_size) OVERRIDE {
|
| + cdm_->LoadSession(session_id, web_session_id, web_session_id_size);
|
| + return true;
|
| }
|
|
|
| virtual Result UpdateSession(uint32_t session_id,
|
| @@ -268,7 +264,8 @@ class CdmWrapperImpl : public CdmWrapper {
|
| }
|
|
|
| const std::string LookupWebSessionId(uint32_t session_id) {
|
| - // Session may not exist if error happens during CreateSession().
|
| + // Session may not exist if error happens during CreateSession() or
|
| + // LoadSession().
|
| SessionMap::iterator it = session_map_.find(session_id);
|
| return (it != session_map_.end()) ? it->second : std::string();
|
| }
|
| @@ -284,24 +281,24 @@ class CdmWrapperImpl : public CdmWrapper {
|
| };
|
|
|
| // For ContentDecryptionModule_1 and ContentDecryptionModule_2,
|
| -// CreateSession(), UpdateSession(), and ReleaseSession() call methods
|
| -// are incompatible with ContentDecryptionModule_4. Use the following
|
| +// CreateSession(), LoadSession(), UpdateSession(), and ReleaseSession() call
|
| +// methods are incompatible with ContentDecryptionModule_4. Use the following
|
| // templated functions to handle this.
|
|
|
| template <class CdmInterface>
|
| void PrefixedGenerateKeyRequest(CdmWrapper* wrapper,
|
| CdmInterface* cdm,
|
| uint32_t session_id,
|
| - const char* type,
|
| - uint32_t type_size,
|
| + const char* content_type,
|
| + uint32_t content_type_size,
|
| const uint8_t* init_data,
|
| uint32_t init_data_size) {
|
| // As it is possible for CDMs to reply synchronously during the call to
|
| // GenerateKeyRequest(), keep track of |session_id|.
|
| wrapper->current_key_request_session_id_ = session_id;
|
|
|
| - cdm::Status status =
|
| - cdm->GenerateKeyRequest(type, type_size, init_data, init_data_size);
|
| + cdm::Status status = cdm->GenerateKeyRequest(
|
| + content_type, content_type_size, init_data, init_data_size);
|
| PP_DCHECK(status == cdm::kSuccess || status == cdm::kSessionError);
|
| if (status != cdm::kSuccess) {
|
| // If GenerateKeyRequest() failed, no subsequent asynchronous replies
|
| @@ -378,12 +375,25 @@ CdmWrapper::Result PrefixedCancelKeyRequest(CdmWrapper* wrapper,
|
| template <>
|
| void CdmWrapperImpl<cdm::ContentDecryptionModule_1>::CreateSession(
|
| uint32_t session_id,
|
| - const char* type,
|
| - uint32_t type_size,
|
| + const char* content_type,
|
| + uint32_t content_type_size,
|
| const uint8_t* init_data,
|
| uint32_t init_data_size) {
|
| - PrefixedGenerateKeyRequest(
|
| - this, cdm_, session_id, type, type_size, init_data, init_data_size);
|
| + PrefixedGenerateKeyRequest(this,
|
| + cdm_,
|
| + session_id,
|
| + content_type,
|
| + content_type_size,
|
| + init_data,
|
| + init_data_size);
|
| +}
|
| +
|
| +template <>
|
| +bool CdmWrapperImpl<cdm::ContentDecryptionModule_1>::LoadSession(
|
| + uint32_t session_id,
|
| + const char* web_session_id,
|
| + uint32_t web_session_id_size) {
|
| + return false;
|
| }
|
|
|
| template <>
|
| @@ -431,12 +441,25 @@ template <> cdm::Status CdmWrapperImpl<cdm::ContentDecryptionModule_1>::
|
| template <>
|
| void CdmWrapperImpl<cdm::ContentDecryptionModule_2>::CreateSession(
|
| uint32_t session_id,
|
| - const char* type,
|
| - uint32_t type_size,
|
| + const char* content_type,
|
| + uint32_t content_type_size,
|
| const uint8_t* init_data,
|
| uint32_t init_data_size) {
|
| - PrefixedGenerateKeyRequest(
|
| - this, cdm_, session_id, type, type_size, init_data, init_data_size);
|
| + PrefixedGenerateKeyRequest(this,
|
| + cdm_,
|
| + session_id,
|
| + content_type,
|
| + content_type_size,
|
| + init_data,
|
| + init_data_size);
|
| +}
|
| +
|
| +template <>
|
| +bool CdmWrapperImpl<cdm::ContentDecryptionModule_2>::LoadSession(
|
| + uint32_t session_id,
|
| + const char* web_session_id,
|
| + uint32_t web_session_id_size) {
|
| + return false;
|
| }
|
|
|
| template <>
|
|
|