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

Side by Side Diff: ppapi/shared_impl/video_decoder_impl.cc

Issue 7628025: Gracefully handle multiple Flush/Reset/Decode with same id (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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/shared_impl/video_decoder_impl.h ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.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) 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/shared_impl/video_decoder_impl.h" 5 #include "ppapi/shared_impl/video_decoder_impl.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/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/proxy/plugin_resource_tracker.h" 10 #include "ppapi/proxy/plugin_resource_tracker.h"
(...skipping 26 matching lines...) Expand all
37 context3d_id_ = context3d_id; 37 context3d_id_ = context3d_id;
38 return true; 38 return true;
39 } 39 }
40 40
41 void VideoDecoderImpl::Destroy() { 41 void VideoDecoderImpl::Destroy() {
42 context3d_id_ = 0; 42 context3d_id_ = 0;
43 gles2_impl_ = NULL; 43 gles2_impl_ = NULL;
44 UnrefResource(context3d_id_); 44 UnrefResource(context3d_id_);
45 } 45 }
46 46
47 void VideoDecoderImpl::SetFlushCallback(PP_CompletionCallback callback) { 47 bool VideoDecoderImpl::SetFlushCallback(PP_CompletionCallback callback) {
48 CHECK(callback.func); 48 CHECK(callback.func);
49 DCHECK(!flush_callback_.func); 49 if (flush_callback_.func)
50 return false;
50 flush_callback_ = callback; 51 flush_callback_ = callback;
52 return true;
51 } 53 }
52 54
53 void VideoDecoderImpl::SetResetCallback(PP_CompletionCallback callback) { 55 bool VideoDecoderImpl::SetResetCallback(PP_CompletionCallback callback) {
54 CHECK(callback.func); 56 CHECK(callback.func);
55 DCHECK(!reset_callback_.func); 57 if (reset_callback_.func)
58 return false;
56 reset_callback_ = callback; 59 reset_callback_ = callback;
60 return true;
57 } 61 }
58 62
59 void VideoDecoderImpl::SetBitstreamBufferCallback( 63 bool VideoDecoderImpl::SetBitstreamBufferCallback(
60 int32 bitstream_buffer_id, PP_CompletionCallback callback) { 64 int32 bitstream_buffer_id, PP_CompletionCallback callback) {
61 CHECK(bitstream_buffer_callbacks_.insert( 65 return bitstream_buffer_callbacks_.insert(
62 std::make_pair(bitstream_buffer_id, callback)).second); 66 std::make_pair(bitstream_buffer_id, callback)).second;
63 } 67 }
64 68
65 void VideoDecoderImpl::RunFlushCallback(int32 result) { 69 void VideoDecoderImpl::RunFlushCallback(int32 result) {
66 DCHECK(flush_callback_.func); 70 DCHECK(flush_callback_.func);
67 PP_RunAndClearCompletionCallback(&flush_callback_, result); 71 PP_RunAndClearCompletionCallback(&flush_callback_, result);
68 } 72 }
69 73
70 void VideoDecoderImpl::RunResetCallback(int32 result) { 74 void VideoDecoderImpl::RunResetCallback(int32 result) {
71 DCHECK(reset_callback_.func); 75 DCHECK(reset_callback_.func);
72 PP_RunAndClearCompletionCallback(&reset_callback_, result); 76 PP_RunAndClearCompletionCallback(&reset_callback_, result);
(...skipping 23 matching lines...) Expand all
96 const PP_VideoConfigElement* current = configs_to_copy; 100 const PP_VideoConfigElement* current = configs_to_copy;
97 while (current && *current != PP_VIDEOATTR_DICTIONARY_TERMINATOR) { 101 while (current && *current != PP_VIDEOATTR_DICTIONARY_TERMINATOR) {
98 out_configs->push_back(*current); 102 out_configs->push_back(*current);
99 out_configs->push_back(*(current + 1)); 103 out_configs->push_back(*(current + 1));
100 current += 2; 104 current += 2;
101 } 105 }
102 return true; 106 return true;
103 } 107 }
104 108
105 } // namespace ppapi 109 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/video_decoder_impl.h ('k') | webkit/plugins/ppapi/ppb_video_decoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698