Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1496)

Unified Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2958213002: V4L2 VDA/VEA: Use VIDIOC_G/S_SELECTION for accelerators (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()
« no previous file with comments | « no previous file | media/gpu/v4l2_video_encode_accelerator.cc » ('j') | media/gpu/v4l2_video_encode_accelerator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698