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

Side by Side Diff: webkit/plugins/ppapi/ppb_video_decoder_impl.cc

Issue 11826064: Enforce non-negative BitstreamBuffer id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Documented the wrapping at 30 bits. Created 7 years, 11 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
« no previous file with comments | « ppapi/c/dev/pp_video_dev.h ('k') | no next file » | 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 "webkit/plugins/ppapi/ppb_video_decoder_impl.h" 5 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, 132 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
133 scoped_refptr<TrackedCallback> callback) { 133 scoped_refptr<TrackedCallback> callback) {
134 if (!platform_video_decoder_.get()) 134 if (!platform_video_decoder_.get())
135 return PP_ERROR_BADRESOURCE; 135 return PP_ERROR_BADRESOURCE;
136 136
137 EnterResourceNoLock<PPB_Buffer_API> enter(bitstream_buffer->data, true); 137 EnterResourceNoLock<PPB_Buffer_API> enter(bitstream_buffer->data, true);
138 if (enter.failed()) 138 if (enter.failed())
139 return PP_ERROR_FAILED; 139 return PP_ERROR_FAILED;
140 140
141 PPB_Buffer_Impl* buffer = static_cast<PPB_Buffer_Impl*>(enter.object()); 141 PPB_Buffer_Impl* buffer = static_cast<PPB_Buffer_Impl*>(enter.object());
142 DCHECK_GE(bitstream_buffer->id, 0);
142 media::BitstreamBuffer decode_buffer( 143 media::BitstreamBuffer decode_buffer(
143 bitstream_buffer->id, 144 bitstream_buffer->id,
144 buffer->shared_memory()->handle(), 145 buffer->shared_memory()->handle(),
145 bitstream_buffer->size); 146 bitstream_buffer->size);
146 if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback)) 147 if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback))
147 return PP_ERROR_BADARGUMENT; 148 return PP_ERROR_BADARGUMENT;
148 149
149 FlushCommandBuffer(); 150 FlushCommandBuffer();
150 platform_video_decoder_->Decode(decode_buffer); 151 platform_video_decoder_->Decode(decode_buffer);
151 return PP_OK_COMPLETIONPENDING; 152 return PP_OK_COMPLETIONPENDING;
152 } 153 }
153 154
154 void PPB_VideoDecoder_Impl::AssignPictureBuffers( 155 void PPB_VideoDecoder_Impl::AssignPictureBuffers(
155 uint32_t no_of_buffers, 156 uint32_t no_of_buffers,
156 const PP_PictureBuffer_Dev* buffers) { 157 const PP_PictureBuffer_Dev* buffers) {
157 if (!platform_video_decoder_.get()) 158 if (!platform_video_decoder_.get())
158 return; 159 return;
159 160
160 std::vector<media::PictureBuffer> wrapped_buffers; 161 std::vector<media::PictureBuffer> wrapped_buffers;
161 for (uint32 i = 0; i < no_of_buffers; i++) { 162 for (uint32 i = 0; i < no_of_buffers; i++) {
162 PP_PictureBuffer_Dev in_buf = buffers[i]; 163 PP_PictureBuffer_Dev in_buf = buffers[i];
164 DCHECK_GE(in_buf.id, 0);
163 media::PictureBuffer buffer( 165 media::PictureBuffer buffer(
164 in_buf.id, 166 in_buf.id,
165 gfx::Size(in_buf.size.width, in_buf.size.height), 167 gfx::Size(in_buf.size.width, in_buf.size.height),
166 in_buf.texture_id); 168 in_buf.texture_id);
167 wrapped_buffers.push_back(buffer); 169 wrapped_buffers.push_back(buffer);
168 } 170 }
169 171
170 FlushCommandBuffer(); 172 FlushCommandBuffer();
171 platform_video_decoder_->AssignPictureBuffers(wrapped_buffers); 173 platform_video_decoder_->AssignPictureBuffers(wrapped_buffers);
172 } 174 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 void PPB_VideoDecoder_Impl::NotifyFlushDone() { 269 void PPB_VideoDecoder_Impl::NotifyFlushDone() {
268 RunFlushCallback(PP_OK); 270 RunFlushCallback(PP_OK);
269 } 271 }
270 272
271 void PPB_VideoDecoder_Impl::NotifyInitializeDone() { 273 void PPB_VideoDecoder_Impl::NotifyInitializeDone() {
272 NOTREACHED() << "PlatformVideoDecoder::Initialize() is synchronous!"; 274 NOTREACHED() << "PlatformVideoDecoder::Initialize() is synchronous!";
273 } 275 }
274 276
275 } // namespace ppapi 277 } // namespace ppapi
276 } // namespace webkit 278 } // namespace webkit
OLDNEW
« no previous file with comments | « ppapi/c/dev/pp_video_dev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698