Skip to content

rtpbasepayload: implement find-available-extension-id action

This MR introduces an action called find-available-extension-id to RTPBasePayload class.

The main use case is the following: in case an application configures its own RTP extensions with webrtc{sink,src}, it needs to be careful with assigning IDs to its additional extensions not to conflict with the extensions that webrtc* elements already add internally.

For now they may only add TWCC extension, but I imagine they may be others, potentially.

One solution that an application may take is to have some constant offset, from which it starts IDs for its own extensions, but it becomes a question of what the value of the offset should be, and overall it does not seem complete. Furthermore, extensions IDs are not necessarily consecutive or ordered in any specific way.

The solution that this MR proposes is an additional action, which an application can call on a payloader, and which returns the smallest unassigned ID. This eliminates the possibility of ID clashes, since the ID returned will be unique.

Additional notes:

  • it may also makes sense to automatically assign an available ID inside add-extension, if no specific ID was already assigned. This, however, will change the previous behavior of the element, so we may introduce a property to toggle this auto-assignment on and off, and which be off by default, to remain compatible with the previous versions

Merge request reports