[FFmpeg-devel] [ffmpeg-devel] [PATCH 3/4] lavfi: add audio convert filter

Mina Nagy Zaki mnzaki at gmail.com
Wed Aug 3 12:29:46 CEST 2011


On Tue, Aug 02, 2011 at 04:09:26PM +0200, Stefano Sabatini wrote:
> On date Monday 2011-08-01 11:52:21 +0300, Mina Nagy Zaki encoded:
[...]

> 
> > +        aconvert->audioconvert_ctx =
> > +                av_audio_convert_alloc(outlink->format, out_channels,
> > +                                       inlink->format,  out_channels, NULL, 0);
> 
> missing check, also you may avoid to free+reinitialize this each
> time. Can you set this during the configuration phase? (also it may
> fail in case the conversion is not supported, and the filter should
> fail as soon as possible).

It only gets initialized exactly twice under normal circumstances. I was
considering adding a little workaround to avoid the second initialization, but
dropped it. 

Also it's convenient to alloc it during init_buffers because that's when I have
all the info on whether or not I'll actually need an audio_convert context. And
this, I have to admit, is due to all the premature optimizations and shortcuts I
implemented / tried to implement.... gets me every time.



More information about the ffmpeg-devel mailing list