[FFmpeg-devel] [PATCH] id3v2 unsynchronisation support
Reimar Döffinger
Reimar.Doeffinger
Wed Aug 11 17:21:29 CEST 2010
On Wed, Aug 11, 2010 at 11:14:08AM +1000, Alexander Kojevnikov wrote:
> On 10 August 2010 23:55, Reimar D?ffinger <Reimar.Doeffinger at gmx.de> wrote:
> > On Tue, Aug 10, 2010 at 09:45:53PM +1000, Alexander Kojevnikov wrote:
> >> > why the if() ?
> >>
> >> You mean the last `if`? Because we don't know how realloc is
> >> implemented on each platform, it can potentially be slow, even if the
> >> new size is less than the new one. I think it makes sense to reduce
> >> the number of library calls anyway, and it's not hard in this
> >> particular case.
> >
> > If performance matters, use the av_realloc variants that take a size
> > argument and avoid extra work.
> > If performance does not matter, use the simplest way.
> > Your solution uses the "middle" way that solves neither problem
> > and thus seems rather senseless.
>
> I wasn't aware of av_fast_realloc, thanks for the tip!
Do you actually want av_fast_realloc (which needs to preserve
the buffer contents, and makes handling allocation errors difficult,
which btw. you don't do at all) or would av_fast_malloc be more
appropriate?
More information about the ffmpeg-devel
mailing list