rtpgst: Transmit the duration for buffers on sparse streams

With ordinary RTP streams, the buffer duration is implicitly defined by the clock-rate of the stream. However, with sparse streams, we are not sending packets continuously, so the duration is unknown.

This can still be fine in some cases, but data such as subtitles are unusable without the buffer duration because they will just flash on the screen for a few frames in that case.

In the outside world, sparse RTP streams such as TTML store the timing information inside the payload itself. However, that is not an option for us due to how the rtpgst payloader works: the payload in the case of buffers is the raw buffer data; no metadata.

The simplest solution is to use an RTP header extension to store the 64-bit duration. This feature is automatically activated when a sparse stream is detected, but can be disabled unconditionally by setting the "duration-extension-id" property to 0.

On the receiver side, we simply check if the extension bit is set, and then parse the duration using the extension ID set with the property "duration-extension-id". Of course, by default no configuration is needed.

Edited by Nirbheek Chauhan

Merge request reports