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

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

Issue 496203002: Pepper: PPB_VideoDecoder software-only mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 6 years, 4 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/video_decoder_resource.h ('k') | ppapi/proxy/video_decoder_resource_unittest.cc » ('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) 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 "gpu/command_buffer/common/mailbox.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // Destroy any textures which haven't been dismissed. 78 // Destroy any textures which haven't been dismissed.
79 TextureMap::iterator it = textures_.begin(); 79 TextureMap::iterator it = textures_.begin();
80 for (; it != textures_.end(); ++it) 80 for (; it != textures_.end(); ++it)
81 DeleteGLTexture(it->first); 81 DeleteGLTexture(it->first);
82 } 82 }
83 83
84 PPB_VideoDecoder_API* VideoDecoderResource::AsPPB_VideoDecoder_API() { 84 PPB_VideoDecoder_API* VideoDecoderResource::AsPPB_VideoDecoder_API() {
85 return this; 85 return this;
86 } 86 }
87 87
88 int32_t VideoDecoderResource::Initialize0_1(
89 PP_Resource graphics_context,
90 PP_VideoProfile profile,
91 PP_Bool allow_software_fallback,
92 scoped_refptr<TrackedCallback> callback) {
93 return Initialize(graphics_context,
94 profile,
95 allow_software_fallback
96 ? PP_HARDWAREACCELERATION_WITHFALLBACK
97 : PP_HARDWAREACCELERATION_ONLY,
98 callback);
99 }
100
88 int32_t VideoDecoderResource::Initialize( 101 int32_t VideoDecoderResource::Initialize(
89 PP_Resource graphics_context, 102 PP_Resource graphics_context,
90 PP_VideoProfile profile, 103 PP_VideoProfile profile,
91 PP_Bool allow_software_fallback, 104 PP_HardwareAcceleration acceleration,
92 scoped_refptr<TrackedCallback> callback) { 105 scoped_refptr<TrackedCallback> callback) {
93 if (initialized_) 106 if (initialized_)
94 return PP_ERROR_FAILED; 107 return PP_ERROR_FAILED;
95 if (profile < 0 || profile > PP_VIDEOPROFILE_MAX) 108 if (profile < 0 || profile > PP_VIDEOPROFILE_MAX)
96 return PP_ERROR_BADARGUMENT; 109 return PP_ERROR_BADARGUMENT;
97 if (initialize_callback_) 110 if (initialize_callback_)
98 return PP_ERROR_INPROGRESS; 111 return PP_ERROR_INPROGRESS;
99 if (!graphics_context) 112 if (!graphics_context)
100 return PP_ERROR_BADRESOURCE; 113 return PP_ERROR_BADRESOURCE;
101 114
(...skipping 19 matching lines...) Expand all
121 static_cast<PPB_Graphics3D_Shared*>(enter_graphics.object()); 134 static_cast<PPB_Graphics3D_Shared*>(enter_graphics.object());
122 gles2_impl_ = ppb_graphics3d_shared->gles2_impl(); 135 gles2_impl_ = ppb_graphics3d_shared->gles2_impl();
123 host_resource = ppb_graphics3d_shared->host_resource(); 136 host_resource = ppb_graphics3d_shared->host_resource();
124 } 137 }
125 138
126 initialize_callback_ = callback; 139 initialize_callback_ = callback;
127 140
128 Call<PpapiPluginMsg_VideoDecoder_InitializeReply>( 141 Call<PpapiPluginMsg_VideoDecoder_InitializeReply>(
129 RENDERER, 142 RENDERER,
130 PpapiHostMsg_VideoDecoder_Initialize( 143 PpapiHostMsg_VideoDecoder_Initialize(
131 host_resource, profile, PP_ToBool(allow_software_fallback)), 144 host_resource, profile, acceleration),
132 base::Bind(&VideoDecoderResource::OnPluginMsgInitializeComplete, this)); 145 base::Bind(&VideoDecoderResource::OnPluginMsgInitializeComplete, this));
133 146
134 return PP_OK_COMPLETIONPENDING; 147 return PP_OK_COMPLETIONPENDING;
135 } 148 }
136 149
137 int32_t VideoDecoderResource::Decode(uint32_t decode_id, 150 int32_t VideoDecoderResource::Decode(uint32_t decode_id,
138 uint32_t size, 151 uint32_t size,
139 const void* buffer, 152 const void* buffer,
140 scoped_refptr<TrackedCallback> callback) { 153 scoped_refptr<TrackedCallback> callback) {
141 if (decoder_last_error_) 154 if (decoder_last_error_)
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 pp_picture->texture_target = it->second.texture_target; 522 pp_picture->texture_target = it->second.texture_target;
510 pp_picture->texture_size = it->second.size; 523 pp_picture->texture_size = it->second.size;
511 } else { 524 } else {
512 NOTREACHED(); 525 NOTREACHED();
513 } 526 }
514 received_pictures_.pop(); 527 received_pictures_.pop();
515 } 528 }
516 529
517 } // namespace proxy 530 } // namespace proxy
518 } // namespace ppapi 531 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/video_decoder_resource.h ('k') | ppapi/proxy/video_decoder_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698