Add custom rtp header extension without a custom plugin

I need to add custom 4 bytes extension to the end of the rtp header and i do not see a way to do this from the documentation. These bytes need to change based on the payload. The best solution i can think of to accomplish this is put a probe on the output of my rtpsession and copy the header and payload into a new buffer with the extension in between. i was hoping there was a more elegant mechanism like modifying the header in the payloader before data gets packed.

The “elegant” solution requires you to write a small RTPHeaderExtension subclass.

This doesn’t have to be big or complicated, and it doesn’t have to live in a plugin or be installed on the file system as a plugin.