diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c index 223c43f974..083a0942ad 100644 --- a/libmpcodecs/ad_libmad.c +++ b/libmpcodecs/ad_libmad.c @@ -160,7 +160,6 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...){ // various optional functions you MAY implement: switch(cmd){ case ADCTRL_RESYNC_STREAM: - sh->a_in_buffer_len=0; // clear audio input buffer this->have_frame=0; mad_synth_init (&this->synth); mad_stream_init (&this->stream); diff --git a/libmpcodecs/ad_sample.c b/libmpcodecs/ad_sample.c index f20fbcbb92..56d5a46dea 100644 --- a/libmpcodecs/ad_sample.c +++ b/libmpcodecs/ad_sample.c @@ -113,8 +113,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...){ switch(cmd){ case ADCTRL_RESYNC_STREAM: // it is called once after seeking, to resync. - // if you don't return CONTROL_TRUE, it will defaults to: - // sh_audio->a_in_buffer_len=0; // clear input buffer + // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call! ... return CONTROL_TRUE; case ADCTRL_SKIP_FRAME: diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c index 459a5b8c60..333c4d6c15 100644 --- a/libmpcodecs/dec_audio.c +++ b/libmpcodecs/dec_audio.c @@ -134,10 +134,9 @@ int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) void resync_audio_stream(sh_audio_t *sh_audio) { - if(!sh_audio->inited) return; - if(mpadec->control(sh_audio,ADCTRL_RESYNC_STREAM,NULL)==CONTROL_TRUE) return; - // default resync code: sh_audio->a_in_buffer_len=0; // clear audio input buffer + if(!sh_audio->inited) return; + mpadec->control(sh_audio,ADCTRL_RESYNC_STREAM,NULL); } void skip_audio_frame(sh_audio_t *sh_audio)