[FFmpeg-devel] Patch to libavc/opus to create extradata if missing
Jonathan Baudanza
jon at jonb.org
Wed Dec 30 20:00:29 EET 2020
On Tue, Dec 29, 2020, at 3:25 PM, Jonathan Baudanza wrote:
> Thank you for all the feedback everyone. I've updated the patch to build the opus header inside of ff_rtp_parse_open in libavformat/rtpdec.c.
>
> I set the mapping_family to 0, since I believe Opus/RTP only supports 2 channels. I set the input sample rate to 0, which the spec considers "unspecified". Let me know what you think of this approach for these values. Happy to switch them to 255/48000 if you prefer.
>
> I copied the bytestream code from opusenc.c. There's now 3 or 4 different places in the codebase where opus headers are getting built. Let me know if you'd like me to refactor this a bit. I didn't want to touch too many components with my first patch.
>
I had a follow-up thought to this. Do you think it makes sense to check st->codecpar->extradata for NULL before assigning it? Some other component may have assigned extradata, although I'm not sure why it would. And in that case we don't want a memory leak.
More information about the ffmpeg-devel
mailing list