1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-20 22:02:59 +00:00

always reser audio input buffer pointer

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6050 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-05-12 00:44:32 +00:00
parent 662a79ffb0
commit afefdc4305
3 changed files with 3 additions and 6 deletions

View File

@ -160,7 +160,6 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...){
// various optional functions you MAY implement: // various optional functions you MAY implement:
switch(cmd){ switch(cmd){
case ADCTRL_RESYNC_STREAM: case ADCTRL_RESYNC_STREAM:
sh->a_in_buffer_len=0; // clear audio input buffer
this->have_frame=0; this->have_frame=0;
mad_synth_init (&this->synth); mad_synth_init (&this->synth);
mad_stream_init (&this->stream); mad_stream_init (&this->stream);

View File

@ -113,8 +113,7 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...){
switch(cmd){ switch(cmd){
case ADCTRL_RESYNC_STREAM: case ADCTRL_RESYNC_STREAM:
// it is called once after seeking, to resync. // it is called once after seeking, to resync.
// if you don't return CONTROL_TRUE, it will defaults to: // Note: sh_audio->a_in_buffer_len=0; is done _before_ this call!
// sh_audio->a_in_buffer_len=0; // clear input buffer
... ...
return CONTROL_TRUE; return CONTROL_TRUE;
case ADCTRL_SKIP_FRAME: case ADCTRL_SKIP_FRAME:

View File

@ -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) 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 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) void skip_audio_frame(sh_audio_t *sh_audio)