Skip to content

Score a path through TURN as a relay pair - #1034

Open
SashaMIT wants to merge 1 commit into
pion:mainfrom
SashaMIT:fix/relay-pair-score
Open

SashaMIT wants to merge 1 commit into
pion:mainfrom
SashaMIT:fix/relay-pair-score

Conversation

@SashaMIT

Copy link
Copy Markdown

Summary

A host candidate paired with a remote relay was scored as the average of host and relay. That average is 55, so the TURN path outranked a server-reflexive pair at 50 even when the direct pair had the lower round trip time. Automatic renomination kept selecting the relay.

A path that uses a relay candidate now scores as relay. A succeeded path that does not use TURN outranks every relayed pair, and renomination will leave the relay for that path. Two candidates that are both direct still rank by their type average and round trip time. A relay is not selected in place of a path that is already direct.

TestDirectPairBeatsPairWithRelayOnOneSide failed before this change: the direct score 53.98 was not greater than the relayed score 57.52, and the best pair was the relay. With the change, the direct pair scores higher and is selected. TestCandidatePairQualityTypeScores and the existing renomination cases passed. golangci-lint run --new reported 0 issues.

The controlling agent already has both pairs in the succeeded state. The score was keeping media on TURN after a direct path was up.

Fixes #1033

Test plan

  • Host paired with a remote relay loses to a server-reflexive pair with a lower round trip time
  • Existing type-score matrix and relay-to-host renomination cases

A host candidate paired with a remote relay was averaged with the host score, so it outranked a server-reflexive pair that never uses TURN. Automatic renomination stayed on the relay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Automatic renomination never moves from a relay pair to a srflx↔srflx pair: the pair score averages the two candidate types

1 participant