From 21c232aa49175be7c1b806d55cde46bf6f035e12 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Mon, 10 Sep 2001 21:52:59 +0000 Subject: fixed unixscr_adjust, using it to fix small audio gaps CVS patchset: 607 CVS date: 2001/09/10 21:52:59 --- src/xine-engine/audio_out.c | 17 ++++++++++++++--- src/xine-engine/metronom.c | 6 +++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index f3cef32fd..4df9082b3 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.13 2001/09/10 03:04:48 guenter Exp $ + * $Id: audio_out.c,v 1.14 2001/09/10 21:52:59 guenter Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -239,6 +239,7 @@ static int ao_write(ao_instance_t *this, int fscod; int frmsizecod; uint8_t *data; + uint32_t cur_time; if (this->driver<0) return 1; @@ -263,7 +264,8 @@ static int ao_write(ao_instance_t *this, * where, in the timeline is the "end" of the audio buffer at the moment? */ - buffer_vpts = this->metronom->get_current_time (this->metronom); + cur_time = this->metronom->get_current_time (this->metronom); + buffer_vpts = cur_time; if (this->audio_started) delay = this->driver->delay(this->driver); @@ -288,7 +290,16 @@ static int ao_write(ao_instance_t *this, */ if (gap>this->gap_tolerance) { - ao_fill_gap (this, gap); + + + if (gap>15000) + ao_fill_gap (this, gap); + else { + printf ("audio_out: adjusting master clock %d -> %d\n", + cur_time, cur_time + gap); + this->metronom->adjust_clock (this->metronom, + cur_time + gap); + } /* keep xine responsive */ diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 098ee1553..48644548a 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.24 2001/09/04 16:19:27 guenter Exp $ + * $Id: metronom.c,v 1.25 2001/09/10 21:52:59 guenter Exp $ */ #ifdef HAVE_CONFIG_H @@ -107,9 +107,13 @@ static int unixscr_set_speed (scr_plugin_t *scr, int speed) { static void unixscr_adjust (scr_plugin_t *scr, uint32_t vpts) { unixscr_t *this = (unixscr_t*) scr; + struct timeval tv; pthread_mutex_lock (&this->lock); + gettimeofday(&tv, NULL); + this->cur_time.tv_sec=tv.tv_sec; + this->cur_time.tv_usec=tv.tv_usec; this->cur_pts = vpts; pthread_mutex_unlock (&this->lock); -- cgit v1.2.3