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

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

Issue 311853005: Implement software fallback for PPB_VideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use WeakPtr to tie VideoDecoderProxy and Delegate. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_decoder_resource.h" 5 #include "ppapi/proxy/video_decoder_resource.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 8 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h" 9 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "gpu/command_buffer/common/mailbox.h"
10 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
11 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
12 #include "ppapi/c/ppb_opengles2.h" 13 #include "ppapi/c/ppb_opengles2.h"
13 #include "ppapi/proxy/plugin_dispatcher.h" 14 #include "ppapi/proxy/plugin_dispatcher.h"
14 #include "ppapi/proxy/ppapi_messages.h" 15 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" 16 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
16 #include "ppapi/proxy/serialized_handle.h" 17 #include "ppapi/proxy/serialized_handle.h"
17 #include "ppapi/proxy/video_decoder_constants.h" 18 #include "ppapi/proxy/video_decoder_constants.h"
18 #include "ppapi/shared_impl/ppapi_globals.h" 19 #include "ppapi/shared_impl/ppapi_globals.h"
19 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" 20 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 326 }
326 327
327 void VideoDecoderResource::SetForTest() { 328 void VideoDecoderResource::SetForTest() {
328 testing_ = true; 329 testing_ = true;
329 } 330 }
330 331
331 void VideoDecoderResource::OnPluginMsgRequestTextures( 332 void VideoDecoderResource::OnPluginMsgRequestTextures(
332 const ResourceMessageReplyParams& params, 333 const ResourceMessageReplyParams& params,
333 uint32_t num_textures, 334 uint32_t num_textures,
334 const PP_Size& size, 335 const PP_Size& size,
335 uint32_t texture_target) { 336 uint32_t texture_target,
337 const std::vector<gpu::Mailbox>& mailboxes) {
336 DCHECK(num_textures); 338 DCHECK(num_textures);
339 DCHECK(!mailboxes.size() || mailboxes.size() == num_textures);
dmichael (off chromium) 2014/06/05 23:00:44 !mailboxes.size() -> mailboxes.empty()
bbudge 2014/06/06 02:03:46 Done.
337 std::vector<uint32_t> texture_ids(num_textures); 340 std::vector<uint32_t> texture_ids(num_textures);
338 if (gles2_impl_) { 341 if (gles2_impl_) {
339 gles2_impl_->GenTextures(num_textures, &texture_ids.front()); 342 gles2_impl_->GenTextures(num_textures, &texture_ids.front());
340 for (uint32_t i = 0; i < num_textures; ++i) { 343 for (uint32_t i = 0; i < num_textures; ++i) {
341 gles2_impl_->ActiveTexture(GL_TEXTURE0); 344 gles2_impl_->ActiveTexture(GL_TEXTURE0);
342 gles2_impl_->BindTexture(texture_target, texture_ids[i]); 345 gles2_impl_->BindTexture(texture_target, texture_ids[i]);
343 gles2_impl_->TexParameteri( 346 gles2_impl_->TexParameteri(
344 texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 347 texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
345 gles2_impl_->TexParameteri( 348 gles2_impl_->TexParameteri(
346 texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 349 texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
347 gles2_impl_->TexParameterf( 350 gles2_impl_->TexParameterf(
348 texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 351 texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
349 gles2_impl_->TexParameterf( 352 gles2_impl_->TexParameterf(
350 texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 353 texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
351 354
352 if (texture_target == GL_TEXTURE_2D) { 355 if (texture_target == GL_TEXTURE_2D) {
353 gles2_impl_->TexImage2D(texture_target, 356 gles2_impl_->TexImage2D(texture_target,
354 0, 357 0,
355 GL_RGBA, 358 GL_RGBA,
356 size.width, 359 size.width,
357 size.height, 360 size.height,
358 0, 361 0,
359 GL_RGBA, 362 GL_RGBA,
360 GL_UNSIGNED_BYTE, 363 GL_UNSIGNED_BYTE,
361 NULL); 364 NULL);
362 } 365 }
366 if (!mailboxes.empty())
367 gles2_impl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxes[i].name);
363 368
364 textures_.insert( 369 textures_.insert(
365 std::make_pair(texture_ids[i], Texture(texture_target, size))); 370 std::make_pair(texture_ids[i], Texture(texture_target, size)));
366 } 371 }
367 gles2_impl_->Flush(); 372 gles2_impl_->Flush();
368 } else { 373 } else {
369 DCHECK(testing_); 374 DCHECK(testing_);
370 // Create some fake texture ids so we can test picture handling. 375 // Create some fake texture ids so we can test picture handling.
371 for (uint32_t i = 0; i < num_textures; ++i) { 376 for (uint32_t i = 0; i < num_textures; ++i) {
372 texture_ids[i] = i + 1; 377 texture_ids[i] = i + 1;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 pp_picture->texture_target = it->second.texture_target; 502 pp_picture->texture_target = it->second.texture_target;
498 pp_picture->texture_size = it->second.size; 503 pp_picture->texture_size = it->second.size;
499 } else { 504 } else {
500 NOTREACHED(); 505 NOTREACHED();
501 } 506 }
502 received_pictures_.pop(); 507 received_pictures_.pop();
503 } 508 }
504 509
505 } // namespace proxy 510 } // namespace proxy
506 } // namespace ppapi 511 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698