[MPlayer-cvslog] CVS: main/libmpcodecs ad_faad.c,1.21,1.22
Attila Kinali CVS
syncmail at mplayerhq.hu
Thu Sep 1 17:59:59 CEST 2005
CVS change done by Attila Kinali CVS
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv26747
Modified Files:
ad_faad.c
Log Message:
* 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
Index: ad_faad.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_faad.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ad_faad.c 1 Sep 2005 15:25:03 -0000 1.21
+++ ad_faad.c 1 Sep 2005 15:59:55 -0000 1.22
@@ -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);
}
}
More information about the MPlayer-cvslog
mailing list