diff options
author | tomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 00:41:21 +0000 |
---|---|---|
committer | tomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 00:41:21 +0000 |
commit | 27c59ba15305e33fa316154dc87b6cc5c71c2843 (patch) | |
tree | de7eaa732da77c33528b2e34991e2cb38cea4a0b /ppapi | |
parent | f429bc913006b1fb038ece04b6846aef3590b154 (diff) | |
download | chromium_src-27c59ba15305e33fa316154dc87b6cc5c71c2843.zip chromium_src-27c59ba15305e33fa316154dc87b6cc5c71c2843.tar.gz chromium_src-27c59ba15305e33fa316154dc87b6cc5c71c2843.tar.bz2 |
Fix in process PPAPI decryption.
TEST=EME content decryption via ExternalClearKey works in-process.
Review URL: https://chromiumcodereview.appspot.com/11477002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/api/private/ppb_content_decryptor_private.idl | 18 | ||||
-rw-r--r-- | ppapi/c/private/ppb_content_decryptor_private.h | 20 | ||||
-rw-r--r-- | ppapi/cpp/private/content_decryptor_private.cc | 4 | ||||
-rw-r--r-- | ppapi/cpp/private/content_decryptor_private.h | 13 | ||||
-rw-r--r-- | ppapi/proxy/ppp_content_decryptor_private_proxy.cc | 19 |
5 files changed, 48 insertions, 26 deletions
diff --git a/ppapi/api/private/ppb_content_decryptor_private.idl b/ppapi/api/private/ppb_content_decryptor_private.idl index e5e021a..6b3dc85 100644 --- a/ppapi/api/private/ppb_content_decryptor_private.idl +++ b/ppapi/api/private/ppb_content_decryptor_private.idl @@ -133,6 +133,10 @@ interface PPB_ContentDecryptor_Private { * <code>PPP_ContentDecryptor_Private</code> interface completes to * deliver decrypted_block to the browser for decoding and rendering. * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>Decrypt()</code> when it calls this method. The browser + * will reuse the buffer in a subsequent <code>Decrypt()</code> call. + * * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data * block. @@ -207,6 +211,11 @@ interface PPB_ContentDecryptor_Private { * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver * a decrypted and decoded video frame to the browser for rendering. * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>DecryptAndDecode()</code> when it calls this method. The + * browser will reuse the buffer in a subsequent + * <code>DecryptAndDecode()</code> call. + * * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a * <code>PPB_Buffer_Dev</code> resource that contains a video frame. * @@ -221,10 +230,15 @@ interface PPB_ContentDecryptor_Private { /** * Called after the <code>DecryptAndDecode()</code> method on the - * <code>PPP_ContentDecryptor_Private</code> interface completes to - * deliver a buffer of decrypted and decoded audio samples to the browser for + * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver + * a buffer of decrypted and decoded audio samples to the browser for * rendering. * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>DecryptAndDecode()</code> when it calls this method. The + * browser will reuse the buffer in a subsequent + * <code>DecryptAndDecode()</code> call. + * * <code>audio_frames</code> can contain multiple audio output buffers. Each * buffer is serialized in this format: * diff --git a/ppapi/c/private/ppb_content_decryptor_private.h b/ppapi/c/private/ppb_content_decryptor_private.h index 486d9d7..9120984 100644 --- a/ppapi/c/private/ppb_content_decryptor_private.h +++ b/ppapi/c/private/ppb_content_decryptor_private.h @@ -4,7 +4,7 @@ */ /* From private/ppb_content_decryptor_private.idl, - * modified Tue Dec 4 10:30:29 2012. + * modified Mon Dec 10 13:46:33 2012. */ #ifndef PPAPI_C_PRIVATE_PPB_CONTENT_DECRYPTOR_PRIVATE_H_ @@ -148,6 +148,10 @@ struct PPB_ContentDecryptor_Private_0_6 { * <code>PPP_ContentDecryptor_Private</code> interface completes to * deliver decrypted_block to the browser for decoding and rendering. * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>Decrypt()</code> when it calls this method. The browser + * will reuse the buffer in a subsequent <code>Decrypt()</code> call. + * * @param[in] decrypted_block A <code>PP_Resource</code> corresponding to a * <code>PPB_Buffer_Dev</code> resource that contains a decrypted data * block. @@ -215,6 +219,11 @@ struct PPB_ContentDecryptor_Private_0_6 { * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver * a decrypted and decoded video frame to the browser for rendering. * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>DecryptAndDecode()</code> when it calls this method. The + * browser will reuse the buffer in a subsequent + * <code>DecryptAndDecode()</code> call. + * * @param[in] decrypted_frame A <code>PP_Resource</code> corresponding to a * <code>PPB_Buffer_Dev</code> resource that contains a video frame. * @@ -228,10 +237,15 @@ struct PPB_ContentDecryptor_Private_0_6 { const struct PP_DecryptedFrameInfo* decrypted_frame_info); /** * Called after the <code>DecryptAndDecode()</code> method on the - * <code>PPP_ContentDecryptor_Private</code> interface completes to - * deliver a buffer of decrypted and decoded audio samples to the browser for + * <code>PPP_ContentDecryptor_Private</code> interface completes to deliver + * a buffer of decrypted and decoded audio samples to the browser for * rendering. * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to <code>DecryptAndDecode()</code> when it calls this method. The + * browser will reuse the buffer in a subsequent + * <code>DecryptAndDecode()</code> call. + * * <code>audio_frames</code> can contain multiple audio output buffers. Each * buffer is serialized in this format: * diff --git a/ppapi/cpp/private/content_decryptor_private.cc b/ppapi/cpp/private/content_decryptor_private.cc index 3c649f14..d15f0bd 100644 --- a/ppapi/cpp/private/content_decryptor_private.cc +++ b/ppapi/cpp/private/content_decryptor_private.cc @@ -104,7 +104,7 @@ void Decrypt(PP_Instance instance, if (!object) return; - pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource); + pp::Buffer_Dev encrypted_block(encrypted_resource); static_cast<ContentDecryptor_Private*>(object)->Decrypt( encrypted_block, @@ -175,7 +175,7 @@ void DecryptAndDecode(PP_Instance instance, if (!object) return; - pp::Buffer_Dev encrypted_buffer(pp::PassRef(), encrypted_resource); + pp::Buffer_Dev encrypted_buffer(encrypted_resource); static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode( decoder_type, diff --git a/ppapi/cpp/private/content_decryptor_private.h b/ppapi/cpp/private/content_decryptor_private.h index 629540a..4e93657 100644 --- a/ppapi/cpp/private/content_decryptor_private.h +++ b/ppapi/cpp/private/content_decryptor_private.h @@ -68,8 +68,13 @@ class ContentDecryptor_Private { const std::string& session_id, int32_t media_error, int32_t system_code); + + // The plugin must not hold a reference to the encrypted buffer resource + // provided to Decrypt() when it calls this method. The browser will reuse + // the buffer in a subsequent Decrypt() call. void DeliverBlock(pp::Buffer_Dev decrypted_block, const PP_DecryptedBlockInfo& decrypted_block_info); + void DecoderInitializeDone(PP_DecryptorStreamType decoder_type, uint32_t request_id, bool status); @@ -77,8 +82,16 @@ class ContentDecryptor_Private { uint32_t request_id); void DecoderResetDone(PP_DecryptorStreamType decoder_type, uint32_t request_id); + + // The plugin must not hold a reference to the encrypted buffer resource + // provided to DecryptAndDecode() when it calls this method. The browser will + // reuse the buffer in a subsequent DecryptAndDecode() call. void DeliverFrame(pp::Buffer_Dev decrypted_frame, const PP_DecryptedFrameInfo& decrypted_frame_info); + + // The plugin must not hold a reference to the encrypted buffer resource + // provided to DecryptAndDecode() when it calls this method. The browser will + // reuse the buffer in a subsequent DecryptAndDecode() call. void DeliverSamples(pp::Buffer_Dev audio_frames, const PP_DecryptedBlockInfo& decrypted_block_info); diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc index 1b472074..9aca5e7 100644 --- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc +++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc @@ -75,22 +75,6 @@ PP_Var ExtractReceivedVarAndAddRef(Dispatcher* dispatcher, return var; } -// Increments the reference count on |resource| to ensure that it remains valid -// until the plugin receives the resource within the asynchronous message sent -// from the proxy. The plugin side takes ownership of that reference. Returns -// PP_TRUE when the reference is successfully added, PP_FALSE otherwise. -PP_Bool AddRefResourceForPlugin(HostDispatcher* dispatcher, - PP_Resource resource) { - const PPB_Core* core = static_cast<const PPB_Core*>( - dispatcher->local_get_interface()(PPB_CORE_INTERFACE)); - if (!core) { - NOTREACHED(); - return PP_FALSE; - } - core->AddRefResource(resource); - return PP_TRUE; -} - bool InitializePppDecryptorBuffer(PP_Instance instance, HostDispatcher* dispatcher, PP_Resource resource, @@ -107,9 +91,6 @@ bool InitializePppDecryptorBuffer(PP_Instance instance, return true; } - if (!AddRefResourceForPlugin(dispatcher, resource)) - return false; - HostResource host_resource; host_resource.SetHostResource(instance, resource); |