diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2002-06-29 14:32:36 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2002-06-29 14:32:36 +0000 |
commit | 02ef51c2f4a7bff16c7497c2199a4008de85a055 (patch) | |
tree | ee8f07a1afdd16e7bf9c631c25d13ddf087867bc | |
parent | 6a914bb8e70406cbec9c7bce3c96335a5b538d41 (diff) | |
download | xine-lib-02ef51c2f4a7bff16c7497c2199a4008de85a055.tar.gz xine-lib-02ef51c2f4a7bff16c7497c2199a4008de85a055.tar.bz2 |
Use an other method for DISC_STREAMSEEK :
force the detection of an audio jump instead of trying to manualy reintroduce a diff, it's looks better.
It fixes also the sync problem at start, it's magic ;-)
It's only used by the avi demuxer now.
CVS patchset: 2175
CVS date: 2002/06/29 14:32:36
-rw-r--r-- | src/xine-engine/metronom.c | 32 | ||||
-rw-r--r-- | src/xine-engine/metronom.h | 3 |
2 files changed, 26 insertions, 9 deletions
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 016e6f7df..9bda471fc 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.86 2002/06/20 14:49:53 mroi Exp $ + * $Id: metronom.c,v 1.87 2002/06/29 14:32:36 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -281,10 +281,11 @@ static int64_t metronom_got_spu_packet (metronom_t *this, int64_t pts) { static void metronom_handle_video_discontinuity (metronom_t *this, int type, int64_t disc_off) { - int64_t av_diff; pthread_mutex_lock (&this->lock); - av_diff = this->video_vpts - this->audio_vpts; +#ifdef LOG + printf ("metronom: av_diff=%ld\n", this->video_vpts - this->audio_vpts); +#endif this->video_discontinuity_count++; pthread_cond_signal (&this->video_discontinuity_reached); @@ -318,22 +319,37 @@ static void metronom_handle_video_discontinuity (metronom_t *this, int type, switch (type) { case DISC_STREAMSTART: +#ifdef LOG + printf ("metronom: DISC_STREAMSTART\n"); +#endif this->vpts_offset = this->video_vpts; this->in_discontinuity = 0; + this->force_audio_jump = 0; break; case DISC_ABSOLUTE: +#ifdef LOG + printf ("metronom: DISC_ABSOLUTE\n"); +#endif this->next_vpts_offset = this->video_vpts - disc_off; this->in_discontinuity = 30; + this->force_audio_jump = 0; break; case DISC_RELATIVE: +#ifdef LOG + printf ("metronom: DISC_RELATIVE\n"); +#endif this->next_vpts_offset = this->vpts_offset - disc_off; this->in_discontinuity = 30; + this->force_audio_jump = 0; break; case DISC_STREAMSEEK: +#ifdef LOG + printf ("metronom: DISC_STREAMSEEK\n"); +#endif this->vpts_offset = this->video_vpts - disc_off; this->next_vpts_offset = this->video_vpts - disc_off; - this->in_discontinuity = 0; - this->audio_vpts = this->video_vpts - av_diff; + this->in_discontinuity = 30; + this->force_audio_jump = 1; this->allow_full_ao_fill_gap = 1; break; } @@ -481,17 +497,17 @@ static int64_t metronom_got_audio_samples (metronom_t *this, int64_t pts, pthread_mutex_lock (&this->lock); - if (this->in_discontinuity) + if (this->in_discontinuity && !this->force_audio_jump) pts = 0; /* ignore pts during discontinuities */ - if (pts) { vpts = pts + this->vpts_offset; diff = this->audio_vpts - vpts; /* compare predicted and given vpts */ - if( abs(diff) > AUDIO_DRIFT_TOLERANCE ) { + if( (abs(diff) > AUDIO_DRIFT_TOLERANCE) || this->force_audio_jump ) { this->audio_vpts = vpts; this->audio_drift_step = 0; + this->force_audio_jump = 0; printf("metronom: audio jump\n"); } else { diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h index 3b9d8e3da..6b8f26f0a 100644 --- a/src/xine-engine/metronom.h +++ b/src/xine-engine/metronom.h @@ -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.h,v 1.33 2002/06/20 19:48:23 mroi Exp $ + * $Id: metronom.h,v 1.34 2002/06/29 14:32:36 tmattern Exp $ * * metronom: general pts => virtual calculation/assoc * @@ -244,6 +244,7 @@ struct metronom_s { pthread_cond_t cancel; int allow_full_ao_fill_gap; + int force_audio_jump; }; metronom_t *metronom_init (int have_audio, void *xine); |