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 d9e3384ffd6bc4e769f882c9b3f80d8a00547f34..3dd1733ee8b8c53ed7c68051cde0efdac4ad97f1 100644 |
| --- a/media/gpu/v4l2_video_decode_accelerator.cc |
| +++ b/media/gpu/v4l2_video_decode_accelerator.cc |
| @@ -2110,17 +2110,31 @@ gfx::Size V4L2VideoDecodeAccelerator::GetVisibleSize( |
| const gfx::Size& coded_size) { |
| DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread()); |
| - struct v4l2_crop crop_arg; |
| - memset(&crop_arg, 0, sizeof(crop_arg)); |
| - crop_arg.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| + struct v4l2_rect* ioctl_rect = NULL; |
|
wuchengli
2017/06/29 07:55:22
s/ioctl_rect/visible_rect/. It's more readable.
|
| + struct v4l2_selection selection_arg; |
| + memset(&selection_arg, 0, sizeof(selection_arg)); |
| + selection_arg.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
| + selection_arg.target = V4L2_SEL_TGT_COMPOSE; |
| - if (device_->Ioctl(VIDIOC_G_CROP, &crop_arg) != 0) { |
| - PLOGF(ERROR) << "ioctl() VIDIOC_G_CROP failed"; |
| - return coded_size; |
| + if (device_->Ioctl(VIDIOC_G_SELECTION, &selection_arg) == 0) { |
| + ioctl_rect = &selection_arg.r; |
| + } |
|
wuchengli
2017/06/29 07:55:22
if (device_->Ioctl(VIDIOC_G_SELECTION, &selection_
|
| + |
| + if (ioctl_rect == NULL) { |
| + VLOGF(2) << "Fallback to VIDIOC_G_CROP"; |
| + struct v4l2_crop crop_arg; |
| + memset(&crop_arg, 0, sizeof(crop_arg)); |
| + crop_arg.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
| + |
| + if (device_->Ioctl(VIDIOC_G_CROP, &crop_arg) != 0) { |
| + PLOGF(ERROR) << "ioctl() VIDIOC_G_CROP failed"; |
| + return coded_size; |
| + } |
| + ioctl_rect = &crop_arg.c; |
| } |
| - gfx::Rect rect(crop_arg.c.left, crop_arg.c.top, crop_arg.c.width, |
| - crop_arg.c.height); |
| + gfx::Rect rect(ioctl_rect->left, ioctl_rect->top, ioctl_rect->width, |
| + ioctl_rect->height); |
| VLOGF(2) << "visible rectangle is " << rect.ToString(); |
| if (!gfx::Rect(coded_size).Contains(rect)) { |
| DLOGF(ERROR) << "visible rectangle " << rect.ToString() |