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

Unified Diff: ppapi/proxy/video_source_resource.cc

Issue 15039009: Add PPAPI tests for VideoSource and VideoDestination resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 7 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
« no previous file with comments | « ppapi/proxy/video_source_resource.h ('k') | ppapi/tests/test_video_destination.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/video_source_resource.cc
diff --git a/ppapi/proxy/video_source_resource.cc b/ppapi/proxy/video_source_resource.cc
index 4585eb332fa0cc07021d734d256b657297b7b033..218d8837fcfe1fe360df4af00ffe49f29b0b4207 100644
--- a/ppapi/proxy/video_source_resource.cc
+++ b/ppapi/proxy/video_source_resource.cc
@@ -9,6 +9,7 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/pp_video_frame_private.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ppapi/proxy/ppb_image_data_proxy.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/resource_tracker.h"
#include "ppapi/shared_impl/var.h"
@@ -83,9 +84,9 @@ void VideoSourceResource::Close() {
}
void VideoSourceResource::OnPluginMsgOpenComplete(
- const ResourceMessageReplyParams& params) {
+ const ResourceMessageReplyParams& reply_params) {
if (TrackedCallback::IsPending(open_callback_)) {
- int32_t result = params.result();
+ int32_t result = reply_params.result();
if (result == PP_OK)
is_open_ = true;
open_callback_->Run(result);
@@ -94,15 +95,31 @@ void VideoSourceResource::OnPluginMsgOpenComplete(
void VideoSourceResource::OnPluginMsgGetFrameComplete(
PP_VideoFrame_Private* frame,
- const ResourceMessageReplyParams& params,
+ const ResourceMessageReplyParams& reply_params,
const HostResource& image_data,
+ const PP_ImageDataDesc& image_desc,
+ int fd,
PP_TimeTicks timestamp) {
// The callback may have been aborted by Close().
if (TrackedCallback::IsPending(get_frame_callback_)) {
- int32_t result = params.result();
+ int32_t result = reply_params.result();
if (result == PP_OK) {
frame->timestamp = timestamp;
- frame->image_data = image_data.host_resource();
+
+#if defined(OS_ANDROID)
+ frame->image_data = 0;
+#elif defined(OS_WIN) || defined(OS_MACOSX)
+ base::SharedMemoryHandle handle;
+ if (!reply_params.TakeSharedMemoryHandleAtIndex(0, &handle))
+ frame->image_data = 0;
+ frame->image_data =
+ (new ImageData(image_data, image_desc, handle))->GetReference();
+#elif defined(OS_LINUX)
+ frame->image_data =
+ (new ImageData(image_data, image_desc, fd))->GetReference();
+#else
+#error Not implemented.
+#endif
}
get_frame_callback_->Run(result);
}
« no previous file with comments | « ppapi/proxy/video_source_resource.h ('k') | ppapi/tests/test_video_destination.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698