changeset 10810:d0aaa6bf3def

10l - forgotten gettimeofday
author henry
date Fri, 05 Sep 2003 10:35:00 +0000
parents 304c94c89359
children a69221e84948
files libmpdemux/tvi_v4l2.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tvi_v4l2.c	Wed Sep 03 22:44:28 2003 +0000
+++ b/libmpdemux/tvi_v4l2.c	Fri Sep 05 10:35:00 2003 +0000
@@ -1547,6 +1547,8 @@
 	pthread_mutex_lock(&priv->skew_mutex);
 	if (priv->first_frame == 0) {
 	    // there is no first frame yet (unlikely to happen)
+	    gettimeofday(&tv, NULL);
+	    priv->audio_start_time = (long long)1e6*tv.tv_sec + tv.tv_usec;
 //	    fprintf(stderr, "warning - first frame not yet available!\n");
 	    pthread_mutex_unlock(&priv->skew_mutex);
 	    continue;
@@ -1593,7 +1595,6 @@
 	// now finally, priv->audio_skew contains fairly good approximation
 	// of the current value 
 
-//	fprintf(stderr, "audio_skew = %lf, delta = %lf\n", (double)priv->audio_skew/1e6, (double)priv->audio_skew_delta_total/1e6);
 	// current skew factor (assuming linearity)
 	// used for further interpolation in video_grabber
 	// probably overkill but seems to be necessary for
@@ -1610,6 +1611,8 @@
 	prev_skew = priv->audio_skew;
 	priv->audio_skew -= priv->audio_start_time - priv->first_frame;
 	pthread_mutex_unlock(&priv->skew_mutex);
+
+//	fprintf(stderr, "audio_skew = %lf, delta = %lf\n", (double)priv->audio_skew/1e6, (double)priv->audio_skew_delta_total/1e6);
 	
 	if ((priv->audio_tail+1) % priv->audio_buffer_size == priv->audio_head) {
 	    mp_msg(MSGT_TV, MSGL_ERR, "\ntoo bad - dropping audio frame !\n");