Chromium Code Reviews| Index: media/filters/gpu_video_decoder.cc |
| diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
| index f2204e4d668b89b387644afb73660de1289b5cdd..0585087fc9fcd1b2db0f3403a862604d22d92b7c 100644 |
| --- a/media/filters/gpu_video_decoder.cc |
| +++ b/media/filters/gpu_video_decoder.cc |
| @@ -77,6 +77,7 @@ GpuVideoDecoder::GpuVideoDecoder(GpuVideoAcceleratorFactories* factories, |
| state_(kNormal), |
| request_surface_cb_(request_surface_cb), |
| decoder_texture_target_(0), |
| + pixel_format_(PIXEL_FORMAT_UNKNOWN), |
| next_picture_buffer_id_(0), |
| next_bitstream_buffer_id_(0), |
| available_pictures_(0), |
| @@ -442,6 +443,7 @@ int GpuVideoDecoder::GetMaxDecodeRequests() const { |
| } |
| void GpuVideoDecoder::ProvidePictureBuffers(uint32_t count, |
| + VideoPixelFormat format, |
| uint32_t textures_per_buffer, |
| const gfx::Size& size, |
| uint32_t texture_target) { |
| @@ -484,6 +486,13 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32_t count, |
| available_pictures_ += count; |
| + pixel_format_ = format; |
|
Pawel Osciak
2016/05/18 07:32:31
We may have more than one set of buffers with diff
liberato (no reviews please)
2016/05/18 14:49:27
+1. the renderer factory memorizes RGBA right now,
|
| + |
| + if (pixel_format_ == PIXEL_FORMAT_UNKNOWN) { |
| + pixel_format_ = |
| + IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; |
| + } |
| + |
| vda_->AssignPictureBuffers(picture_buffers); |
| } |
| @@ -556,12 +565,6 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) { |
| DCHECK(decoder_texture_target_); |
| - VideoPixelFormat pixel_format = vda_->GetOutputFormat(); |
| - if (pixel_format == PIXEL_FORMAT_UNKNOWN) { |
| - pixel_format = |
| - IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; |
| - } |
| - |
| gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; |
| for (size_t i = 0; i < pb.texture_ids().size(); ++i) { |
| mailbox_holders[i] = gpu::MailboxHolder( |
| @@ -569,7 +572,7 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) { |
| } |
| scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures( |
| - pixel_format, mailbox_holders, |
| + pixel_format_, mailbox_holders, |
| base::Bind(&ReleaseMailboxTrampoline, factories_->GetTaskRunner(), |
| base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
| weak_factory_.GetWeakPtr(), factories_, |