Skip to content

ICE renomination compatibility with libwebrtc #881

@martinxsliu

Description

@martinxsliu

Hi team, thanks for the fantastic project!

I am trying to get the new ICE renomination feature working with an iOS webrtc client that use libwebrtc, but it seems like there are some minor protocol differences between the two. I'm wondering if there are plans to make Pion compatible with libwebrtc, either automatically or through configuration options.

Based on my reading of the code, if libwebrtc is controlling, then it either sets the USE_CANDIDATE attribute or the NOMINATION attribute, but not both: https://webrtc.googlesource.com/src/+/refs/heads/main/p2p/base/connection.cc#1157. However, Pion always expects the USE_CANDIDATE attribute even with renomination: https://github.com/pion/ice/blob/master/selection.go#L419.

Further, libwebrtc also uses a different value for the NOMINATION attribute: 0xC001: https://webrtc.googlesource.com/src/+/refs/heads/main/api/transport/stun.h#712 than the default 0x0030 use by Pion.

If I were to enable renomination in Pion and do nothing else, then no candidates would ever be selected and the connection hangs. If I were to modify Pion's ICE agent to match libwebrtc's behaviour by (1) setting ice.WithNominationAttribute(0xC001), and (2) changing selection.go#L419 above to if message.Contains(stun.AttrUseCandidate) || message.Contains(s.agent.nominationAttribute) { ... }, then the pair selection goes through. I haven't extensively tested this though. I also haven't tried the case where Pion is controlling.

I'm not familiar with what the standard is, and it could be the case that libwebrtc is out of spec given it's age. Either way, it would be nice if libwebrtc and Pion could interop here. WithNominationAttribute addresses one issue, but there is no workaround for the nomination attribute issue. Would it be possible to add this check in, or an option to do so?

Thanks again for all the hard work!

Your environment.

  • Version: v4.2.0
  • Browser: iOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions