diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2016-03-11 15:26:05 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@qt.io> | 2016-06-03 09:43:48 +0000 |
commit | a4656b06ebaa031666ccd2f29c2426647db534e2 (patch) | |
tree | 3561e73f50f543c7b48b1c699571b83395581d3e /src/plugins/avfoundation | |
parent | 4fa23e08a116b4d9bb67e25771c511838104999f (diff) | |
download | qtmultimedia-a4656b06ebaa031666ccd2f29c2426647db534e2.tar.gz |
AVFoundation: correctly set default frame rate on OSX.
On OSX, it's not possible to reset the frame rate to the default value
by passing kCMTimeInvalid, so just set the first value from the
supported frame rates.
Change-Id: I984101c2a95e13053228e56f19b353e716eb2b67
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/plugins/avfoundation')
-rw-r--r-- | src/plugins/avfoundation/camera/avfcamerautility.mm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/avfoundation/camera/avfcamerautility.mm b/src/plugins/avfoundation/camera/avfcamerautility.mm index 0caf07f07..712868d22 100644 --- a/src/plugins/avfoundation/camera/avfcamerautility.mm +++ b/src/plugins/avfoundation/camera/avfcamerautility.mm @@ -489,10 +489,17 @@ void qt_set_framerate_limits(AVCaptureDevice *captureDevice, qreal minFPS, qreal // settings for this format, kCMTimeInvalid on OS X ends with a runtime // exception: // "The activeVideoMinFrameDuration passed is not supported by the device." + // Instead, use the first item in the supported frame rates. #ifdef Q_OS_IOS [captureDevice setActiveVideoMinFrameDuration:minFrameDuration]; [captureDevice setActiveVideoMaxFrameDuration:maxFrameDuration]; #else // Q_OS_OSX + if (CMTimeCompare(minFrameDuration, kCMTimeInvalid) == 0 + && CMTimeCompare(maxFrameDuration, kCMTimeInvalid) == 0) { + AVFrameRateRange *range = captureDevice.activeFormat.videoSupportedFrameRateRanges.firstObject; + minFrameDuration = range.minFrameDuration; + maxFrameDuration = range.maxFrameDuration; + } if (CMTimeCompare(minFrameDuration, kCMTimeInvalid)) [captureDevice setActiveVideoMinFrameDuration:minFrameDuration]; |