OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |