# HG changeset patch # User arpi # Date 1043880307 0 # Node ID f49a2bf042292a20ba0c39d51c7b7cab568ab9d7 # Parent 3081f6796183f37f184693d8c64b17035560bc94 - fixed the input buffering (don't read input unless we're already processed all decoded samples) - fix 100l bug: uninitialized ogg_packet structure caused tremor to hang diff -r 3081f6796183 -r f49a2bf04229 libmpcodecs/ad_libvorbis.c --- a/libmpcodecs/ad_libvorbis.c Wed Jan 29 22:37:39 2003 +0000 +++ b/libmpcodecs/ad_libvorbis.c Wed Jan 29 22:45:07 2003 +0000 @@ -188,22 +188,24 @@ int samples; float **pcm; float scale; - ogg_packet op; 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){ + ogg_packet op; + memset(&op,0,sizeof(op)); //op.b_o_s = op.e_o_s = 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=(samplesvd.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? }