CVS Commit: vlc

Jean-Paul Saman saman at
Wed May 1 19:30:13 CEST 2002

Laurent Aimar wrote:
> On Wed, May 01, 2002, Jean-Paul Saman wrote:
>>In the mad_libmad.c code there are two downscale algorithmes. One of 
>>them is adaptive on dither errors and masks rough edge from the sound. 
>>You could try to use this function instead of the default *faster* 
>>In fact it is an algorithme borrowed from mpg321
>>//#define MPG321_ROUTINES     1
>>uncomment it and try again. Check the value of AOUT_BUFFER_DURATION it 
>>may also influence your result.
>   I've tried but it make no amelioration at all.
OK, I'll try to fix it. I am the maintainer of the mad plugin, but do 
*need* a mpeg sample to reproduce it.

I asume you use latest cvs version?

>  I'v searched and (thanks to added intf_Msg ...) i'v found that with
> the mpeg audio streams that are awfull, mad function don't return
> ADEC_FRAME_SIZE(2*1152) but half of it.
I have seen this one before, but that was related to not copying data 
that was in the input buffer. Mad consumes only enough data to fill a 
number of frames and leaves the rest in the input buffer. This is long 
solved now in the code (libmad_input function).

>  So when, libmad_output received these data, it fill a buffer of
> ADEC_FRAME_SIZE long with half of real data and then switch to the next
> data buffer by increase p_mad_adec->p_aout_fifo->i_end_frame .But then
> half of this buffer is not used and let blank.

I do update samplerate in that part of the code (libmad_output 
function), see below.

if (p_mad_adec->p_aout_fifo->i_rate != p_libmad_pcm->samplerate)
	intf_ErrMsg( "mad_adec: libmad_output samplerate is changing from [%d] Hz 
to [%d] Hz, sample size [%d], error_code [%0x]",
p_mad_adec->p_aout_fifo->i_rate = p_libmad_pcm->samplerate;

Have you tried uncommenting it? Like...
// 	p_mad_adec->p_aout_fifo->i_rate = p_libmad_pcm->samplerate;

And did it help.

>  I think the way to solve it is to keep the number of samples that are
> out, and so switch to next data buffer only when is really needed . Or
> find a way to known what sort of stream make mad to not output the good
> size, and create fifo with good size.

Please, send a pointer to a sample file and I'll get on to fixing this.

Kind greetings,

Jean-Paul Saman

Software Architect

e-mail (work): saman at
phone  (work): 040 27 42909
Ordina TA,
Science Park Eindhoven 5602, Postbus 293, 5600 AG Eindhoven
e-mail : jean-paul.saman at
phone  : 040 2601200
fax    : 040 2601199

This is the vlc-devel mailing-list, see
To unsubscribe, please read
If you are in trouble, please contact <postmaster at>

More information about the vlc-devel mailing list