TypePreference returns the type preference for this candidate.
()
| 427 | |
| 428 | // TypePreference returns the type preference for this candidate. |
| 429 | func (c *candidateBase) TypePreference() uint16 { |
| 430 | pref := c.Type().Preference() |
| 431 | if pref == 0 { |
| 432 | return 0 |
| 433 | } |
| 434 | |
| 435 | if c.NetworkType().IsTCP() { |
| 436 | var tcpPriorityOffset uint16 = defaultTCPPriorityOffset |
| 437 | if c.agent() != nil { |
| 438 | tcpPriorityOffset = c.agent().tcpPriorityOffset |
| 439 | } |
| 440 | |
| 441 | pref -= tcpPriorityOffset |
| 442 | } |
| 443 | |
| 444 | return pref |
| 445 | } |
| 446 | |
| 447 | // Priority computes the priority for this ICE Candidate |
| 448 | // See: https://www.rfc-editor.org/rfc/rfc8445#section-5.1.2.1 |