audioparse: fix possible division-by-zero

https://bugzilla.gnome.org/show_bug.cgi?id=635786
This commit is contained in:
Andoni Morales Alastruey 2010-11-25 17:14:23 +01:00 committed by Tim-Philipp Müller
parent 4230c0b2e1
commit fc4885a3a3

View file

@ -1131,7 +1131,7 @@ gst_base_parse_update_bitrates (GstBaseParse * parse, GstBuffer * buffer)
/* duration should be valid by now, /* duration should be valid by now,
* either set by subclass or maybe based on fps settings */ * either set by subclass or maybe based on fps settings */
if (GST_BUFFER_DURATION_IS_VALID (buffer)) { if (GST_BUFFER_DURATION_IS_VALID (buffer) && parse->priv->acc_duration != 0) {
/* Calculate duration of a frame from buffer properties */ /* Calculate duration of a frame from buffer properties */
frame_dur = GST_BUFFER_DURATION (buffer); frame_dur = GST_BUFFER_DURATION (buffer);
parse->priv->avg_bitrate = (8 * parse->priv->data_bytecount * GST_SECOND) / parse->priv->avg_bitrate = (8 * parse->priv->data_bytecount * GST_SECOND) /