Skip non-media codecs in webrtc module
This commit is contained in:
@@ -47,6 +47,9 @@ func UnmarshalMedias(descriptions []*sdp.MediaDescription) (medias []*core.Media
|
||||
continue
|
||||
}
|
||||
|
||||
// skip non-media codecs to avoid confusing users in info and logs
|
||||
media.Codecs = SkipNonMediaCodecs(media.Codecs)
|
||||
|
||||
medias = append(medias, media)
|
||||
}
|
||||
}
|
||||
@@ -54,6 +57,21 @@ func UnmarshalMedias(descriptions []*sdp.MediaDescription) (medias []*core.Media
|
||||
return
|
||||
}
|
||||
|
||||
func SkipNonMediaCodecs(input []*core.Codec) (output []*core.Codec) {
|
||||
for _, codec := range input {
|
||||
switch codec.Name {
|
||||
case "RTX", "RED", "ULPFEC", "FLEXFEC-03":
|
||||
continue
|
||||
case "CN", "TELEPHONE-EVENT":
|
||||
continue // https://datatracker.ietf.org/doc/html/rfc7874
|
||||
}
|
||||
// VP8, VP9, H264, H265, AV1
|
||||
// OPUS, G722, PCMU, PCMA
|
||||
output = append(output, codec)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// WithResampling - will add for consumer: PCMA/0, PCMU/0, PCM/0, PCML/0
|
||||
// so it can add resampling for PCMA/PCMU and repack for PCM/PCML
|
||||
func WithResampling(medias []*core.Media) []*core.Media {
|
||||
|
||||
Reference in New Issue
Block a user