diff options
author | gpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-06-08 06:56:13 +0000 |
---|---|---|
committer | gpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-06-08 06:56:13 +0000 |
commit | 92ae1843675b9763f761635952816d518aa62ae7 (patch) | |
tree | e4aaccc63d99106eca818ce5d9ee8b9a91f07e47 /libmpcodecs/ad_faad.c | |
parent | f9f07300ffa2a7ec35948a7eca51095792e0ea14 (diff) | |
download | mpv-92ae1843675b9763f761635952816d518aa62ae7.tar.bz2 mpv-92ae1843675b9763f761635952816d518aa62ae7.tar.xz |
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
Diffstat (limited to 'libmpcodecs/ad_faad.c')
-rw-r--r-- | libmpcodecs/ad_faad.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c index 80470d4a49..315c4afa20 100644 --- a/libmpcodecs/ad_faad.c +++ b/libmpcodecs/ad_faad.c @@ -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; |