[MPlayer-dev-eng] [PATCH] prevent breaking up of samples between audio plugin calls

Ivan Kalvatchev iive at yahoo.com
Mon Jun 10 16:10:50 CEST 2002


--- Anders Johansson <ajh at atri.curtin.edu.au> wrote:
> Hi Erik,
> 
> > 
> > Hi,
> > When trying out the resample plugin (with 6-channel output), I noticed that
> > the channels move around everytime I resume from pause (for example, the
> > center channel hops between left front, center and left rear).
> > 
> > This is because at that moment, the resample plugin gets a
> > ao_plugin_data.len of 65536. This is not a multiple of 6 * 2, so one sample
> > gets broken up between plugin calls. The resample plugin is not designed to
> > handle that.
> > 
> > Patch below makes sure that all audio plugins always get whole samples.
> > 
> 
> Thank you for the patch. Could you please test this on U8 data before
> we apply (volume plugin supports U8). Perhaps you will get clicks in
> the sound (I am not sure).
> 
> Thanks,
> //Anders
> 
> > Eric
> > 
> > Index: libao2/ao_plugin.c
> > ===================================================================
> > RCS file: /cvsroot/mplayer/main/libao2/ao_plugin.c,v
> > retrieving revision 1.19
> > diff -u -r1.19 ao_plugin.c
> > +++ libao2/ao_plugin.c	9 Jun 2002 22:00:50 -0000
> > @@ -250,6 +250,7 @@
> >    // Limit length to avoid over flow in plugins
> >    int tmp = get_space();
> >    int ret_len =(tmp<len)?tmp:len;
> > +  ret_len -= ret_len % (ao_plugin_local_data.channels * 2);
> >    if(ret_len){
> >      // Filter data
> >      ao_plugin_data.len=ret_len;

This seems to be a general problem will the current plugin system.
The ao_sdl and pl_resample plugin was also the length based.
I think that we have to change the api a little.
We must send packets and to have a size of the packet. This will
fix all sound align problems and will help on processing
compressed audio data.
When i fixed the sdl+resample bug I had added new parameter (maybe bpm)
in ao_plugin to align data. It is time for more general solution.
Lets discuse it in the mail list before coding:}

Best Regards
  Ivan Kalvachev 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the MPlayer-dev-eng mailing list