summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-01 15:59:55 +0000
committerattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-09-01 15:59:55 +0000
commit9315260e76cabc94fc16bc44e44359c6adc4c1db (patch)
tree3be0afdb1d9a08fc7e73ba6a68499caa32575ff6 /libmpcodecs
parent751ec931a72f462bbc9e457417a6609c42e38e9c (diff)
downloadmpv-9315260e76cabc94fc16bc44e44359c6adc4c1db.tar.bz2
mpv-9315260e76cabc94fc16bc44e44359c6adc4c1db.tar.xz
* 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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16338 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_faad.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c
index 909ffa7ed5..d405c1e7ef 100644
--- a/libmpcodecs/ad_faad.c
+++ b/libmpcodecs/ad_faad.c
@@ -206,12 +206,13 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...)
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 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
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 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
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);
}
}