Skip to content

Handling of header extension with different id on different media section #3087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
itzmanish opened this issue Apr 8, 2025 · 2 comments
Open

Comments

@itzmanish
Copy link
Contributor

A different issue I have noticed, though I am not sure how this works with the spec guideline. The updateHeaderExtensionFromMediaSection is called from the default block of the 2nd switch case as well as at the end of the method https://github.com/pion/webrtc/pull/3018/files#diff-045bc12c2f054653bc94bdbcbdd27f63b14536b7b5b34f451633f14ea1d8c1b0L677.

Now even if we don't consider multi codec enabled scenario, the default case will be hit for all subsequent codecs in offer even the audio/video is negotiated. In that case if the offer have different extensionId for header extensions they will be stored in negotiatedHeaderExtension map which is being used by peerconnection when doing handleIncomingSSRC. This may pick up wrong extension id for the track on the incoming MID.

Questions -

  1. Is it allowed to have a different extension ID for the same extension in different media sections?
  2. Should Pion handle different extension IDs for the same extension for different media sections and correctly use the extension ID for a MID's incoming track?

Copying the comment from #3018 (comment) as this is related to the PR #3018 but can be handled seperately to limit scope of that PR to multicodec support only.

@nils-ohlmeier
Copy link

Without looking up the respective RFC paragraphs: my recollection is that extension IDs need to be same for the same URL across multiple media sections, if these media sections belong to the same bundle group. As Pion (so far) uses bundle only lets avoid getting into the details of non-bundled transport.

So basically a new media section which uses an extension which is already used in another media section needs to use the same extension ID. This ensures that the RTP parser only needs to hold one lookup table per bundled transport, and not per RTP stream/SSRC.

This does NOT mean that every media section needs to negotiate the same extensions. So each media section is free to negotiate a fully overlapping set of extension, a partly overlapping set of extension, or a set of extension with no overlap with the existing media sections at all.

There are grey zones, I believe, when it comes to an extension getting negotiated away and then later getting added back into the bundled transport and other corner cases like that.

@itzmanish
Copy link
Contributor Author

So it's Offerer's responsibility to correctly use extension id for extensions on the media sections. And those IDs should be the same across all the media sections if enabled.

I think in this case, Pion should throw an error during negotiation if it encounters different media sections having the same extensions with different IDs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants