getCodecs returns list of supported codecs.
()
| 70 | |
| 71 | // getCodecs returns list of supported codecs. |
| 72 | func (t *RTPTransceiver) getCodecs() []RTPCodecParameters { |
| 73 | t.mu.RLock() |
| 74 | defer t.mu.RUnlock() |
| 75 | |
| 76 | mediaEngineCodecs := t.api.mediaEngine.getCodecsByKind(t.kind) |
| 77 | if len(t.codecs) == 0 { |
| 78 | return filterUnattachedRTX(mediaEngineCodecs) |
| 79 | } |
| 80 | |
| 81 | filteredCodecs := []RTPCodecParameters{} |
| 82 | for _, codec := range t.codecs { |
| 83 | if c, matchType := codecParametersFuzzySearch(codec, mediaEngineCodecs); matchType != codecMatchNone { |
| 84 | if codec.PayloadType == 0 { |
| 85 | codec.PayloadType = c.PayloadType |
| 86 | } |
| 87 | codec.RTCPFeedback = rtcpFeedbackIntersection(codec.RTCPFeedback, c.RTCPFeedback) |
| 88 | filteredCodecs = append(filteredCodecs, codec) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return filterUnattachedRTX(filteredCodecs) |
| 93 | } |
| 94 | |
| 95 | // match codecs from remote description, used when remote is offerer and creating a transceiver |
| 96 | // from remote description with the aim of keeping order of codecs in remote description. |