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

Side by Side 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: address review comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <libdrm/drm_fourcc.h> 5 #include <libdrm/drm_fourcc.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 7
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "content/common/gpu/media/generic_v4l2_device.h" 9 #include "content/common/gpu/media/generic_v4l2_device.h"
10 #if defined(ARCH_CPU_ARMEL) 10 #if defined(ARCH_CPU_ARMEL)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 // Sanity checks. Calculated coded size has to contain given visible size 191 // Sanity checks. Calculated coded size has to contain given visible size
192 // and fulfill buffer byte size requirements. 192 // and fulfill buffer byte size requirements.
193 DCHECK(gfx::Rect(coded_size).Contains(gfx::Rect(visible_size))); 193 DCHECK(gfx::Rect(coded_size).Contains(gfx::Rect(visible_size)));
194 DCHECK_LE(sizeimage, 194 DCHECK_LE(sizeimage,
195 media::VideoFrame::AllocationSize(frame_format, coded_size)); 195 media::VideoFrame::AllocationSize(frame_format, coded_size));
196 196
197 return coded_size; 197 return coded_size;
198 } 198 }
199 199
200 // static
201 gfx::Size V4L2Device::GetMaxSupportedResolution(
202 const scoped_refptr<V4L2Device>& device,
203 unsigned int pixelformat) {
204 gfx::Size max_resolution;
205 v4l2_frmsizeenum frame_size;
206 memset(&frame_size, 0, sizeof(frame_size));
207 frame_size.pixel_format = pixelformat;
208 for (; device->Ioctl(VIDIOC_ENUM_FRAMESIZES, &frame_size) == 0;
209 ++frame_size.index) {
210 if (frame_size.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
211 if (frame_size.discrete.width >
212 static_cast<unsigned int>(max_resolution.width()) &&
213 frame_size.discrete.height >
214 static_cast<unsigned int>(max_resolution.height())) {
215 max_resolution.SetSize(frame_size.discrete.width,
216 frame_size.discrete.height);
217 }
218 } else if (frame_size.type == V4L2_FRMIVAL_TYPE_STEPWISE ||
219 frame_size.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
220 max_resolution.SetSize(frame_size.stepwise.max_width,
221 frame_size.stepwise.max_height);
222 }
223 }
224 if (max_resolution.IsEmpty()) {
225 LOG(ERROR) << "GetMaxSupportedResolution failed for format "
226 << std::hex << pixelformat;
227 max_resolution.SetSize(1920, 1088);
228 }
229 return max_resolution;
230 }
231
200 } // namespace content 232 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698