[MPlayer-cvslog] r18645 - trunk/libmpcodecs/ad_faad.c

gpoirier subversion at mplayerhq.hu
Thu Jun 8 08:56:13 CEST 2006


Author: gpoirier
Date: Thu Jun  8 08:56:13 2006
New Revision: 18645

Modified:
   trunk/libmpcodecs/ad_faad.c

Log:
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


Modified: trunk/libmpcodecs/ad_faad.c
==============================================================================
--- trunk/libmpcodecs/ad_faad.c	(original)
+++ trunk/libmpcodecs/ad_faad.c	Thu Jun  8 08:56:13 2006
@@ -232,7 +232,7 @@
   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 @@
     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;



More information about the MPlayer-cvslog mailing list