| 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 "content/common/gpu/omx_video_decode_accelerator.h" | 5 #include "content/common/gpu/omx_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "content/common/gpu/gles2_texture_to_egl_image_translator.h" | 9 #include "content/common/gpu/gles2_texture_to_egl_image_translator.h" |
| 10 #include "content/common/gpu/gpu_channel.h" | 10 #include "content/common/gpu/gpu_channel.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 StopOnError(); | 121 StopOnError(); |
| 122 return false; | 122 return false; |
| 123 } | 123 } |
| 124 | 124 |
| 125 if (!AllocateInputBuffers()) { | 125 if (!AllocateInputBuffers()) { |
| 126 LOG(ERROR) << "OMX_AllocateBuffer() Input buffer error"; | 126 LOG(ERROR) << "OMX_AllocateBuffer() Input buffer error"; |
| 127 StopOnError(); | 127 StopOnError(); |
| 128 return false; | 128 return false; |
| 129 } | 129 } |
| 130 | 130 |
| 131 // After AllocateInputBuffers ideally this should be AllocateOutputBuffers. | 131 // In order to allocate output buffers we need to have textures in hand, so we |
| 132 // Since in this case app provides the output buffers, | 132 // call ProvidePictureBuffers on the client and complete initialization in |
| 133 // we query this through ProvidePictureBuffers. | 133 // AssignGLESBuffers. |
| 134 // This is call to ppapi to provide the output buffers initially. | |
| 135 // ProvidePictureBuffers will provide | |
| 136 // - SharedMemHandle in case of decoding to system memory. | |
| 137 // - Textures in case of decoding to egl-images. | |
| 138 | |
| 139 // Output buffers will be eventually handed to us via | |
| 140 // Assign{GLES,Sysmem}Buffers(). | |
| 141 message_loop_->PostTask( | 134 message_loop_->PostTask( |
| 142 FROM_HERE, | 135 FROM_HERE, |
| 143 base::Bind(&Client::ProvidePictureBuffers, base::Unretained(client_), | 136 base::Bind(&Client::ProvidePictureBuffers, base::Unretained(client_), |
| 144 static_cast<int32>(kNumPictureBuffers), | 137 static_cast<int32>(kNumPictureBuffers), |
| 145 gfx::Size(width_, height_), | 138 gfx::Size(width_, height_), |
| 146 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE)); | 139 PICTUREBUFFER_MEMORYTYPE_GL_TEXTURE)); |
| 147 | 140 |
| 148 return true; | 141 return true; |
| 149 } | 142 } |
| 150 | 143 |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, | 905 OMX_ERRORTYPE result = OMX_SendCommand(component_handle_, |
| 913 cmd, port_index, 0); | 906 cmd, port_index, 0); |
| 914 if (result != OMX_ErrorNone) { | 907 if (result != OMX_ErrorNone) { |
| 915 LOG(ERROR) << "SendCommand(OMX_CommandPortDisable) failed"; | 908 LOG(ERROR) << "SendCommand(OMX_CommandPortDisable) failed"; |
| 916 StopOnError(); | 909 StopOnError(); |
| 917 return; | 910 return; |
| 918 } | 911 } |
| 919 } | 912 } |
| 920 | 913 |
| 921 DISABLE_RUNNABLE_METHOD_REFCOUNT(OmxVideoDecodeAccelerator); | 914 DISABLE_RUNNABLE_METHOD_REFCOUNT(OmxVideoDecodeAccelerator); |
| OLD | NEW |