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

Side by Side Diff: webrtc/modules/video_capture/linux/video_capture_linux.cc

Issue 1671483002: check v4l frame rate capability with bitwise method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 struct v4l2_streamparm streamparms; 238 struct v4l2_streamparm streamparms;
239 memset(&streamparms, 0, sizeof(streamparms)); 239 memset(&streamparms, 0, sizeof(streamparms));
240 streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 240 streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
241 if (ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) { 241 if (ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
242 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, 242 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
243 "error in VIDIOC_G_PARM errno = %d", errno); 243 "error in VIDIOC_G_PARM errno = %d", errno);
244 driver_framerate_support = false; 244 driver_framerate_support = false;
245 // continue 245 // continue
246 } else { 246 } else {
247 // check the capability flag is set to V4L2_CAP_TIMEPERFRAME. 247 // check the capability flag is set to V4L2_CAP_TIMEPERFRAME.
248 if (streamparms.parm.capture.capability == V4L2_CAP_TIMEPERFRAME) { 248 if (streamparms.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) {
249 // driver supports the feature. Set required framerate. 249 // driver supports the feature. Set required framerate.
250 memset(&streamparms, 0, sizeof(streamparms)); 250 memset(&streamparms, 0, sizeof(streamparms));
251 streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 251 streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
252 streamparms.parm.capture.timeperframe.numerator = 1; 252 streamparms.parm.capture.timeperframe.numerator = 1;
253 streamparms.parm.capture.timeperframe.denominator = capability.maxFPS; 253 streamparms.parm.capture.timeperframe.denominator = capability.maxFPS;
254 if (ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) { 254 if (ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
255 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id, 255 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
256 "Failed to set the framerate. errno=%d", errno); 256 "Failed to set the framerate. errno=%d", errno);
257 driver_framerate_support = false; 257 driver_framerate_support = false;
258 } else { 258 } else {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 { 483 {
484 settings.width = _currentWidth; 484 settings.width = _currentWidth;
485 settings.height = _currentHeight; 485 settings.height = _currentHeight;
486 settings.maxFPS = _currentFrameRate; 486 settings.maxFPS = _currentFrameRate;
487 settings.rawType=_captureVideoType; 487 settings.rawType=_captureVideoType;
488 488
489 return 0; 489 return 0;
490 } 490 }
491 } // namespace videocapturemodule 491 } // namespace videocapturemodule
492 } // namespace webrtc 492 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698