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

Unified Diff: media/gpu/v4l2_video_decode_accelerator.cc

Issue 2958213002: V4L2 VDA/VEA: Use VIDIOC_G/S_SELECTION for accelerators (Closed)
Patch Set: V4L2 VDA/VEA: Use VIDIOC_G/S_SELECTION for codec drivers Created 3 years, 5 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
« no previous file with comments | « no previous file | media/gpu/v4l2_video_encode_accelerator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | media/gpu/v4l2_video_encode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698