[MPlayer-cvslog] CVS: main mplayer.c,1.860,1.861

Reimar Döffinger CVS syncmail at mplayerhq.hu
Tue Aug 23 09:56:32 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv3289

Modified Files:
	mplayer.c 
Log Message:
ensure that audio-only files are decoded till the end by not only
waiting for eof but also checking that the a_in_buffer is empty.


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.860
retrieving revision 1.861
diff -u -r1.860 -r1.861
--- mplayer.c	15 Aug 2005 08:30:42 -0000	1.860
+++ mplayer.c	23 Aug 2005 07:56:29 -0000	1.861
@@ -2286,10 +2286,15 @@
   // Fill buffer if needed:
   current_module="decode_audio";   // Enter AUDIO decoder module
   t=GetTimer();
-  while(sh_audio->a_out_buffer_len<playsize && !d_audio->eof){
+  while(sh_audio->a_out_buffer_len<playsize &&
+        (!d_audio->eof || sh_audio->a_in_buffer_len > 0)){
     int ret=decode_audio(sh_audio,&sh_audio->a_out_buffer[sh_audio->a_out_buffer_len],
         playsize-sh_audio->a_out_buffer_len,sh_audio->a_out_buffer_size-sh_audio->a_out_buffer_len);
-    if(ret<=0) break; // EOF?
+    if(ret<=0) { // EOF?
+      if (d_audio->eof)
+        sh_audio->a_in_buffer_len = 0; // make sure we don't hang if something's broken
+      break;
+    }
     sh_audio->a_out_buffer_len+=ret;
   }
   t=GetTimer()-t;
@@ -2316,7 +2321,7 @@
     float a_pos = sh_audio->delay - audio_out->get_delay() * playback_speed;
     print_status(a_pos, 0, 0);
   }
-  if(d_audio->eof) eof = PT_NEXT_ENTRY;
+  if(d_audio->eof && sh_audio->a_in_buffer_len <= 0) eof = PT_NEXT_ENTRY;
 
 } else {
 




More information about the MPlayer-cvslog mailing list