Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions rtptransceiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,24 @@

// match codecs from remote description, used when remote is offerer and creating a transceiver
// from remote description with the aim of keeping order of codecs in remote description.
func (t *RTPTransceiver) setCodecPreferencesFromRemoteDescription(media *sdp.MediaDescription) { //nolint:cyclop

Check failure on line 98 in rtptransceiver.go

View workflow job for this annotation

GitHub Actions / lint / Go

cognitive complexity 40 of func `(*RTPTransceiver).setCodecPreferencesFromRemoteDescription` is high (> 30) (gocognit)
remoteCodecs, err := codecsFromMediaDescription(media)
if err != nil {
return
}

simulcast := false
if len(getRids(media)) > 0 {
extensions, err := rtpExtensionsFromMediaDescription(media)
if err == nil {
for extension := range extensions {
if extension == sdp.SDESRepairRTPStreamIDURI {
simulcast = true
}
}
}
}

// make a copy as this slice is modified
leftCodecs := append([]RTPCodecParameters{}, t.api.mediaEngine.getCodecsByKind(t.kind)...)

Expand Down Expand Up @@ -172,6 +184,10 @@
continue
}

if simulcast {
continue
}

for _, rtxCodec := range leftCodecs {
if rtxCodec.PayloadType == mediaEngineRTX {
filteredCodecs = append(filteredCodecs, rtxCodec)
Expand Down
Loading