Mercurial > mplayer.hg
changeset 16337:7252d024193b
* really keep track on how many samples were decoded last round (fix 10l)
* leave loop if more than 10 faad errors were detected since the last
call of decode_audio
author | attila |
---|---|
date | Thu, 01 Sep 2005 15:59:55 +0000 |
parents | 6a9283411dfe |
children | cbd034008ee0 |
files | libmpcodecs/ad_faad.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_faad.c Thu Sep 01 15:25:03 2005 +0000 +++ b/libmpcodecs/ad_faad.c Thu Sep 01 15:59:55 2005 +0000 @@ -206,12 +206,13 @@ return CONTROL_UNKNOWN; } +#define MAX_FAAD_ERRORS 10 static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) { - int j = 0, len = 0; + int j = 0, len = 0, last_dec_len = 1, errors = 0; void *faac_sample_buffer; - while(len < minlen && len > 0) { + while(len < minlen && last_dec_len > 0 && errors < MAX_FAAD_ERRORS) { /* update buffer for raw aac streams: */ if(!sh->codecdata_len) @@ -245,9 +246,10 @@ mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: error: %s, trying to resync!\n", faacDecGetErrorMessage(faac_finfo.error)); j++; + errors++; } else break; - } while(j < FAAD_BUFFLEN); + } while(j < FAAD_BUFFLEN && errors < MAX_FAAD_ERRORS); } else { // packetized (.mp4) aac stream: unsigned char* bufptr=NULL; @@ -267,7 +269,8 @@ mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"FAAD: Successfully decoded frame (%d Bytes)!\n", sh->samplesize*faac_finfo.samples); memcpy(buf+len,faac_sample_buffer, sh->samplesize*faac_finfo.samples); - len += sh->samplesize*faac_finfo.samples; + last_dec_len = sh->samplesize*faac_finfo.samples; + len += last_dec_len; //printf("FAAD: buffer: %d bytes consumed: %d \n", k, faac_finfo.bytesconsumed); } }