| 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..40dfaf632273c9910ea78792ff39f9131aa1f7df 100644
|
| --- a/media/gpu/v4l2_video_decode_accelerator.cc
|
| +++ b/media/gpu/v4l2_video_decode_accelerator.cc
|
| @@ -274,21 +274,10 @@ bool V4L2VideoDecodeAccelerator::Initialize(const Config& config,
|
| if (!SetupFormats())
|
| return false;
|
|
|
| - // Subscribe to the resolution change event.
|
| - struct v4l2_event_subscription sub;
|
| - memset(&sub, 0, sizeof(sub));
|
| - sub.type = V4L2_EVENT_SOURCE_CHANGE;
|
| - IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_SUBSCRIBE_EVENT, &sub);
|
| -
|
| if (video_profile_ >= H264PROFILE_MIN && video_profile_ <= H264PROFILE_MAX) {
|
| decoder_h264_parser_.reset(new H264Parser());
|
| }
|
|
|
| - if (!CreateInputBuffers())
|
| - return false;
|
| -
|
| - decoder_cmd_supported_ = IsDecoderCmdSupported();
|
| -
|
| if (!decoder_thread_.Start()) {
|
| LOGF(ERROR) << "decoder thread failed to start";
|
| return false;
|
| @@ -297,15 +286,36 @@ bool V4L2VideoDecodeAccelerator::Initialize(const Config& config,
|
| 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());
|
| + DCHECK_EQ(decoder_state_, kInitialized);
|
| +
|
| + // Subscribe to the resolution change event.
|
| + struct v4l2_event_subscription sub;
|
| + memset(&sub, 0, sizeof(sub));
|
| + sub.type = V4L2_EVENT_SOURCE_CHANGE;
|
| + IOCTL_OR_ERROR_RETURN(VIDIOC_SUBSCRIBE_EVENT, &sub);
|
| +
|
| + if (!CreateInputBuffers()) {
|
| + NOTIFY_ERROR(PLATFORM_FAILURE);
|
| + return;
|
| + }
|
| +
|
| + decoder_cmd_supported_ = IsDecoderCmdSupported();
|
| +
|
| + if (!StartDevicePoll())
|
| + return;
|
| +}
|
| +
|
| void V4L2VideoDecodeAccelerator::Decode(
|
| const BitstreamBuffer& bitstream_buffer) {
|
| DVLOGF(1) << "input_id=" << bitstream_buffer.id()
|
| @@ -2129,8 +2139,9 @@ 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_EQ(decoder_state_, kInitialized);
|
| DCHECK(!input_streamon_);
|
| DCHECK(input_buffer_map_.empty());
|
|
|
|
|