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

Side by Side Diff: ppapi/proxy/ppb_video_decoder_proxy.cc

Issue 10408003: Plumb extra_data() to VideoDecodeAccelerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rev interface versino Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_video_decoder_proxy.h ('k') | ppapi/proxy/resource_creation_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppb_video_decoder_proxy.h" 5 #include "ppapi/proxy/ppb_video_decoder_proxy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "gpu/command_buffer/client/gles2_implementation.h" 8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "ppapi/proxy/enter_proxy.h" 9 #include "ppapi/proxy/enter_proxy.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoDecoder_FlushACK, OnMsgFlushACK) 173 IPC_MESSAGE_HANDLER(PpapiMsg_PPBVideoDecoder_FlushACK, OnMsgFlushACK)
174 IPC_MESSAGE_UNHANDLED(handled = false) 174 IPC_MESSAGE_UNHANDLED(handled = false)
175 IPC_END_MESSAGE_MAP() 175 IPC_END_MESSAGE_MAP()
176 DCHECK(handled); 176 DCHECK(handled);
177 return handled; 177 return handled;
178 } 178 }
179 179
180 PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource( 180 PP_Resource PPB_VideoDecoder_Proxy::CreateProxyResource(
181 PP_Instance instance, 181 PP_Instance instance,
182 PP_Resource graphics_context, 182 PP_Resource graphics_context,
183 PP_VideoDecoder_Profile profile) { 183 PP_VideoDecoder_Profile profile,
184 PP_Size frame_size,
185 const uint8_t* extra_data,
186 uint32_t extra_data_size) {
184 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 187 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
185 // Dispatcher is null if it cannot find the instance passed to it (i.e. if the 188 // Dispatcher is null if it cannot find the instance passed to it (i.e. if the
186 // client passes in an invalid instance). 189 // client passes in an invalid instance).
187 if (!dispatcher) 190 if (!dispatcher)
188 return 0; 191 return 0;
189 192
190 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context, 193 EnterResourceNoLock<PPB_Graphics3D_API> enter_context(graphics_context,
191 true); 194 true);
192 if (enter_context.failed()) 195 if (enter_context.failed())
193 return 0; 196 return 0;
194 197
195 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object()); 198 Graphics3D* context = static_cast<Graphics3D*>(enter_context.object());
196 199
200 std::vector<uint8_t> extra_data_vector;
201 if (extra_data)
202 extra_data_vector.assign(extra_data, extra_data + extra_data_size);
203
197 HostResource result; 204 HostResource result;
198 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create( 205 dispatcher->Send(new PpapiHostMsg_PPBVideoDecoder_Create(
199 API_ID_PPB_VIDEO_DECODER_DEV, instance, 206 API_ID_PPB_VIDEO_DECODER_DEV, instance, context->host_resource(),profile,
200 context->host_resource(), profile, &result)); 207 frame_size, extra_data_vector, &result));
201 if (result.is_null()) 208 if (result.is_null())
202 return 0; 209 return 0;
203 210
204 // Need a scoped_refptr to keep the object alive during the Init call. 211 // Need a scoped_refptr to keep the object alive during the Init call.
205 scoped_refptr<VideoDecoder> decoder(new VideoDecoder(result)); 212 scoped_refptr<VideoDecoder> decoder(new VideoDecoder(result));
206 decoder->InitCommon(graphics_context, context->gles2_impl()); 213 decoder->InitCommon(graphics_context, context->gles2_impl());
207 return decoder->GetReference(); 214 return decoder->GetReference();
208 } 215 }
209 216
210 void PPB_VideoDecoder_Proxy::OnMsgCreate( 217 void PPB_VideoDecoder_Proxy::OnMsgCreate(
211 PP_Instance instance, const HostResource& graphics_context, 218 PP_Instance instance, const HostResource& graphics_context,
212 PP_VideoDecoder_Profile profile, 219 PP_VideoDecoder_Profile profile,
220 const PP_Size& frame_size,
221 const std::vector<uint8_t>& extra_data,
213 HostResource* result) { 222 HostResource* result) {
214 thunk::EnterResourceCreation resource_creation(instance); 223 thunk::EnterResourceCreation resource_creation(instance);
215 if (resource_creation.failed()) 224 if (resource_creation.failed())
216 return; 225 return;
217 226
218 // Make the resource and get the API pointer to its interface. 227 // Make the resource and get the API pointer to its interface.
219 result->SetHostResource( 228 result->SetHostResource(
220 instance, resource_creation.functions()->CreateVideoDecoder( 229 instance, resource_creation.functions()->CreateVideoDecoder(
221 instance, graphics_context.host_resource(), profile)); 230 instance, graphics_context.host_resource(), profile, frame_size,
231 extra_data.empty() ? NULL : &extra_data[0], extra_data.size()));
222 } 232 }
223 233
224 void PPB_VideoDecoder_Proxy::OnMsgDecode( 234 void PPB_VideoDecoder_Proxy::OnMsgDecode(
225 const HostResource& decoder, 235 const HostResource& decoder,
226 const HostResource& buffer, int32 id, int32 size) { 236 const HostResource& buffer, int32 id, int32 size) {
227 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter( 237 EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
228 decoder, callback_factory_, 238 decoder, callback_factory_,
229 &PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id); 239 &PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id);
230 if (enter.failed()) 240 if (enter.failed())
231 return; 241 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 316
307 void PPB_VideoDecoder_Proxy::OnMsgResetACK( 317 void PPB_VideoDecoder_Proxy::OnMsgResetACK(
308 const HostResource& decoder, int32_t result) { 318 const HostResource& decoder, int32_t result) {
309 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); 319 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder);
310 if (enter.succeeded()) 320 if (enter.succeeded())
311 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); 321 static_cast<VideoDecoder*>(enter.object())->ResetACK(result);
312 } 322 }
313 323
314 } // namespace proxy 324 } // namespace proxy
315 } // namespace ppapi 325 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_video_decoder_proxy.h ('k') | ppapi/proxy/resource_creation_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698