[MPlayer-dev-eng] [PATCH] tremor: some workaround for something

Arpi arpi at thot.banki.hu
Tue Jan 28 20:35:54 CET 2003


Hi,

> I don't know whether it is a workaround for an mplayer or tremor bug, but
> without this if you use tremor to decode ogg, and you change 
> samplerate/channelnumber/bps with libaf, than it get's in an endless loop
> and won't do anything.

Strange. Btw i looke dat the ad_libvorbis.c loop, and it looks seriously
broken. It's a miracle if it works :)

Could you (and others) try this patch, with trenor and original libvorbis?
(i couldn't etst it, i don't have ogm files by hand)

Index: ad_libvorbis.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_libvorbis.c,v
retrieving revision 1.12
diff -u -r1.12 ad_libvorbis.c
--- ad_libvorbis.c	13 Jan 2003 19:38:52 -0000	1.12
+++ ad_libvorbis.c	28 Jan 2003 19:33:20 -0000
@@ -192,18 +192,20 @@
         struct ov_struct_st *ov = sh->context;
         op.b_o_s =  op.e_o_s = 0;
 	while(len < minlen) {
-	  op.bytes = ds_get_packet(sh->ds,&op.packet);
-	  if(!op.packet)
-	    break;
-	  if(vorbis_synthesis(&ov->vb,&op)==0) /* test for success! */
-	    vorbis_synthesis_blockin(&ov->vd,&ov->vb);
-	  while((samples=vorbis_synthesis_pcmout(&ov->vd,&pcm))>0){
+	  while((samples=vorbis_synthesis_pcmout(&ov->vd,&pcm))<=0){
+	    op.bytes = ds_get_packet(sh->ds,&op.packet);
+	    if(op.bytes<=0) break;
+	    if(vorbis_synthesis(&ov->vb,&op)==0) /* test for success! */
+	      vorbis_synthesis_blockin(&ov->vd,&ov->vb);
+	  }
+	  if(samples<=0) break; // error/EOF
+	  while(samples>0){
 	    int i,j;
 	    int clipflag=0;
 	    int convsize=(maxlen-len)/(2*ov->vi.channels); // max size!
-	    int bout=(samples<convsize?samples:convsize);
+	    int bout=((samples<convsize)?samples:convsize);
 	  
-	    if(bout<=0) break;
+	    if(bout<=0) break; // no buffer space
 
 	    /* convert floats to 16 bit signed ints (host order) and
 	       interleave */
@@ -265,10 +267,12 @@
 	      mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"Clipping in frame %ld\n",(long)(ov->vd.sequence));
 	    len+=2*ov->vi.channels*bout;
 	    mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\n[decoded: %d / %d ]\n",bout,samples);
+	    samples-=bout;
 	    vorbis_synthesis_read(&ov->vd,bout); /* tell libvorbis how
 						    many samples we
 						    actually consumed */
-	  }
+	  } //while(samples>0)
+//          if (!samples) break; // why? how?
 	}
 
 

A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu
    "However, many people beg for its inclusion in Debian. Why?" - Gabucino
  "Because having new software in Debian is good." - Josselin Mouette
"Because having good software in Debian is new." - Gabucino


More information about the MPlayer-dev-eng mailing list