Commit c2df1030 authored by emircan's avatar emircan Committed by Commit bot

Fix low frame rate problems in high resolution USB cameras using AVFoundation

This CL addresses the issue reported in the below CL about low frame rate in high
resolution USB cameras using AVFoundation. It reorders output formats for
AVCaptureSession.

All credit for this patch goes to briely.marum@coviu.com, see
https://bugs.chromium.org/p/chromium/issues/detail?id=670944#c23

BUG=670944
TEST=Tested video output with C920.

Review-Url: https://codereview.chromium.org/2585383002
Cr-Commit-Position: refs/heads/master@{#439602}
parent 69edf1bf
......@@ -261,6 +261,12 @@ void ExtractBaseAddressAndLength(char** base_address,
}
[captureSession_ addInput:captureDeviceInput_];
// Create and plug the still image capture output. This should happen in
// advance of the actual picture to allow for the 3A to stabilize.
stillImageOutput_.reset([[AVCaptureStillImageOutput alloc] init]);
if (stillImageOutput_ && [captureSession_ canAddOutput:stillImageOutput_])
[captureSession_ addOutput:stillImageOutput_];
// Create a new data output for video. The data output is configured to
// discard late frames by default.
captureVideoDataOutput_.reset([[AVCaptureVideoDataOutput alloc] init]);
......@@ -277,12 +283,6 @@ void ExtractBaseAddressAndLength(char** base_address,
DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)];
[captureSession_ addOutput:captureVideoDataOutput_];
// Create and plug the still image capture output. This should happen in
// advance of the actual picture to allow for the 3A to stabilize.
stillImageOutput_.reset([[AVCaptureStillImageOutput alloc] init]);
if (stillImageOutput_ && [captureSession_ canAddOutput:stillImageOutput_])
[captureSession_ addOutput:stillImageOutput_];
return YES;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment