baseparse: Avoid overflow in update_interval calculation

https://bugzilla.gnome.org/show_bug.cgi?id=793284
This commit is contained in:
Nicolas Dufresne 2018-02-21 22:01:36 -05:00
parent 25aed8c7ff
commit a84b886a7d

View file

@ -3860,7 +3860,11 @@ gst_base_parse_set_frame_rate (GstBaseParse * parse, guint fps_num,
gst_util_uint64_scale (GST_SECOND, fps_den * lead_out, fps_num);
/* aim for about 1.5s to estimate duration */
if (parse->priv->update_interval < 0) {
parse->priv->update_interval = fps_num * 3 / (fps_den * 2);
guint64 interval = gst_util_uint64_scale (fps_num, 3,
G_GUINT64_CONSTANT (2) * fps_den);
parse->priv->update_interval = MIN (interval, G_MAXINT);
GST_LOG_OBJECT (parse, "estimated update interval to %d frames",
parse->priv->update_interval);
}