[FFmpeg-devel] Patch to libavc/opus to create extradata if missing

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sun Jan 3 22:50:10 EET 2021


Jonathan Baudanza:
> On Wed, Dec 30, 2020, at 10:34 AM, James Almer wrote:
> 
>> Nothing should have done it at that point. The demuxer allocates the 
>> AVStream after all. But to be sure you can do 
>> av_freep(&st->codecpar->extradata) to ensure it's NULL before anything 
>> else is done.
> 
> Thanks James.
> 
> I've updated the patch to include av_freep. If there's no other feedback, I think this is ready to go.
> 

It would be better if you used ff_alloc_extradata(): It also already
frees the extradata that might be present. And it does only set the
extradata_size after the allocation succeeded. But it is of course even
better if you actually errored out in case of allocation failure.

Furthermore, your patch will lead to "declaration after statement" (or
something like that) warnings, because FFmpeg only allows variable
declarations at the beginning of each block (this is a remnant from C90).

- Andreas


More information about the ffmpeg-devel mailing list