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.