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

Unified Diff: content/renderer/pepper/pepper_video_source_host.cc

Issue 16335018: Add NaCl proxies for Pepper Video Source and Destination resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create "NaCl style" image data on host side. Created 7 years, 6 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: content/renderer/pepper/pepper_video_source_host.cc
diff --git a/content/renderer/pepper/pepper_video_source_host.cc b/content/renderer/pepper/pepper_video_source_host.cc
index bdbe26608e9137cbbcf366a1a6ccfe9b49c05045..284c95c00932350f946f21cf5dcbb5eecf62897d 100644
--- a/content/renderer/pepper/pepper_video_source_host.cc
+++ b/content/renderer/pepper/pepper_video_source_host.cc
@@ -137,7 +137,8 @@ void PepperVideoSourceHost::SendGetFrameReply() {
int32_t width = base::checked_numeric_cast<int32_t>(frame->GetWidth());
int32_t height = base::checked_numeric_cast<int32_t>(frame->GetHeight());
- // Create an image data resource to hold the frame pixels.
+ // Create an image data resource to hold the frame pixels. We don't require
+ // access to a platform DIB so always create it "NaCl style".
PP_ImageDataDesc image_desc;
IPC::PlatformFileForTransit image_handle;
uint32_t byte_count;
@@ -148,7 +149,7 @@ void PepperVideoSourceHost::SendGetFrameReply() {
PP_IMAGEDATAFORMAT_BGRA_PREMUL,
PP_MakeSize(width, height),
false /* init_to_zero */,
- false /* is_nacl_plugin */,
+ true /* is_nacl_plugin */,
&image_desc, &image_handle, &byte_count));
if (!resource.get()) {
SendGetFrameErrorReply(PP_ERROR_FAILED);
@@ -197,35 +198,31 @@ void PepperVideoSourceHost::SendGetFrameReply() {
frame->GetTimeStamp() / base::Time::kNanosecondsPerMicrosecond);
PP_TimeTicks timestamp = time_delta.InSecondsF();
- reply_context_.params.set_result(PP_OK);
-
+ int shmem_key =
dmichael (off chromium) 2013/06/05 01:54:42 You should be able to get rid of this and the asso
bbudge 2013/06/05 19:18:52 It's still needed on Linux for trusted plugins. On
bbudge 2013/06/19 00:22:32 Done.
#if defined(TOOLKIT_GTK)
// For GTK, we pass the SysV shared memory key in the message.
- PpapiPluginMsg_VideoSource_GetFrameReply reply_msg(host_resource,
- image_desc,
- image_handle.fd,
- timestamp);
-#elif defined(OS_POSIX) || defined(OS_WIN)
- ppapi::proxy::SerializedHandle serialized_handle;
- PpapiPluginMsg_VideoSource_GetFrameReply reply_msg(host_resource,
- image_desc,
- 0,
- timestamp);
- serialized_handle.set_shmem(image_handle, byte_count);
- reply_context_.params.AppendHandle(serialized_handle);
+ image_handle.fd;
#else
+ 0;
+#endif
+
+#if !defined(OS_POSIX) && !defined(OS_WIN)
// Not supported on other platforms.
- // This is a stub reply_msg to not break the build.
- PpapiPluginMsg_VideoSource_GetFrameReply reply_msg(host_resource,
- image_desc,
- 0,
- timestamp);
NOTIMPLEMENTED();
SendGetFrameErrorReply(PP_ERROR_NOTSUPPORTED);
return;
#endif
- host()->SendReply(reply_context_, reply_msg);
+ reply_context_.params.set_result(PP_OK);
+ ppapi::proxy::SerializedHandle serialized_handle;
+ serialized_handle.set_shmem(image_handle, byte_count);
+ reply_context_.params.AppendHandle(serialized_handle);
+
+ host()->SendReply(reply_context_,
+ PpapiPluginMsg_VideoSource_GetFrameReply(host_resource,
+ image_desc,
+ shmem_key,
+ timestamp));
reply_context_ = ppapi::host::ReplyMessageContext();
@@ -237,8 +234,10 @@ void PepperVideoSourceHost::SendGetFrameErrorReply(int32_t error) {
reply_context_.params.set_result(error);
host()->SendReply(
reply_context_,
- PpapiPluginMsg_VideoSource_GetFrameReply(
- ppapi::HostResource(), PP_ImageDataDesc(), -1, 0.0));
+ PpapiPluginMsg_VideoSource_GetFrameReply(ppapi::HostResource(),
+ PP_ImageDataDesc(),
+ -1 /* shmem_key */,
+ 0.0 /* timestamp */));
reply_context_ = ppapi::host::ReplyMessageContext();
}

Powered by Google App Engine
This is Rietveld 408576698