Chromium Code Reviews| 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 pepper_buffers; | |
|
raymes
2016/03/31 00:09:25
nit: perhaps keep the naming similar to the other
| |
| 187 pepper_buffers.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), |
| 188 gfx::Size(in_buf.size.width, in_buf.size.height), | 190 pepper_buffers); |
| 189 in_buf.texture_id); | |
| 190 wrapped_buffers.push_back(buffer); | 191 wrapped_buffers.push_back(buffer); |
| 191 UMA_HISTOGRAM_COUNTS_10000("Media.PepperVideoDecoderPictureHeight", | 192 UMA_HISTOGRAM_COUNTS_10000("Media.PepperVideoDecoderPictureHeight", |
| 192 in_buf.size.height); | 193 in_buf.size.height); |
| 193 } | 194 } |
| 194 | 195 |
| 195 FlushCommandBuffer(); | 196 FlushCommandBuffer(); |
| 196 decoder_->AssignPictureBuffers(wrapped_buffers); | 197 decoder_->AssignPictureBuffers(wrapped_buffers); |
| 197 } | 198 } |
| 198 | 199 |
| 199 void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) { | 200 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(); | 233 FlushCommandBuffer(); |
| 233 | 234 |
| 234 decoder_.reset(); | 235 decoder_.reset(); |
| 235 ppp_videodecoder_ = NULL; | 236 ppp_videodecoder_ = NULL; |
| 236 | 237 |
| 237 ::ppapi::PPB_VideoDecoder_Shared::Destroy(); | 238 ::ppapi::PPB_VideoDecoder_Shared::Destroy(); |
| 238 } | 239 } |
| 239 | 240 |
| 240 void PPB_VideoDecoder_Impl::ProvidePictureBuffers( | 241 void PPB_VideoDecoder_Impl::ProvidePictureBuffers( |
| 241 uint32_t requested_num_of_buffers, | 242 uint32_t requested_num_of_buffers, |
| 243 uint32_t textures_per_buffer, | |
| 242 const gfx::Size& dimensions, | 244 const gfx::Size& dimensions, |
| 243 uint32_t texture_target) { | 245 uint32_t texture_target) { |
| 244 DCHECK(RenderThreadImpl::current()); | 246 DCHECK(RenderThreadImpl::current()); |
| 247 DCHECK_EQ(1u, textures_per_buffer); | |
| 245 if (!GetPPP()) | 248 if (!GetPPP()) |
| 246 return; | 249 return; |
| 247 | 250 |
| 248 PP_Size out_dim = PP_MakeSize(dimensions.width(), dimensions.height()); | 251 PP_Size out_dim = PP_MakeSize(dimensions.width(), dimensions.height()); |
| 249 GetPPP()->ProvidePictureBuffers(pp_instance(), pp_resource(), | 252 GetPPP()->ProvidePictureBuffers(pp_instance(), pp_resource(), |
| 250 requested_num_of_buffers, &out_dim, | 253 requested_num_of_buffers, &out_dim, |
| 251 texture_target); | 254 texture_target); |
| 252 } | 255 } |
| 253 | 256 |
| 254 void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) { | 257 void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 DCHECK(RenderThreadImpl::current()); | 298 DCHECK(RenderThreadImpl::current()); |
| 296 RunBitstreamBufferCallback(bitstream_buffer_id, PP_OK); | 299 RunBitstreamBufferCallback(bitstream_buffer_id, PP_OK); |
| 297 } | 300 } |
| 298 | 301 |
| 299 void PPB_VideoDecoder_Impl::NotifyFlushDone() { | 302 void PPB_VideoDecoder_Impl::NotifyFlushDone() { |
| 300 DCHECK(RenderThreadImpl::current()); | 303 DCHECK(RenderThreadImpl::current()); |
| 301 RunFlushCallback(PP_OK); | 304 RunFlushCallback(PP_OK); |
| 302 } | 305 } |
| 303 | 306 |
| 304 } // namespace content | 307 } // namespace content |
| OLD | NEW |