[FFmpeg-cvslog] r20768 - trunk/ffmpeg.c

Vitor Sessak vitor1001
Tue Dec 8 17:50:34 CET 2009


michael wrote:
> Author: michael
> Date: Tue Dec  8 15:28:28 2009
> New Revision: 20768
> 
> Log:
> Try to allocate audio buffer sizes depending on the number of input bytes.
> Fixes issue1167.
> 
> Modified:
>    trunk/ffmpeg.c
> 
> Modified: trunk/ffmpeg.c
> ==============================================================================
> --- trunk/ffmpeg.c	Tue Dec  8 15:18:15 2009	(r20767)
> +++ trunk/ffmpeg.c	Tue Dec  8 15:28:28 2009	(r20768)
> @@ -555,17 +555,33 @@ static void do_audio_out(AVFormatContext
>                           unsigned char *buf, int size)
>  {
>      uint8_t *buftmp;
> -    const int audio_out_size= 4*MAX_AUDIO_PACKET_SIZE;
> +    int64_t audio_out_size, audio_buf_size;
>  
>      int size_out, frame_bytes, ret;
>      AVCodecContext *enc= ost->st->codec;
>      AVCodecContext *dec= ist->st->codec;
>      int osize= av_get_bits_per_sample_format(enc->sample_fmt)/8;
>      int isize= av_get_bits_per_sample_format(dec->sample_fmt)/8;
> +    const int coded_bps = av_get_bits_per_sample(enc->codec->id);
> +
> +    audio_buf_size= (size + isize*dec->channels - 1) / (isize*dec->channels);
> +    audio_buf_size= (audio_buf_size*enc->sample_rate + dec->sample_rate) / dec->sample_rate;
> +    audio_buf_size= audio_buf_size*2 + 10000; //saftey factors for the deprecated resampling API
                                                      ^^^
saFETy

-Vitor



More information about the ffmpeg-cvslog mailing list