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

Jonathan Baudanza jon at jonb.org
Mon Jan 4 00:06:00 EET 2021


On Sun, Jan 3, 2021, at 12:50 PM, Andreas Rheinhardt wrote:
> 
> 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).
> 

Thanks Andreas!

The patch now uses ff_alloc_extradata, and I moved the bitstream writer into its own function so it can create the bs variable on the stack.

I wasn't sure of the best way to error out, since ff_rtp_parse_open doesn't return an error value. So I log the error and return NULL. Please advise if there is a better way.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ff_rtp_parse_open-builds-Opus-head-in-extradata.patch
Type: application/octet-stream
Size: 2644 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210103/95aa0750/attachment.obj>


More information about the ffmpeg-devel mailing list