[FFmpeg-devel] [PATCH] libavformat/mov: Always use av_realloc() for AVCodecParameters.extradata

Michael Niedermayer michael at niedermayer.cc
Sat Aug 26 12:43:26 EEST 2017


On Fri, Aug 25, 2017 at 11:25:11AM -0700, John Rummell wrote:
> Chromium uses tcmalloc which doesn't like mixing calls to posix_memalign()
> and realloc(). This change updates mov.c to only use av_realloc() when
> allocating memory for AVCodecParameters.extradata.
> ---
>  libavformat/mov.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)

I dont think this is a practical solution.
having av_malloc and av_realloc incompatible is not a path that is
maintainable. No matter how hard people want that.

The fix to this is to make av_malloc() and av_realloc() compatible.

Does tcmalloc() provide sufficient alignment ? if so there is no
need for posix_memalign().
If not thats a shortcomming of tcmalloc() and something that especially
for a performance oriented malloc would seem out of place.

Fixing tcmalloc() so it can interoperate with posix_memalign(), for
example by also overriding posix_memalign() or whatever would also be
an option

but the code removed in
3835283293bfd38ba69203f4618f0f0f21377bcc
also would be a fix for this

again, i dont object to the patch, i just dont think this is practical
maintaince wise.

having av_malloc() and av_realloc* incompatible is a minefield and
something that creates an endless stream of bugs, work and bugfixes.
Making them compatible would lead to much more robust code


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170826/b1445349/attachment.sig>


More information about the ffmpeg-devel mailing list