comparison libmpcodecs/ad_faad.c @ 18644:82263a36cfa4

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
author gpoirier
date Thu, 08 Jun 2006 06:56:13 +0000
parents caac2ca98168
children a1807995e2ab
comparison
equal deleted inserted replaced
18643:4d7478ef1713 18644:82263a36cfa4
230 #endif 230 #endif
231 231
232 if(!sh->codecdata_len){ 232 if(!sh->codecdata_len){
233 // raw aac stream: 233 // raw aac stream:
234 do { 234 do {
235 faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer+j, sh->a_in_buffer_len); 235 faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, sh->a_in_buffer, sh->a_in_buffer_len);
236 236
237 /* update buffer index after faacDecDecode */ 237 /* update buffer index after faacDecDecode */
238 if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len) { 238 if(faac_finfo.bytesconsumed >= sh->a_in_buffer_len) {
239 sh->a_in_buffer_len=0; 239 sh->a_in_buffer_len=0;
240 } else { 240 } else {
243 } 243 }
244 244
245 if(faac_finfo.error > 0) { 245 if(faac_finfo.error > 0) {
246 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: error: %s, trying to resync!\n", 246 mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: error: %s, trying to resync!\n",
247 faacDecGetErrorMessage(faac_finfo.error)); 247 faacDecGetErrorMessage(faac_finfo.error));
248 j++; 248 sh->a_in_buffer_len--;
249 memmove(sh->a_in_buffer,&sh->a_in_buffer[1],sh->a_in_buffer_len);
250 aac_sync(sh);
249 errors++; 251 errors++;
250 } else 252 } else
251 break; 253 break;
252 } while(j < FAAD_BUFFLEN && errors < MAX_FAAD_ERRORS); 254 } while(errors < MAX_FAAD_ERRORS);
253 } else { 255 } else {
254 // packetized (.mp4) aac stream: 256 // packetized (.mp4) aac stream:
255 unsigned char* bufptr=NULL; 257 unsigned char* bufptr=NULL;
256 double pts; 258 double pts;
257 int buflen=ds_get_packet_pts(sh->ds, &bufptr, &pts); 259 int buflen=ds_get_packet_pts(sh->ds, &bufptr, &pts);