Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3649)

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 11023004: Update PPP side of Pepper CDM API to support video decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set PPP interface version to 0.2 Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 785217674f2e6cdfa2cac2ea7b65690e60777061..f7199f590f92e96c5e4780ba3f62ea3ed8639739 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -342,7 +342,9 @@ bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) {
// Fills the |block_info| with information from |decrypt_config|, |timestamp|
// and |request_id|.
-// Returns true if |block_info| is successfully filled. Returns false otherwise.
+// Returns true if |block_info| is successfully filled. Returns false
+// otherwise.
+// Note: This function does not require that data is encrypted.
bool MakeEncryptedBlockInfo(
const media::DecryptConfig& decrypt_config,
int64_t timestamp,
@@ -1544,25 +1546,42 @@ bool PluginInstance::Decrypt(
return true;
}
-bool PluginInstance::DecryptAndDecode(
- const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
+bool PluginInstance::DecryptAndDecodeFrame(
+ const scoped_refptr<media::DecoderBuffer>& encrypted_frame,
const media::Decryptor::DecryptCB& decrypt_cb) {
if (!LoadContentDecryptorInterface())
return false;
ScopedPPResource encrypted_resource(MakeBufferResource(
pp_instance(),
- encrypted_buffer->GetData(),
- encrypted_buffer->GetDataSize()));
+ encrypted_frame->GetData(),
+ encrypted_frame->GetDataSize()));
if (!encrypted_resource.get())
return false;
- PP_EncryptedBlockInfo block_info;
+ 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(),
+ request_id,
+ &frame_info.encryption_info)) {
+ return false;
+ }
+
+ DCHECK(!ContainsKey(pending_decryption_cbs_, request_id));
+ pending_decryption_cbs_.insert(std::make_pair(request_id, decrypt_cb));
- // TODO(tomfinegan): Store callback and ID in a map, and pass ID to decryptor.
- plugin_decryption_interface_->DecryptAndDecode(pp_instance(),
- encrypted_resource,
- &block_info);
+ plugin_decryption_interface_->DecryptAndDecodeFrame(pp_instance(),
+ encrypted_resource,
+ &frame_info);
return true;
}
« webkit/plugins/ppapi/ppapi_plugin_instance.h ('K') | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698