| Index: media/filters/gpu_video_decoder.cc
|
| diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc
|
| index 31c550b3a1ed08dfe849c41970d7873f8a531bf3..ef3198fd20adc50aab1450ed24135a08f3926a88 100644
|
| --- a/media/filters/gpu_video_decoder.cc
|
| +++ b/media/filters/gpu_video_decoder.cc
|
| @@ -495,9 +495,13 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count,
|
| DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
|
|
|
| std::vector<uint32> texture_ids;
|
| + std::vector<gpu::Mailbox> texture_mailboxes;
|
| decoder_texture_target_ = texture_target;
|
| - if (!factories_->CreateTextures(
|
| - count, size, &texture_ids, decoder_texture_target_)) {
|
| + if (!factories_->CreateTextures(count,
|
| + size,
|
| + &texture_ids,
|
| + &texture_mailboxes,
|
| + decoder_texture_target_)) {
|
| NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
|
| return;
|
| }
|
| @@ -509,7 +513,7 @@ void GpuVideoDecoder::ProvidePictureBuffers(uint32 count,
|
| std::vector<PictureBuffer> picture_buffers;
|
| for (size_t i = 0; i < texture_ids.size(); ++i) {
|
| picture_buffers.push_back(PictureBuffer(
|
| - next_picture_buffer_id_++, size, texture_ids[i]));
|
| + next_picture_buffer_id_++, size, texture_ids[i], texture_mailboxes[i]));
|
| bool inserted = assigned_picture_buffers_.insert(std::make_pair(
|
| picture_buffers.back().id(), picture_buffers.back())).second;
|
| DCHECK(inserted);
|
| @@ -570,16 +574,25 @@ void GpuVideoDecoder::PictureReady(const media::Picture& picture) {
|
| GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect,
|
| &natural_size);
|
| DCHECK(decoder_texture_target_);
|
| +
|
| + uint32 sync_point = factories_->ProduceTextureToMailbox(
|
| + pb.texture_mailbox(),
|
| + pb.texture_id(),
|
| + decoder_texture_target_);
|
| +
|
| scoped_refptr<VideoFrame> frame(
|
| VideoFrame::WrapNativeTexture(
|
| - pb.texture_id(), decoder_texture_target_, pb.size(), visible_rect,
|
| + pb.texture_mailbox(), sync_point,
|
| + decoder_texture_target_,
|
| + pb.size(), visible_rect,
|
| natural_size, timestamp,
|
| base::Bind(&Factories::ReadPixels, factories_, pb.texture_id(),
|
| decoder_texture_target_,
|
| gfx::Size(visible_rect.width(), visible_rect.height())),
|
| BindToCurrentLoop(base::Bind(
|
| &GpuVideoDecoder::ReusePictureBuffer, weak_this_,
|
| - picture.picture_buffer_id()))));
|
| + picture.picture_buffer_id())),
|
| + base::Closure()));
|
| CHECK_GT(available_pictures_, 0);
|
| --available_pictures_;
|
| bool inserted =
|
| @@ -610,7 +623,8 @@ void GpuVideoDecoder::EnqueueFrameAndTriggerFrameDelivery(
|
| ready_video_frames_.pop_front();
|
| }
|
|
|
| -void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id) {
|
| +void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id,
|
| + uint32 sync_point) {
|
| DCHECK(gvd_loop_proxy_->BelongsToCurrentThread());
|
|
|
| if (!vda_)
|
| @@ -633,8 +647,15 @@ void GpuVideoDecoder::ReusePictureBuffer(int64 picture_buffer_id) {
|
| return;
|
| }
|
|
|
| + const PictureBuffer& pb = it->second;
|
| + factories_->ConsumeMailboxToTexture(pb.texture_mailbox(),
|
| + pb.texture_id(),
|
| + decoder_texture_target_,
|
| + sync_point);
|
| +
|
| ++available_pictures_;
|
|
|
| +
|
| vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
|
| &VideoDecodeAccelerator::ReusePictureBuffer, weak_vda_,
|
| picture_buffer_id));
|
|
|