summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authortomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 10:48:53 +0000
committertomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 10:48:53 +0000
commit467434d8392add1af93387ca9214ee966c673a63 (patch)
tree9634b36adae96aca3aad1f8a5d82505f60306e94 /webkit
parente4486338b71884677a6b59e91aff0aeff769d092 (diff)
downloadchromium_src-467434d8392add1af93387ca9214ee966c673a63.zip
chromium_src-467434d8392add1af93387ca9214ee966c673a63.tar.gz
chromium_src-467434d8392add1af93387ca9214ee966c673a63.tar.bz2
Generalize Pepper CDM API decrypt and decode.
- Removes PP_EncryptedVideoFrameInfo. - Replaces PPP_ContentDecryptor_Private::DecryptAndDecodeFrame() with DecryptAndDecode(). BUG=141780 TEST= Review URL: https://chromiumcodereview.appspot.com/11087044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161551 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/media/crypto/ppapi/cdm_wrapper.cc25
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc32
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h4
3 files changed, 31 insertions, 30 deletions
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc
index 1852508..b082c49 100644
--- a/webkit/media/crypto/ppapi/cdm_wrapper.cc
+++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc
@@ -411,9 +411,10 @@ class CdmWrapper : public pp::Instance,
uint32_t request_id) OVERRIDE;
virtual void ResetDecoder(PP_DecryptorStreamType decoder_type,
uint32_t request_id) OVERRIDE;
- virtual void DecryptAndDecodeFrame(
- pp::Buffer_Dev encrypted_frame,
- const PP_EncryptedVideoFrameInfo& encrypted_video_frame_info) OVERRIDE;
+ virtual void DecryptAndDecode(
+ PP_DecryptorStreamType decoder_type,
+ pp::Buffer_Dev encrypted_buffer,
+ const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE;
// CdmHost methods.
virtual void SetTimer(int64 delay_ms) OVERRIDE;
@@ -623,16 +624,20 @@ void CdmWrapper::ResetDecoder(PP_DecryptorStreamType decoder_type,
request_id));
}
-void CdmWrapper::DecryptAndDecodeFrame(
- pp::Buffer_Dev encrypted_frame,
- const PP_EncryptedVideoFrameInfo& encrypted_video_frame_info) {
- PP_DCHECK(!encrypted_frame.is_null());
+void CdmWrapper::DecryptAndDecode(
+ PP_DecryptorStreamType decoder_type,
+ pp::Buffer_Dev encrypted_buffer,
+ const PP_EncryptedBlockInfo& encrypted_block_info) {
+ // TODO(tomfinegan): Remove this check when audio decoding is added.
+ PP_DCHECK(decoder_type == PP_DECRYPTORSTREAMTYPE_VIDEO);
+
+ PP_DCHECK(!encrypted_buffer.is_null());
PP_DCHECK(cdm_);
cdm::InputBuffer input_buffer;
std::vector<cdm::SubsampleEntry> subsamples;
- ConfigureInputBuffer(encrypted_frame,
- encrypted_video_frame_info.encryption_info,
+ ConfigureInputBuffer(encrypted_buffer,
+ encrypted_block_info,
&subsamples,
&input_buffer);
@@ -643,7 +648,7 @@ void CdmWrapper::DecryptAndDecodeFrame(
&CdmWrapper::DeliverFrame,
status,
video_frame,
- encrypted_video_frame_info.encryption_info.tracking_info));
+ encrypted_block_info.tracking_info));
}
void CdmWrapper::SetTimer(int64 delay_ms) {
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index d835954..d630a72 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1631,42 +1631,38 @@ bool PluginInstance::ResetDecoder() {
return true;
}
-bool PluginInstance::DecryptAndDecodeFrame(
- const scoped_refptr<media::DecoderBuffer>& encrypted_frame,
+bool PluginInstance::DecryptAndDecode(
+ const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
const media::Decryptor::DecryptCB& decrypt_cb) {
if (!LoadContentDecryptorInterface())
return false;
ScopedPPResource encrypted_resource(MakeBufferResource(
pp_instance(),
- encrypted_frame->GetData(),
- encrypted_frame->GetDataSize()));
+ encrypted_buffer->GetData(),
+ encrypted_buffer->GetDataSize()));
if (!encrypted_resource.get())
return false;
const uint32_t request_id = next_decryption_request_id_++;
- // TODO(tomfinegan): Need to get the video format information here somehow.
- PP_EncryptedVideoFrameInfo frame_info;
- frame_info.width = 0;
- frame_info.height = 0;
- frame_info.format = PP_DECRYPTEDFRAMEFORMAT_UNKNOWN;
- frame_info.codec = PP_VIDEOCODEC_UNKNOWN;
-
- DCHECK(encrypted_frame->GetDecryptConfig());
- if (!MakeEncryptedBlockInfo(*encrypted_frame->GetDecryptConfig(),
- encrypted_frame->GetTimestamp().InMicroseconds(),
+ PP_EncryptedBlockInfo block_info;
+ DCHECK(encrypted_buffer->GetDecryptConfig());
+ if (!MakeEncryptedBlockInfo(*encrypted_buffer->GetDecryptConfig(),
+ encrypted_buffer->GetTimestamp().InMicroseconds(),
request_id,
- &frame_info.encryption_info)) {
+ &block_info)) {
return false;
}
DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
- plugin_decryption_interface_->DecryptAndDecodeFrame(pp_instance(),
- encrypted_resource,
- &frame_info);
+ // TODO(tomfinegan): Need to get stream type from media stack.
+ plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
+ PP_DECRYPTORSTREAMTYPE_VIDEO,
+ encrypted_resource,
+ &block_info);
return true;
}
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 0246f7e..e5edb59 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -273,8 +273,8 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
bool ResetDecoder();
// TODO(xhwang): Update this when we need to support decrypt and decode.
// Note: This method can be used with an unencrypted frame.
- bool DecryptAndDecodeFrame(
- const scoped_refptr<media::DecoderBuffer>& encrypted_frame,
+ bool DecryptAndDecode(
+ const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
const media::Decryptor::DecryptCB& decrypt_cb);
// There are 2 implementations of the fullscreen interface