| 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..97a37f55426f8a825e0c5382ee6090bf4f07e69a 100644
|
| --- a/media/gpu/v4l2_video_decode_accelerator.cc
|
| +++ b/media/gpu/v4l2_video_decode_accelerator.cc
|
| @@ -2110,17 +2110,30 @@ 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;
|
| -
|
| - if (device_->Ioctl(VIDIOC_G_CROP, &crop_arg) != 0) {
|
| - PLOGF(ERROR) << "ioctl() VIDIOC_G_CROP failed";
|
| - return coded_size;
|
| + struct v4l2_rect* visible_rect;
|
| + 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_SELECTION, &selection_arg) == 0) {
|
| + DVLOGF(2) << "VIDIOC_G_SELECTION is supported";
|
| + visible_rect = &selection_arg.r;
|
| + } else {
|
| + DVLOGF(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;
|
| + }
|
| + visible_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(visible_rect->left, visible_rect->top, visible_rect->width,
|
| + visible_rect->height);
|
| VLOGF(2) << "visible rectangle is " << rect.ToString();
|
| if (!gfx::Rect(coded_size).Contains(rect)) {
|
| DLOGF(ERROR) << "visible rectangle " << rect.ToString()
|
|
|