[MPlayer-dev-eng] Too big buffer in "libmpcodecs/ad_pcm.c"?

Branimir Amidžić mail at ambra.rs.ba
Wed Aug 9 19:00:18 CEST 2006


Reimar Doeffinger wrote:
> On Wed, Aug 09, 2006 at 11:32:13AM +0200, Branimir Amidzic wrote:
>   
>> For example minimum possible: len = ((minlen + len) / len) * len.
>>     
> But this is not safe, since then len can be > maxlen.
> But as you said you problem is that maxlen is too large, so why not fix
> that instead?
>
>   

Well, I'm not very skilled programmer, but I modified
libmpcodecs/dec_audio.c like this:

Lines 80-
  sh_audio->a_buffer_size=sh_audio->audio_out_minsize+MAX_OUTBURST; /*
worst case calc.*/
  if (sh_audio->ds->demuxer->desc->type == DEMUXER_TYPE_TV)
    sh_audio->a_buffer_size=sh_audio->audio_out_minsize * 2;

  if (sh_audio->ds->demuxer->desc->type == DEMUXER_TYPE_TV)
    mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_AllocatingBytesForOutputBuffer,
     
sh_audio->audio_out_minsize,sh_audio->audio_out_minsize,sh_audio->a_buffer_size);
  else
    mp_msg(MSGT_DECAUDIO,MSGL_V,MSGTR_AllocatingBytesForOutputBuffer,
      sh_audio->audio_out_minsize,MAX_OUTBURST,sh_audio->a_buffer_size);

Instead of using (audio_out_minsize+MAX_OUTBURST) I use
(2*audio_out_minsize) for a_buffer_size, only when I'm grabbing from TV
card.

It seems to work fine. I hope I didn't mess things up.




More information about the MPlayer-dev-eng mailing list