OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/proxy/video_source_resource.h" | 5 #include "ppapi/proxy/video_source_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/private/pp_video_frame_private.h" | 10 #include "ppapi/c/private/pp_video_frame_private.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 int32_t VideoSourceResource::Open( | 40 int32_t VideoSourceResource::Open( |
41 const PP_Var& stream_url, | 41 const PP_Var& stream_url, |
42 scoped_refptr<TrackedCallback> callback) { | 42 scoped_refptr<TrackedCallback> callback) { |
43 if (TrackedCallback::IsPending(open_callback_)) | 43 if (TrackedCallback::IsPending(open_callback_)) |
44 return PP_ERROR_INPROGRESS; | 44 return PP_ERROR_INPROGRESS; |
45 | 45 |
46 open_callback_ = callback; | 46 open_callback_ = callback; |
47 | 47 |
48 scoped_refptr<StringVar> stream_url_var = StringVar::FromPPVar(stream_url); | 48 scoped_refptr<StringVar> stream_url_var = StringVar::FromPPVar(stream_url); |
49 const uint32_t kMaxStreamIdSizeInBytes = 16384; | 49 const uint32_t kMaxStreamIdSizeInBytes = 16384; |
50 if (!stream_url_var || | 50 if (!stream_url_var.get() || |
51 stream_url_var->value().size() > kMaxStreamIdSizeInBytes) | 51 stream_url_var->value().size() > kMaxStreamIdSizeInBytes) |
52 return PP_ERROR_BADARGUMENT; | 52 return PP_ERROR_BADARGUMENT; |
53 Call<PpapiPluginMsg_VideoSource_OpenReply>(RENDERER, | 53 Call<PpapiPluginMsg_VideoSource_OpenReply>(RENDERER, |
54 PpapiHostMsg_VideoSource_Open(stream_url_var->value()), | 54 PpapiHostMsg_VideoSource_Open(stream_url_var->value()), |
55 base::Bind(&VideoSourceResource::OnPluginMsgOpenComplete, this)); | 55 base::Bind(&VideoSourceResource::OnPluginMsgOpenComplete, this)); |
56 return PP_OK_COMPLETIONPENDING; | 56 return PP_OK_COMPLETIONPENDING; |
57 } | 57 } |
58 | 58 |
59 int32_t VideoSourceResource::GetFrame( | 59 int32_t VideoSourceResource::GetFrame( |
60 PP_VideoFrame_Private* frame, | 60 PP_VideoFrame_Private* frame, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 #else | 121 #else |
122 #error Not implemented. | 122 #error Not implemented. |
123 #endif | 123 #endif |
124 } | 124 } |
125 get_frame_callback_->Run(result); | 125 get_frame_callback_->Run(result); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 } // namespace proxy | 129 } // namespace proxy |
130 } // namespace ppapi | 130 } // namespace ppapi |
OLD | NEW |