Skip to content
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

Fix ftmp matching for all codecs #1912

Closed
jech opened this issue Aug 5, 2021 · 3 comments
Closed

Fix ftmp matching for all codecs #1912

jech opened this issue Aug 5, 2021 · 3 comments
Milestone

Comments

@jech
Copy link
Member

jech commented Aug 5, 2021

Pion used to match m lines in SDP by doing a simple comparison of the fmtp lines. This does not work in general, as some fmtp parameters are symmetric (they must have the same value on both sides for the m lines to match) and others are declarative (they only give additional information about what the announcing peer is able to send or receive). It might also be the case that some symmetric parameters can be omitted, indicating that the announcer will accept whatever value the other side finds convenient (not sure, the RFCs are unclear on this subject).

Here's the situation, as far as I can tell from a quick browse of the relevant documents:

@Sean-Der Sean-Der added this to the 4.0.0 milestone Aug 28, 2021
@Sean-Der Sean-Der removed this from the 4.0.0 milestone May 22, 2022
@aler9
Copy link
Member

aler9 commented Jun 10, 2024

The situation is the following:

Symmetric parameters now play a role in matching codecs between senders and receivers, in particular:

The only thing that remains is that the library does not prevent matching incompatible codecs, since there's a fallback matching algorithm that takes into consideration the mime type only:

webrtc/rtpcodec.go

Lines 112 to 117 in 2d529be

// Fallback to just MimeType
for _, c := range haystack {
if strings.EqualFold(c.RTPCodecCapability.MimeType, needle.RTPCodecCapability.MimeType) {
return c, codecMatchPartial
}
}

@Sean-Der Sean-Der added this to the V4.1.0 milestone Feb 13, 2025
@Sean-Der
Copy link
Member

The final issue was fixed with #3021 (correct me if I'm wrong @aler9!

If you define codecs with explicit values (ClockRate etc...) the matching will be explicit now. The fallback behavior still happens if the values are empty.

@aler9
Copy link
Member

aler9 commented Feb 16, 2025

@Sean-Der this issue was a little bit too generic since it refers to "all codecs", present and future 🤣, let's just say that given all information that we have available right now on the codecs explicitly mentioned in the first post (VP8, VP9, H264, Opus), format matching should work properly.

In the future, in case of additional codecs that might require additional matching logic we can open a dedicate issue or even better a PR. What i'm thinking about is:

  • H265 surely requires a profile id-based matching
  • H266 / VVC might require a profile level-based matching

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

3 participants