mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:06:17 +00:00
applemedia: avfvideosrc: actually set the configured framerate
Actually set the configured framerate. Before we only used to set the first matching framerate range. On iOS where the camera reports ranges [2, 60], we used to configure the camera to output anything between 2 and 60fps.
This commit is contained in:
parent
a152a8342b
commit
6f80d5c59a
1 changed files with 15 additions and 7 deletions
|
@ -521,16 +521,24 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
||||||
[[rate valueForKey:@"maxFrameRate"] getValue:&max_frame_rate];
|
[[rate valueForKey:@"maxFrameRate"] getValue:&max_frame_rate];
|
||||||
if ((framerate >= min_frame_rate - 0.00001) &&
|
if ((framerate >= min_frame_rate - 0.00001) &&
|
||||||
(framerate <= max_frame_rate + 0.00001)) {
|
(framerate <= max_frame_rate + 0.00001)) {
|
||||||
NSValue *min_frame_duration, *max_frame_duration;
|
NSValue *frame_duration_value;
|
||||||
|
|
||||||
found_framerate = TRUE;
|
found_framerate = TRUE;
|
||||||
min_frame_duration = [rate valueForKey:@"minFrameDuration"];
|
if (min_frame_rate == max_frame_rate) {
|
||||||
max_frame_duration = [rate valueForKey:@"maxFrameDuration"];
|
/* on mac we get tight ranges and an exception is raised if the
|
||||||
[device setValue:min_frame_duration forKey:@"activeVideoMinFrameDuration"];
|
* frame duration doesn't match the one reported in the range to
|
||||||
|
* the last decimal point
|
||||||
|
*/
|
||||||
|
frame_duration_value = [rate valueForKey:@"minFrameDuration"];
|
||||||
|
} else {
|
||||||
|
double frame_duration;
|
||||||
|
|
||||||
|
gst_util_fraction_to_double (info->fps_d, info->fps_n, &frame_duration);
|
||||||
|
frame_duration_value = [NSNumber numberWithDouble:frame_duration];
|
||||||
|
}
|
||||||
|
[device setValue:frame_duration_value forKey:@"activeVideoMinFrameDuration"];
|
||||||
@try {
|
@try {
|
||||||
/* Only available on OSX >= 10.8 and iOS >= 7.0 */
|
/* Only available on OSX >= 10.8 and iOS >= 7.0 */
|
||||||
// Restrict activeVideoMaxFrameDuration to the minimum value so we get a better capture frame rate
|
[device setValue:frame_duration_value forKey:@"activeVideoMaxFrameDuration"];
|
||||||
[device setValue:min_frame_duration forKey:@"activeVideoMaxFrameDuration"];
|
|
||||||
} @catch (NSException *exception) {
|
} @catch (NSException *exception) {
|
||||||
if (![[exception name] isEqualToString:NSUndefinedKeyException]) {
|
if (![[exception name] isEqualToString:NSUndefinedKeyException]) {
|
||||||
GST_WARNING ("An unexcepted error occured: %s",
|
GST_WARNING ("An unexcepted error occured: %s",
|
||||||
|
|
Loading…
Reference in a new issue