fixes the infinite loop which occurs when there is a decode error in a frame.

Patch by Bryan Alton < balton AH eircom POIS net >
Original thread:
Date: Jun 6, 2006 10:52 AM
Subject: [MPlayer-dev-eng] [PATCH] fix for faad2 infinite loop after 
decoding error


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18645 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
gpoirier 2006-06-08 06:56:13 +00:00
parent f9f07300ff
commit 92ae184367
1 changed files with 5 additions and 3 deletions

View File

@ -232,7 +232,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
if(!sh->codecdata_len){
// raw aac stream:
do {
faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer+j, sh->a_in_buffer_len);
faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer, sh->a_in_buffer_len);
/* update buffer index after faacDecDecode */
if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len) {
@ -245,11 +245,13 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
if(faac_finfo.error > 0) {
mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: error: %s, trying to resync!\n",
faacDecGetErrorMessage(faac_finfo.error));
j++;
sh->a_in_buffer_len--;
memmove(sh->a_in_buffer,&sh->a_in_buffer[1],sh->a_in_buffer_len);
aac_sync(sh);
errors++;
} else
break;
} while(j < FAAD_BUFFLEN && errors < MAX_FAAD_ERRORS);
} while(errors < MAX_FAAD_ERRORS);
} else {
// packetized (.mp4) aac stream:
unsigned char* bufptr=NULL;