Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Changing the behavior of ReleaseSession() from Close() to Remove()
Browse files Browse the repository at this point in the history
With the recent EME spec changes, ReleaseSession() got replaced by
CloseSession() and RemoveSession(). Until all the changes to support
both methods are in place, calls to ReleaseSession() should call
RemoveSession() in order for existing prefixed EME applications
to continue to work.

Unprefixed Close() calls now call RemoveSession(), and thus don't do
the correct thing. This will be fixed when both CloseSession() and
RemoveSession() are passed through Pepper.

BUG=406606
TEST=All EME browser_tests pass

Review URL: https://codereview.chromium.org/497153005

Cr-Commit-Position: refs/heads/master@{#291602}
  • Loading branch information
jrummell-chromium authored and Commit bot committed Aug 23, 2014
1 parent 6e80cfe commit ec6d38e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
18 changes: 9 additions & 9 deletions media/cdm/ppapi/cdm_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -383,21 +383,21 @@ void CdmAdapter::UpdateSession(uint32_t promise_id,
response_size);
}

void CdmAdapter::ReleaseSession(uint32_t promise_id,
const std::string& web_session_id) {
cdm_->CloseSession(
promise_id, web_session_id.data(), web_session_id.length());
}

void CdmAdapter::RemoveSession(uint32_t promise_id,
const std::string& web_session_id) {
if (!cdm_->RemoveSession(
void CdmAdapter::CloseSession(uint32_t promise_id,
const std::string& web_session_id) {
if (!cdm_->CloseSession(
promise_id, web_session_id.data(), web_session_id.length())) {
// CDM_4 and CDM_5 don't support this method, so reject the promise.
RejectPromise(promise_id, cdm::kNotSupportedError, 0, "Not implemented.");
}
}

void CdmAdapter::ReleaseSession(uint32_t promise_id,
const std::string& web_session_id) {
cdm_->RemoveSession(
promise_id, web_session_id.data(), web_session_id.length());
}

void CdmAdapter::GetUsableKeyIds(uint32_t promise_id,
const std::string& web_session_id) {
if (!cdm_->GetUsableKeyIds(
Expand Down
9 changes: 5 additions & 4 deletions media/cdm/ppapi/cdm_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ class CdmAdapter : public pp::Instance,
virtual void UpdateSession(uint32_t promise_id,
const std::string& web_session_id,
pp::VarArrayBuffer response) OVERRIDE;
// TODO(jrummell): Rename to CloseSession().
// TODO(jrummell): Pass this function through Pepper and add OVERRIDE.
virtual void CloseSession(uint32_t promise_id,
const std::string& web_session_id);
// TODO(jrummell): Rename to RemoveSession().
virtual void ReleaseSession(uint32_t promise_id,
const std::string& web_session_id) OVERRIDE;
// TODO(jrummell): Pass these 2 functions through Pepper and add OVERRIDE.
virtual void RemoveSession(uint32_t promise_id,
const std::string& web_session_id);
// TODO(jrummell): Pass this function through Pepper and add OVERRIDE.
virtual void GetUsableKeyIds(uint32_t promise_id,
const std::string& web_session_id);
virtual void Decrypt(
Expand Down
34 changes: 18 additions & 16 deletions media/cdm/ppapi/cdm_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ class CdmWrapper {
uint32_t web_session_id_size,
const uint8_t* response,
uint32_t response_size) = 0;
virtual void CloseSession(uint32_t promise_id,
// TODO(jrummell): Remove return value when CDM4/5 are removed.
virtual bool CloseSession(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) = 0;
virtual bool RemoveSession(uint32_t promise_id,
virtual void RemoveSession(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) = 0;
// TODO(jrummell): Remove return value when CDM4/5 are removed.
virtual bool GetUsableKeyIds(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) = 0;
Expand Down Expand Up @@ -226,17 +228,17 @@ class CdmWrapperImpl : public CdmWrapper {
return true;
}

virtual void CloseSession(uint32_t promise_id,
virtual bool CloseSession(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) OVERRIDE {
cdm_->CloseSession(promise_id, web_session_id, web_session_id_size);
return true;
}

virtual bool RemoveSession(uint32_t promise_id,
virtual void RemoveSession(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) OVERRIDE {
cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size);
return true;
}

virtual void TimerExpired(void* context) OVERRIDE {
Expand Down Expand Up @@ -454,22 +456,22 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::UpdateSession(
}

template <>
void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
std::string web_session_str(web_session_id, web_session_id_size);
uint32_t session_id = LookupSessionId(web_session_str);
RegisterPromise(session_id, promise_id);
cdm_->ReleaseSession(session_id);
return false;
}

template <>
bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
return false;
std::string web_session_str(web_session_id, web_session_id_size);
uint32_t session_id = LookupSessionId(web_session_str);
RegisterPromise(session_id, promise_id);
cdm_->ReleaseSession(session_id);
}

template <>
Expand Down Expand Up @@ -572,19 +574,19 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::UpdateSession(
}

template <>
void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
return false;
}

template <>
bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
return false;
cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
}

template <>
Expand Down

0 comments on commit ec6d38e

Please sign in to comment.