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

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

Issue 390213002: Pepper: Change PPB_VideoDecoder::Reset behavior so plugin always manages textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/examples/video_decode/video_decode.cc ('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 "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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 253 }
254 254
255 get_picture_callback_ = callback; 255 get_picture_callback_ = callback;
256 get_picture_ = picture; 256 get_picture_ = picture;
257 return PP_OK_COMPLETIONPENDING; 257 return PP_OK_COMPLETIONPENDING;
258 } 258 }
259 259
260 void VideoDecoderResource::RecyclePicture(const PP_VideoPicture* picture) { 260 void VideoDecoderResource::RecyclePicture(const PP_VideoPicture* picture) {
261 if (decoder_last_error_) 261 if (decoder_last_error_)
262 return; 262 return;
263 if (reset_callback_)
264 return;
265 263
266 Post(RENDERER, PpapiHostMsg_VideoDecoder_RecyclePicture(picture->texture_id)); 264 Post(RENDERER, PpapiHostMsg_VideoDecoder_RecyclePicture(picture->texture_id));
267 } 265 }
268 266
269 int32_t VideoDecoderResource::Flush(scoped_refptr<TrackedCallback> callback) { 267 int32_t VideoDecoderResource::Flush(scoped_refptr<TrackedCallback> callback) {
270 if (decoder_last_error_) 268 if (decoder_last_error_)
271 return decoder_last_error_; 269 return decoder_last_error_;
272 if (reset_callback_) 270 if (reset_callback_)
273 return PP_ERROR_FAILED; 271 return PP_ERROR_FAILED;
274 if (flush_callback_) 272 if (flush_callback_)
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 462
465 scoped_refptr<TrackedCallback> callback; 463 scoped_refptr<TrackedCallback> callback;
466 callback.swap(flush_callback_); 464 callback.swap(flush_callback_);
467 callback->Run(params.result()); 465 callback->Run(params.result());
468 } 466 }
469 467
470 void VideoDecoderResource::OnPluginMsgResetComplete( 468 void VideoDecoderResource::OnPluginMsgResetComplete(
471 const ResourceMessageReplyParams& params) { 469 const ResourceMessageReplyParams& params) {
472 // All shm buffers should have been made available by now. 470 // All shm buffers should have been made available by now.
473 DCHECK_EQ(shm_buffers_.size(), available_shm_buffers_.size()); 471 DCHECK_EQ(shm_buffers_.size(), available_shm_buffers_.size());
474 // Received pictures are no longer valid. 472 // Recycle any pictures which haven't been passed to the plugin.
475 while (!received_pictures_.empty()) 473 while (!received_pictures_.empty()) {
474 Post(RENDERER, PpapiHostMsg_VideoDecoder_RecyclePicture(
475 received_pictures_.front().texture_id));
476 received_pictures_.pop(); 476 received_pictures_.pop();
477 }
477 478
478 scoped_refptr<TrackedCallback> callback; 479 scoped_refptr<TrackedCallback> callback;
479 callback.swap(reset_callback_); 480 callback.swap(reset_callback_);
480 callback->Run(params.result()); 481 callback->Run(params.result());
481 } 482 }
482 483
483 void VideoDecoderResource::RunCallbackWithError( 484 void VideoDecoderResource::RunCallbackWithError(
484 scoped_refptr<TrackedCallback>* callback) { 485 scoped_refptr<TrackedCallback>* callback) {
485 if (TrackedCallback::IsPending(*callback)) { 486 if (TrackedCallback::IsPending(*callback)) {
486 scoped_refptr<TrackedCallback> temp; 487 scoped_refptr<TrackedCallback> temp;
(...skipping 21 matching lines...) Expand all
508 pp_picture->texture_target = it->second.texture_target; 509 pp_picture->texture_target = it->second.texture_target;
509 pp_picture->texture_size = it->second.size; 510 pp_picture->texture_size = it->second.size;
510 } else { 511 } else {
511 NOTREACHED(); 512 NOTREACHED();
512 } 513 }
513 received_pictures_.pop(); 514 received_pictures_.pop();
514 } 515 }
515 516
516 } // namespace proxy 517 } // namespace proxy
517 } // namespace ppapi 518 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/examples/video_decode/video_decode.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698