Skip to content

Commit

Permalink
Changes to support CDM_7
Browse files Browse the repository at this point in the history
Add support for CDM_7 and update Pepper to support the updated
interface.

Changes:
- Rename CreateSession() to CreateSessionAndGenerateRequest()
  with reordered parameter list.
- Add |session_type| to LoadSession().
- OnSessionMessage() adds |message_type|, removes |destination_url|.
- OnSessionKeysChange() adds |key_information|.
- Remove GetUsableKeyIds()
- Remove OnPromiseResolvedWithKeyIds()
- Remove OnSessionReady().

BUG=428384
TEST=existing EME test cases pass

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

Cr-Commit-Position: refs/heads/master@{#310615}
  • Loading branch information
jrummell-chromium authored and Commit bot committed Jan 8, 2015
1 parent 2e8ed92 commit a68c98f
Show file tree
Hide file tree
Showing 31 changed files with 914 additions and 982 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ deps = {
Var('chromium_git') + '/chromium/deps/opus.git' + '@' + 'cae696156f1e60006e39821e79a1811ae1933c69',

'src/media/cdm/ppapi/api':
Var('chromium_git') + '/chromium/cdm.git' + '@' + 'f924b6382b05c57677455ac40f210b33809591ef', # from svn revision 292736
Var('chromium_git') + '/chromium/cdm.git' + '@' + '09203a77eb272cd112faa401428c6b5e8fb8b437', # from svn revision 293431

'src/third_party/mesa/src':
Var('chromium_git') + '/chromium/deps/mesa.git' + '@' + '071d25db04c23821a12a8b260ab9d96a097402f0',
Expand Down
56 changes: 18 additions & 38 deletions content/renderer/pepper/content_decryptor_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,12 @@ media::SampleFormat PpDecryptedSampleFormatToMediaSampleFormat(

PP_SessionType MediaSessionTypeToPpSessionType(
MediaKeys::SessionType session_type) {
// TODO(jrummell): Add support for PP_SESSIONTYPE_RELEASE_LICENSE.
switch (session_type) {
case MediaKeys::TEMPORARY_SESSION:
return PP_SESSIONTYPE_TEMPORARY;
case MediaKeys::PERSISTENT_SESSION:
return PP_SESSIONTYPE_PERSISTENT;
return PP_SESSIONTYPE_PERSISTENT_LICENSE;
default:
NOTREACHED();
return PP_SESSIONTYPE_TEMPORARY;
Expand Down Expand Up @@ -321,6 +322,7 @@ ContentDecryptorDelegate::~ContentDecryptorDelegate() {
SatisfyAllPendingCallbacksOnError();
}

// TODO(jrummell): Remove |session_ready_cb| and |session_keys_change_cb|.
void ContentDecryptorDelegate::Initialize(
const std::string& key_system,
const media::SessionMessageCB& session_message_cb,
Expand Down Expand Up @@ -379,21 +381,19 @@ void ContentDecryptorDelegate::CreateSessionAndGenerateRequest(
PP_Var init_data_array =
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
init_data_length, init_data);
// TODO(jrummell): Update pepper to rename method.
plugin_decryption_interface_->CreateSession(
pp_instance_,
promise_id,
StringVar::StringToPPVar(init_data_type),
init_data_array,
MediaSessionTypeToPpSessionType(session_type));
plugin_decryption_interface_->CreateSessionAndGenerateRequest(
pp_instance_, promise_id, MediaSessionTypeToPpSessionType(session_type),
StringVar::StringToPPVar(init_data_type), init_data_array);
}

// TODO(jrummell): Pass |session_type| to this method.
void ContentDecryptorDelegate::LoadSession(
const std::string& web_session_id,
scoped_ptr<NewSessionCdmPromise> promise) {
uint32_t promise_id = SavePromise(promise.Pass());
plugin_decryption_interface_->LoadSession(
pp_instance_, promise_id, StringVar::StringToPPVar(web_session_id));
pp_instance_, promise_id, PP_SESSIONTYPE_PERSISTENT_LICENSE,
StringVar::StringToPPVar(web_session_id));
}

void ContentDecryptorDelegate::UpdateSession(
Expand Down Expand Up @@ -714,14 +714,6 @@ void ContentDecryptorDelegate::OnPromiseResolvedWithSession(
session_promise->resolve(web_session_id_string->value());
}

void ContentDecryptorDelegate::OnPromiseResolvedWithKeyIds(
uint32 promise_id,
PP_Var key_ids_array) {
// Since there are no calls to GetUsableKeyIds(), this should never be called.
// FIXME(jrummell): remove once CDM interface updated.
NOTREACHED();
}

void ContentDecryptorDelegate::OnPromiseRejected(
uint32 promise_id,
PP_CdmExceptionCode exception_code,
Expand All @@ -741,9 +733,10 @@ void ContentDecryptorDelegate::OnPromiseRejected(
}
}

// TODO(jrummell): Pass |message_type| to the callback.
void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id,
PP_Var message,
PP_Var destination_url) {
PP_CdmMessageType message_type,
PP_Var message) {
if (session_message_cb_.is_null())
return;

Expand All @@ -757,23 +750,16 @@ void ContentDecryptorDelegate::OnSessionMessage(PP_Var web_session_id,
message_vector.assign(data, data + message_array_buffer->ByteLength());
}

StringVar* destination_url_string = StringVar::FromPPVar(destination_url);
DCHECK(destination_url_string);

GURL verified_gurl = GURL(destination_url_string->value());
if (!verified_gurl.is_valid() && !verified_gurl.is_empty()) {
DLOG(WARNING) << "SessionMessage default_url is invalid : "
<< verified_gurl.possibly_invalid_spec();
verified_gurl = GURL::EmptyGURL(); // Replace invalid destination_url.
}

session_message_cb_.Run(
web_session_id_string->value(), message_vector, verified_gurl);
session_message_cb_.Run(web_session_id_string->value(), message_vector,
GURL::EmptyGURL());
}

// TODO(jrummell): Decode |key_information| and pass it to the callback.
void ContentDecryptorDelegate::OnSessionKeysChange(
PP_Var web_session_id,
PP_Bool has_additional_usable_key) {
PP_Bool has_additional_usable_key,
uint32_t key_count,
const struct PP_KeyInformation key_information[]) {
if (session_keys_change_cb_.is_null())
return;

Expand All @@ -799,12 +785,6 @@ void ContentDecryptorDelegate::OnSessionExpirationChange(
ppapi::PPTimeToTime(new_expiry_time));
}

void ContentDecryptorDelegate::OnSessionReady(PP_Var web_session_id) {
// Ready events no longer generated.
// TODO(jrummell): Remove event from Pepper.
NOTREACHED();
}

void ContentDecryptorDelegate::OnSessionClosed(PP_Var web_session_id) {
if (session_closed_cb_.is_null())
return;
Expand Down
10 changes: 5 additions & 5 deletions content/renderer/pepper/content_decryptor_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ class ContentDecryptorDelegate {
// PPB_ContentDecryptor_Private dispatching methods.
void OnPromiseResolved(uint32 promise_id);
void OnPromiseResolvedWithSession(uint32 promise_id, PP_Var web_session_id);
void OnPromiseResolvedWithKeyIds(uint32 promise_id, PP_Var key_ids_array);
void OnPromiseRejected(uint32 promise_id,
PP_CdmExceptionCode exception_code,
uint32 system_code,
PP_Var error_description);
void OnSessionMessage(PP_Var web_session_id,
PP_Var message,
PP_Var destination_url);
PP_CdmMessageType message_type,
PP_Var message);
void OnSessionKeysChange(PP_Var web_session_id,
PP_Bool has_additional_usable_key);
PP_Bool has_additional_usable_key,
uint32_t key_count,
const struct PP_KeyInformation key_information[]);
void OnSessionExpirationChange(PP_Var web_session_id,
PP_Time new_expiry_time);
void OnSessionReady(PP_Var web_session_id);
void OnSessionClosed(PP_Var web_session_id);
void OnSessionError(PP_Var web_session_id,
PP_CdmExceptionCode exception_code,
Expand Down
27 changes: 9 additions & 18 deletions content/renderer/pepper/pepper_plugin_instance_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2411,13 +2411,6 @@ void PepperPluginInstanceImpl::PromiseResolvedWithSession(
web_session_id_var);
}

void PepperPluginInstanceImpl::PromiseResolvedWithKeyIds(PP_Instance instance,
uint32 promise_id,
PP_Var key_ids_var) {
content_decryptor_delegate_->OnPromiseResolvedWithKeyIds(promise_id,
key_ids_var);
}

void PepperPluginInstanceImpl::PromiseRejected(
PP_Instance instance,
uint32 promise_id,
Expand All @@ -2430,18 +2423,21 @@ void PepperPluginInstanceImpl::PromiseRejected(

void PepperPluginInstanceImpl::SessionMessage(PP_Instance instance,
PP_Var web_session_id_var,
PP_Var message_var,
PP_Var destination_url_var) {
content_decryptor_delegate_->OnSessionMessage(
web_session_id_var, message_var, destination_url_var);
PP_CdmMessageType message_type,
PP_Var message_var) {
content_decryptor_delegate_->OnSessionMessage(web_session_id_var,
message_type, message_var);
}

void PepperPluginInstanceImpl::SessionKeysChange(
PP_Instance instance,
PP_Var web_session_id_var,
PP_Bool has_additional_usable_key) {
PP_Bool has_additional_usable_key,
uint32_t key_count,
const struct PP_KeyInformation key_information[]) {
content_decryptor_delegate_->OnSessionKeysChange(web_session_id_var,
has_additional_usable_key);
has_additional_usable_key,
key_count, key_information);
}

void PepperPluginInstanceImpl::SessionExpirationChange(
Expand All @@ -2452,11 +2448,6 @@ void PepperPluginInstanceImpl::SessionExpirationChange(
new_expiry_time);
}

void PepperPluginInstanceImpl::SessionReady(PP_Instance instance,
PP_Var web_session_id_var) {
content_decryptor_delegate_->OnSessionReady(web_session_id_var);
}

void PepperPluginInstanceImpl::SessionClosed(PP_Instance instance,
PP_Var web_session_id_var) {
content_decryptor_delegate_->OnSessionClosed(web_session_id_var);
Expand Down
17 changes: 8 additions & 9 deletions content/renderer/pepper/pepper_plugin_instance_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,25 +471,24 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
void PromiseResolvedWithSession(PP_Instance instance,
uint32 promise_id,
PP_Var web_session_id_var) override;
void PromiseResolvedWithKeyIds(PP_Instance instance,
uint32 promise_id,
PP_Var key_ids_var) override;
void PromiseRejected(PP_Instance instance,
uint32 promise_id,
PP_CdmExceptionCode exception_code,
uint32 system_code,
PP_Var error_description_var) override;
void SessionMessage(PP_Instance instance,
PP_Var web_session_id_var,
PP_Var message_var,
PP_Var destination_url_var) override;
void SessionKeysChange(PP_Instance instance,
PP_Var web_session_id_var,
PP_Bool has_additional_usable_key) override;
PP_CdmMessageType message_type,
PP_Var message_var) override;
void SessionKeysChange(
PP_Instance instance,
PP_Var web_session_id_var,
PP_Bool has_additional_usable_key,
uint32_t key_count,
const struct PP_KeyInformation key_information[]) override;
void SessionExpirationChange(PP_Instance instance,
PP_Var web_session_id_var,
PP_Time new_expiry_time) override;
void SessionReady(PP_Instance instance, PP_Var web_session_id_var) override;
void SessionClosed(PP_Instance instance, PP_Var web_session_id_var) override;
void SessionError(PP_Instance instance,
PP_Var web_session_id_var,
Expand Down
Loading

0 comments on commit a68c98f

Please sign in to comment.