Index: content/renderer/pepper/pepper_video_destination_host.cc |
diff --git a/content/renderer/pepper/pepper_video_destination_host.cc b/content/renderer/pepper/pepper_video_destination_host.cc |
index 13760d6864dbdf24b704dbeb275e4ebaed1680d8..4e0a2cec2f10c16c47b1eaf07739efddf061a041 100644 |
--- a/content/renderer/pepper/pepper_video_destination_host.cc |
+++ b/content/renderer/pepper/pepper_video_destination_host.cc |
@@ -51,8 +51,15 @@ int32_t PepperVideoDestinationHost::OnHostMsgOpen( |
GURL gurl(stream_url); |
if (!gurl.is_valid()) |
return PP_ERROR_BADARGUMENT; |
- // TODO(ronghuawu) Check that gurl is a valid MediaStream video track URL. |
- // TODO(ronghuawu) Open a MediaStream video track. |
+ |
+ content::FrameWriterInterface* frame_writer = NULL; |
+ if (!VideoDestinationHandler::Open(NULL /* factory */, |
+ NULL /* registry */, |
+ gurl.spec(), |
+ &frame_writer)) |
+ return PP_ERROR_FAILED; |
+ frame_writer_.reset(frame_writer); |
+ |
ReplyMessageContext reply_context = context->MakeReplyMessageContext(); |
reply_context.params.set_result(PP_OK); |
host()->SendReply(reply_context, |
@@ -62,26 +69,32 @@ int32_t PepperVideoDestinationHost::OnHostMsgOpen( |
int32_t PepperVideoDestinationHost::OnHostMsgPutFrame( |
HostMessageContext* context, |
- const ppapi::HostResource& image_data, |
+ const ppapi::HostResource& image_data_resource, |
PP_TimeTicks timestamp) { |
ppapi::thunk::EnterResourceNoLock<ppapi::thunk::PPB_ImageData_API> enter( |
- image_data.host_resource(), true); |
+ image_data_resource.host_resource(), true); |
if (enter.failed()) |
return PP_ERROR_BADRESOURCE; |
- webkit::ppapi::PPB_ImageData_Impl* image_resource = |
+ webkit::ppapi::PPB_ImageData_Impl* image_data_impl = |
static_cast<webkit::ppapi::PPB_ImageData_Impl*>(enter.object()); |
if (!webkit::ppapi::PPB_ImageData_Impl::IsImageDataFormatSupported( |
- image_resource->format())) |
+ image_data_impl->format())) |
return PP_ERROR_BADARGUMENT; |
- // TODO(ronghuawu) write image data to MediaStream video track. |
+ if (!frame_writer_.get()) |
+ return PP_ERROR_FAILED; |
+ |
+ int64_t timestamp_ns = |
+ static_cast<int64_t>(timestamp) * talk_base::kNumNanosecsPerSec; |
yzshen1
2013/05/06 16:47:28
nit: Shall we use Time::kNanosecondsPerSecond in b
Tom Sepez
2013/05/06 17:19:35
How do we know what the epoch is for PP_Timeticks
bbudge
2013/05/06 19:27:50
Done.
|
+ frame_writer_->PutFrame(image_data_impl, timestamp_ns); |
+ |
return PP_OK; |
} |
int32_t PepperVideoDestinationHost::OnHostMsgClose( |
HostMessageContext* context) { |
- // TODO(ronghuawu) Close the video stream. |
+ frame_writer_.reset(NULL); |
return PP_OK; |
} |