| OLD | NEW |
| 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/proxy/ppb_video_decoder_proxy.h" | 5 #include "ppapi/proxy/ppb_video_decoder_proxy.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/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
| 10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 int32_t VideoDecoder::Decode( | 91 int32_t VideoDecoder::Decode( |
| 92 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, | 92 const PP_VideoBitstreamBuffer_Dev* bitstream_buffer, |
| 93 PP_CompletionCallback callback) { | 93 PP_CompletionCallback callback) { |
| 94 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> | 94 ppapi::thunk::EnterResourceNoLock<PPB_Buffer_API> |
| 95 enter_buffer(bitstream_buffer->data, true); | 95 enter_buffer(bitstream_buffer->data, true); |
| 96 if (enter_buffer.failed()) | 96 if (enter_buffer.failed()) |
| 97 return PP_ERROR_BADRESOURCE; | 97 return PP_ERROR_BADRESOURCE; |
| 98 | 98 |
| 99 SetBitstreamBufferCallback(bitstream_buffer->id, callback); | 99 if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback)) |
| 100 return PP_ERROR_BADARGUMENT; |
| 100 | 101 |
| 101 Buffer* ppb_buffer = | 102 Buffer* ppb_buffer = |
| 102 static_cast<Buffer*>(enter_buffer.object()); | 103 static_cast<Buffer*>(enter_buffer.object()); |
| 103 HostResource host_buffer = ppb_buffer->host_resource(); | 104 HostResource host_buffer = ppb_buffer->host_resource(); |
| 104 | 105 |
| 105 FlushCommandBuffer(); | 106 FlushCommandBuffer(); |
| 106 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Decode( | 107 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Decode( |
| 107 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), | 108 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), |
| 108 host_buffer, bitstream_buffer->id, | 109 host_buffer, bitstream_buffer->id, |
| 109 bitstream_buffer->size)); | 110 bitstream_buffer->size)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 120 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), buffer_list)); | 121 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), buffer_list)); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) { | 124 void VideoDecoder::ReusePictureBuffer(int32_t picture_buffer_id) { |
| 124 FlushCommandBuffer(); | 125 FlushCommandBuffer(); |
| 125 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_ReusePictureBuffer( | 126 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_ReusePictureBuffer( |
| 126 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), picture_buffer_id)); | 127 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource(), picture_buffer_id)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 int32_t VideoDecoder::Flush(PP_CompletionCallback callback) { | 130 int32_t VideoDecoder::Flush(PP_CompletionCallback callback) { |
| 130 SetFlushCallback(callback); | 131 if (!SetFlushCallback(callback)) |
| 132 return PP_ERROR_INPROGRESS; |
| 131 | 133 |
| 132 FlushCommandBuffer(); | 134 FlushCommandBuffer(); |
| 133 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Flush( | 135 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Flush( |
| 134 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); | 136 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); |
| 135 return PP_OK_COMPLETIONPENDING; | 137 return PP_OK_COMPLETIONPENDING; |
| 136 } | 138 } |
| 137 | 139 |
| 138 int32_t VideoDecoder::Reset(PP_CompletionCallback callback) { | 140 int32_t VideoDecoder::Reset(PP_CompletionCallback callback) { |
| 139 SetResetCallback(callback); | 141 if (!SetResetCallback(callback)) |
| 142 return PP_ERROR_INPROGRESS; |
| 140 | 143 |
| 141 FlushCommandBuffer(); | 144 FlushCommandBuffer(); |
| 142 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Reset( | 145 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Reset( |
| 143 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); | 146 INTERFACE_ID_PPB_VIDEO_DECODER_DEV, host_resource())); |
| 144 return PP_OK_COMPLETIONPENDING; | 147 return PP_OK_COMPLETIONPENDING; |
| 145 } | 148 } |
| 146 | 149 |
| 147 void VideoDecoder::Destroy() { | 150 void VideoDecoder::Destroy() { |
| 148 FlushCommandBuffer(); | 151 FlushCommandBuffer(); |
| 149 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Destroy( | 152 GetDispatcher()->Send(new PpapiHostMsg_PPBVideoDecoder_Destroy( |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 357 |
| 355 void PPB_VideoDecoder_Proxy::OnMsgResetACK( | 358 void PPB_VideoDecoder_Proxy::OnMsgResetACK( |
| 356 const HostResource& decoder, int32_t result) { | 359 const HostResource& decoder, int32_t result) { |
| 357 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); | 360 EnterPluginFromHostResource<PPB_VideoDecoder_API> enter(decoder); |
| 358 if (enter.succeeded()) | 361 if (enter.succeeded()) |
| 359 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); | 362 static_cast<VideoDecoder*>(enter.object())->ResetACK(result); |
| 360 } | 363 } |
| 361 | 364 |
| 362 } // namespace proxy | 365 } // namespace proxy |
| 363 } // namespace pp | 366 } // namespace pp |
| OLD | NEW |