Chromium Code Reviews| Index: media/mojo/clients/mojo_video_decoder.cc |
| diff --git a/media/mojo/clients/mojo_video_decoder.cc b/media/mojo/clients/mojo_video_decoder.cc |
| index c608bdcd2966e5e3529c689388f23e99f0f071bc..2bbad5e364cbaf6b91650168bed9593be1259dce 100644 |
| --- a/media/mojo/clients/mojo_video_decoder.cc |
| +++ b/media/mojo/clients/mojo_video_decoder.cc |
| @@ -104,10 +104,28 @@ void MojoVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| base::Unretained(this), decode_id)); |
| } |
| -void MojoVideoDecoder::OnVideoFrameDecoded(mojom::VideoFramePtr frame) { |
| +void MojoVideoDecoder::OnVideoFrameDecoded( |
| + mojom::VideoFramePtr frame, |
| + const OnVideoFrameDecodedCallback& callback) { |
| DVLOG(2) << __func__; |
| DCHECK(task_runner_->BelongsToCurrentThread()); |
| - output_cb_.Run(frame.To<scoped_refptr<VideoFrame>>()); |
| + |
| + scoped_refptr<VideoFrame> video_frame = frame.To<scoped_refptr<VideoFrame>>(); |
| + // TODO(sandersd): Fix threading and lifetime of |this|. |
| + video_frame->SetReleaseMailboxCB(base::Bind( |
| + &MojoVideoDecoder::OnReleaseMailbox, base::Unretained(this), callback)); |
|
sandersd (OOO until July 31)
2017/01/19 19:40:48
This isn't useful for non-mailbox VideoFrames, but
|
| + output_cb_.Run(std::move(video_frame)); |
| +} |
| + |
| +void MojoVideoDecoder::OnReleaseMailbox( |
| + const OnVideoFrameDecodedCallback& callback, |
| + const gpu::SyncToken& release_sync_token) { |
| + DCHECK(task_runner_->BelongsToCurrentThread()); |
| + |
| + base::Optional<gpu::SyncToken> token; |
| + if (release_sync_token.HasData()) |
| + token = release_sync_token; |
| + callback.Run(std::move(token)); |
| } |
| void MojoVideoDecoder::OnDecodeDone(uint64_t decode_id, DecodeStatus status) { |