[MPlayer-cvslog] r36436 - trunk/libmpcodecs/ad_libmad.c

reimar subversion at mplayerhq.hu
Fri Aug 30 21:41:38 CEST 2013


Author: reimar
Date: Fri Aug 30 21:41:38 2013
New Revision: 36436

Log:
libmad: try decoding buffered data after EOF.

Fixes bugzilla #2152.

Modified:
   trunk/libmpcodecs/ad_libmad.c

Modified: trunk/libmpcodecs/ad_libmad.c
==============================================================================
--- trunk/libmpcodecs/ad_libmad.c	Fri Aug 30 21:41:37 2013	(r36435)
+++ trunk/libmpcodecs/ad_libmad.c	Fri Aug 30 21:41:38 2013	(r36436)
@@ -67,11 +67,7 @@ static int preinit(sh_audio_t *sh){
 
 static int read_frame(sh_audio_t *sh){
   mad_decoder_t *this = sh->context;
-  int len;
 
-while((len=demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len],
-          sh->a_in_buffer_size-sh->a_in_buffer_len))>0){
-  sh->a_in_buffer_len+=len;
   while(1){
     int ret;
     mad_stream_buffer (&this->stream, sh->a_in_buffer, sh->a_in_buffer_len);
@@ -84,8 +80,12 @@ while((len=demux_read_data(sh->ds,&sh->a
     }
     if (ret == 0) return 1; // OK!!!
     // error! try to resync!
-    if(this->stream.error==MAD_ERROR_BUFLEN) break;
-  }
+    if(this->stream.error==MAD_ERROR_BUFLEN) {
+        int len=demux_read_data(sh->ds,&sh->a_in_buffer[sh->a_in_buffer_len],
+                                sh->a_in_buffer_size-sh->a_in_buffer_len);
+        if (len <= 0) break;
+        sh->a_in_buffer_len+=len;
+    }
 }
 mp_msg(MSGT_DECAUDIO,MSGL_INFO,"Cannot sync MAD frame\n");
 return 0;


More information about the MPlayer-cvslog mailing list