changeset 8444:78d1fc838e3c

fixed possible division by zero
author henry
date Sat, 14 Dec 2002 09:55:45 +0000
parents ac4162fbfa5f
children 694cda2f75d3
files libmpdemux/tvi_v4l.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l.c	Sat Dec 14 00:39:22 2002 +0000
+++ b/libmpdemux/tvi_v4l.c	Sat Dec 14 09:55:45 2002 +0000
@@ -1404,7 +1404,12 @@
 	// stress testing by dropping half of the audio frames ;)
 	// especially when using ALSA with large block sizes
 	// where audio_skew remains a long while behind
-	priv->audio_skew_factor = (double)(priv->audio_skew-prev_skew)/(current_time - priv->audio_skew_measure_time);
+	if ((priv->audio_skew_measure_time != 0) && (current_time - priv->audio_skew_measure_time != 0)) {
+	    priv->audio_skew_factor = (double)(priv->audio_skew-prev_skew)/(current_time - priv->audio_skew_measure_time);
+	} else {
+	    priv->audio_skew_factor = 0.0;
+	}
+	
 	priv->audio_skew_measure_time = current_time;
 	prev_skew = priv->audio_skew;
 	pthread_mutex_unlock(&priv->skew_mutex);