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

Unified Diff: content/common/gpu/media/v4l2_device.cc

Issue 1097913002: Remove kIgnoreResolutionLimitsForAcceleratedVideoDecode flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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: content/common/gpu/media/v4l2_device.cc
diff --git a/content/common/gpu/media/v4l2_device.cc b/content/common/gpu/media/v4l2_device.cc
index 7629bac5e19109bc35c7eb065b72950a5b4582e0..ea559923122b2a7f44a5e98ba7116d55dbbd9ef3 100644
--- a/content/common/gpu/media/v4l2_device.cc
+++ b/content/common/gpu/media/v4l2_device.cc
@@ -197,4 +197,32 @@ gfx::Size V4L2Device::CodedSizeFromV4L2Format(struct v4l2_format format) {
return coded_size;
}
+gfx::Size V4L2Device::GetMaxSupportedResolution(unsigned int pixelformat) {
+ gfx::Size max_resolution;
+ v4l2_frmsizeenum frame_size;
+ memset(&frame_size, 0, sizeof(frame_size));
+ frame_size.pixel_format = pixelformat;
+ for (; Ioctl(VIDIOC_ENUM_FRAMESIZES, &frame_size) == 0; ++frame_size.index) {
+ if (frame_size.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
Pawel Osciak 2015/04/22 08:50:55 This define is for framerate enumeration. The corr
henryhsu 2015/04/23 03:56:42 Done.
+ if (frame_size.discrete.width >
Pawel Osciak 2015/04/22 08:50:55 Perhaps merge into the if above?
henryhsu 2015/04/23 03:56:42 Done.
+ static_cast<unsigned int>(max_resolution.width()) &&
Pawel Osciak 2015/04/22 08:50:55 I'd prefer base::checked_cast on frame_size.discre
henryhsu 2015/04/23 03:56:42 Done.
+ frame_size.discrete.height >
+ static_cast<unsigned int>(max_resolution.height())) {
+ max_resolution.SetSize(frame_size.discrete.width,
Pawel Osciak 2015/04/22 08:50:55 If you get say 640x360 and next 640x480, I think t
Pawel Osciak 2015/04/22 10:01:38 Sorry, not this, but probably s/>/>=/ ?
henryhsu 2015/04/23 03:56:42 Use || may have the case: first is 640x480, second
+ frame_size.discrete.height);
+ }
+ } else if (frame_size.type == V4L2_FRMIVAL_TYPE_STEPWISE ||
+ frame_size.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
+ max_resolution.SetSize(frame_size.stepwise.max_width,
+ frame_size.stepwise.max_height);
Pawel Osciak 2015/04/22 08:50:55 You could break here to avoid an additional ioctl
henryhsu 2015/04/23 03:56:42 Done.
+ }
+ }
+ if (max_resolution.IsEmpty()) {
+ LOG(ERROR) << "GetMaxSupportedResolution failed for format "
Pawel Osciak 2015/04/22 08:50:55 s/format/fourcc/
henryhsu 2015/04/23 03:56:42 Done.
+ << std::hex << pixelformat;
+ max_resolution.SetSize(1920, 1088);
Pawel Osciak 2015/04/22 08:50:55 Please also say that we are falling back to 1088p
henryhsu 2015/04/23 03:56:42 Done.
+ }
+ return max_resolution;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698