Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/mojo/services/mojo_video_decoder_service.h" | 5 #include "media/mojo/services/mojo_video_decoder_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 MojoVideoDecoderService::MojoVideoDecoderService( | 24 MojoVideoDecoderService::MojoVideoDecoderService( |
| 25 MojoMediaClient* mojo_media_client) | 25 MojoMediaClient* mojo_media_client) |
| 26 : mojo_media_client_(mojo_media_client), weak_factory_(this) { | 26 : mojo_media_client_(mojo_media_client), weak_factory_(this) { |
| 27 weak_this_ = weak_factory_.GetWeakPtr(); | 27 weak_this_ = weak_factory_.GetWeakPtr(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 MojoVideoDecoderService::~MojoVideoDecoderService() {} | 30 MojoVideoDecoderService::~MojoVideoDecoderService() {} |
| 31 | 31 |
| 32 void MojoVideoDecoderService::Construct( | 32 void MojoVideoDecoderService::Construct( |
| 33 mojom::VideoDecoderClientAssociatedPtrInfo client, | 33 mojom::VideoDecoderClientAssociatedPtrInfo client, |
| 34 mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe) { | 34 mojo::ScopedDataPipeConsumerHandle decoder_buffer_pipe, |
| 35 mojom::CommandBufferIdPtr command_buffer_id) { | |
| 35 DVLOG(1) << __func__; | 36 DVLOG(1) << __func__; |
| 36 | 37 |
| 38 // TODO(sandersd): Enter an error state. | |
|
dcheng
2017/01/11 09:14:18
What does this mean?
sandersd (OOO until July 31)
2017/01/11 21:33:09
The client should not have called this method at t
dcheng
2017/01/11 22:01:59
Out of curiosity, how will they be handled? =)
sandersd (OOO until July 31)
2017/01/11 22:21:31
The plan is to pass a callback into the constructo
| |
| 37 if (decoder_) | 39 if (decoder_) |
| 38 return; | 40 return; |
| 39 | 41 |
| 40 // TODO(sandersd): Provide callback for requesting a GpuCommandBufferStub. | 42 // TODO(sandersd): Provide callback for requesting a GpuCommandBufferStub. |
| 41 decoder_ = mojo_media_client_->CreateVideoDecoder( | 43 decoder_ = mojo_media_client_->CreateVideoDecoder( |
| 42 base::ThreadTaskRunnerHandle::Get()); | 44 base::ThreadTaskRunnerHandle::Get(), std::move(command_buffer_id)); |
| 43 | 45 |
| 44 client_.Bind(std::move(client)); | 46 client_.Bind(std::move(client)); |
| 45 | 47 |
| 46 mojo_decoder_buffer_reader_.reset( | 48 mojo_decoder_buffer_reader_.reset( |
| 47 new MojoDecoderBufferReader(std::move(decoder_buffer_pipe))); | 49 new MojoDecoderBufferReader(std::move(decoder_buffer_pipe))); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void MojoVideoDecoderService::Initialize(mojom::VideoDecoderConfigPtr config, | 52 void MojoVideoDecoderService::Initialize(mojom::VideoDecoderConfigPtr config, |
| 51 bool low_delay, | 53 bool low_delay, |
| 52 const InitializeCallback& callback) { | 54 const InitializeCallback& callback) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 } | 130 } |
| 129 | 131 |
| 130 void MojoVideoDecoderService::OnDecoderOutput( | 132 void MojoVideoDecoderService::OnDecoderOutput( |
| 131 const scoped_refptr<VideoFrame>& frame) { | 133 const scoped_refptr<VideoFrame>& frame) { |
| 132 DVLOG(2) << __func__; | 134 DVLOG(2) << __func__; |
| 133 DCHECK(client_); | 135 DCHECK(client_); |
| 134 client_->OnVideoFrameDecoded(mojom::VideoFrame::From(frame)); | 136 client_->OnVideoFrameDecoded(mojom::VideoFrame::From(frame)); |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace media | 139 } // namespace media |
| OLD | NEW |