ahcsrc: Avoid a div by 0 warning

https://bugzilla.gnome.org/show_bug.cgi?id=767302
This commit is contained in:
Xavier Claessens 2016-06-06 14:08:43 -04:00 committed by Sebastian Dröge
parent 1ee15d1385
commit 26b66a1db5

View file

@ -1946,7 +1946,7 @@ gst_ahc_src_setcaps (GstBaseSrc * src, GstCaps * caps)
}
}
gst_ahc_parameters_supported_preview_fps_range_free (ranges);
if (self->fps_max == 0) {
if (self->fps_max == 0 || self->fps_min == 0) {
GST_ERROR_OBJECT (self, "Couldn't find an applicable FPS range");
goto end;
}
@ -2345,6 +2345,10 @@ gst_ahc_src_query (GstBaseSrc * bsrc, GstQuery * query)
case GST_QUERY_LATENCY:{
GstClockTime min;
/* Cannot query latency before setcaps() */
if (self->fps_min == 0)
return FALSE;
/* Allow of 1 frame latency base on the longer frame duration */
gst_query_parse_latency (query, NULL, &min, NULL);
min = gst_util_uint64_scale (GST_SECOND, 1000, self->fps_min);