| 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 "content/renderer/pepper/ppb_video_decoder_impl.h" | 5 #include "content/renderer/pepper/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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const PP_PictureBuffer_Dev* buffers) { | 176 const PP_PictureBuffer_Dev* buffers) { |
| 177 if (!decoder_) | 177 if (!decoder_) |
| 178 return; | 178 return; |
| 179 UMA_HISTOGRAM_COUNTS_100("Media.PepperVideoDecoderPictureCount", | 179 UMA_HISTOGRAM_COUNTS_100("Media.PepperVideoDecoderPictureCount", |
| 180 no_of_buffers); | 180 no_of_buffers); |
| 181 | 181 |
| 182 std::vector<media::PictureBuffer> wrapped_buffers; | 182 std::vector<media::PictureBuffer> wrapped_buffers; |
| 183 for (uint32_t i = 0; i < no_of_buffers; i++) { | 183 for (uint32_t i = 0; i < no_of_buffers; i++) { |
| 184 PP_PictureBuffer_Dev in_buf = buffers[i]; | 184 PP_PictureBuffer_Dev in_buf = buffers[i]; |
| 185 DCHECK_GE(in_buf.id, 0); | 185 DCHECK_GE(in_buf.id, 0); |
| 186 media::PictureBuffer::TextureIds ids; |
| 187 ids.push_back(in_buf.texture_id); |
| 186 media::PictureBuffer buffer( | 188 media::PictureBuffer buffer( |
| 187 in_buf.id, | 189 in_buf.id, gfx::Size(in_buf.size.width, in_buf.size.height), ids); |
| 188 gfx::Size(in_buf.size.width, in_buf.size.height), | |
| 189 in_buf.texture_id); | |
| 190 wrapped_buffers.push_back(buffer); | 190 wrapped_buffers.push_back(buffer); |
| 191 UMA_HISTOGRAM_COUNTS_10000("Media.PepperVideoDecoderPictureHeight", | 191 UMA_HISTOGRAM_COUNTS_10000("Media.PepperVideoDecoderPictureHeight", |
| 192 in_buf.size.height); | 192 in_buf.size.height); |
| 193 } | 193 } |
| 194 | 194 |
| 195 FlushCommandBuffer(); | 195 FlushCommandBuffer(); |
| 196 decoder_->AssignPictureBuffers(wrapped_buffers); | 196 decoder_->AssignPictureBuffers(wrapped_buffers); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) { | 199 void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 FlushCommandBuffer(); | 232 FlushCommandBuffer(); |
| 233 | 233 |
| 234 decoder_.reset(); | 234 decoder_.reset(); |
| 235 ppp_videodecoder_ = NULL; | 235 ppp_videodecoder_ = NULL; |
| 236 | 236 |
| 237 ::ppapi::PPB_VideoDecoder_Shared::Destroy(); | 237 ::ppapi::PPB_VideoDecoder_Shared::Destroy(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void PPB_VideoDecoder_Impl::ProvidePictureBuffers( | 240 void PPB_VideoDecoder_Impl::ProvidePictureBuffers( |
| 241 uint32_t requested_num_of_buffers, | 241 uint32_t requested_num_of_buffers, |
| 242 uint32_t textures_per_buffer, |
| 242 const gfx::Size& dimensions, | 243 const gfx::Size& dimensions, |
| 243 uint32_t texture_target) { | 244 uint32_t texture_target) { |
| 244 DCHECK(RenderThreadImpl::current()); | 245 DCHECK(RenderThreadImpl::current()); |
| 246 DCHECK_EQ(1u, textures_per_buffer); |
| 245 if (!GetPPP()) | 247 if (!GetPPP()) |
| 246 return; | 248 return; |
| 247 | 249 |
| 248 PP_Size out_dim = PP_MakeSize(dimensions.width(), dimensions.height()); | 250 PP_Size out_dim = PP_MakeSize(dimensions.width(), dimensions.height()); |
| 249 GetPPP()->ProvidePictureBuffers(pp_instance(), pp_resource(), | 251 GetPPP()->ProvidePictureBuffers(pp_instance(), pp_resource(), |
| 250 requested_num_of_buffers, &out_dim, | 252 requested_num_of_buffers, &out_dim, |
| 251 texture_target); | 253 texture_target); |
| 252 } | 254 } |
| 253 | 255 |
| 254 void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) { | 256 void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 DCHECK(RenderThreadImpl::current()); | 296 DCHECK(RenderThreadImpl::current()); |
| 295 RunBitstreamBufferCallback(bitstream_buffer_id, PP_OK); | 297 RunBitstreamBufferCallback(bitstream_buffer_id, PP_OK); |
| 296 } | 298 } |
| 297 | 299 |
| 298 void PPB_VideoDecoder_Impl::NotifyFlushDone() { | 300 void PPB_VideoDecoder_Impl::NotifyFlushDone() { |
| 299 DCHECK(RenderThreadImpl::current()); | 301 DCHECK(RenderThreadImpl::current()); |
| 300 RunFlushCallback(PP_OK); | 302 RunFlushCallback(PP_OK); |
| 301 } | 303 } |
| 302 | 304 |
| 303 } // namespace content | 305 } // namespace content |
| OLD | NEW |