Chromium Code Reviews| Index: media/gpu/v4l2_video_decode_accelerator.cc |
| diff --git a/media/gpu/v4l2_video_decode_accelerator.cc b/media/gpu/v4l2_video_decode_accelerator.cc |
| index 1d5cf8ee6cb11d9b4e7222f4b08d7089e7f2b47e..3e761878946392861ea2e2a8f0b760e6478b1243 100644 |
| --- a/media/gpu/v4l2_video_decode_accelerator.cc |
| +++ b/media/gpu/v4l2_video_decode_accelerator.cc |
| @@ -284,9 +284,6 @@ bool V4L2VideoDecodeAccelerator::Initialize(const Config& config, |
| decoder_h264_parser_.reset(new H264Parser()); |
| } |
| - if (!CreateInputBuffers()) |
| - return false; |
| - |
| decoder_cmd_supported_ = IsDecoderCmdSupported(); |
|
Pawel Osciak
2016/11/24 08:28:35
Could this and the subscribe event ioctl above be
wuchengli
2016/11/28 06:13:58
Done.
|
| if (!decoder_thread_.Start()) { |
| @@ -294,18 +291,31 @@ bool V4L2VideoDecodeAccelerator::Initialize(const Config& config, |
| return false; |
| } |
| - decoder_state_ = kInitialized; |
| output_mode_ = config.output_mode; |
| - // StartDevicePoll will NOTIFY_ERROR on failure, so IgnoreResult is fine here. |
| + // InitializeTask will NOTIFY_ERROR on failure. |
| decoder_thread_.task_runner()->PostTask( |
| - FROM_HERE, base::Bind(base::IgnoreResult( |
| - &V4L2VideoDecodeAccelerator::StartDevicePoll), |
| + FROM_HERE, base::Bind(&V4L2VideoDecodeAccelerator::InitializeTask, |
| base::Unretained(this))); |
| return true; |
| } |
| +void V4L2VideoDecodeAccelerator::InitializeTask() { |
| + DVLOGF(3); |
| + DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| + |
| + if (!CreateInputBuffers()) { |
| + NOTIFY_ERROR(PLATFORM_FAILURE); |
| + return; |
| + } |
| + |
| + if (!StartDevicePoll()) |
|
Owen Lin
2016/11/24 07:44:23
Add a comment that StartDevicePoll with NOTIFY_ERR
wuchengli
2016/11/24 08:20:09
Two other StartDevicePoll doesn't have this commen
|
| + return; |
| + |
| + decoder_state_ = kInitialized; |
| +} |
| + |
| void V4L2VideoDecodeAccelerator::Decode( |
| const BitstreamBuffer& bitstream_buffer) { |
| DVLOGF(1) << "input_id=" << bitstream_buffer.id() |
| @@ -2129,6 +2139,7 @@ gfx::Size V4L2VideoDecodeAccelerator::GetVisibleSize( |
| bool V4L2VideoDecodeAccelerator::CreateInputBuffers() { |
| DVLOGF(3); |
| + DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| // We always run this as we prepare to initialize. |
| DCHECK_EQ(decoder_state_, kUninitialized); |
| DCHECK(!input_streamon_); |