Fix OPUS/48000/1 for RTSP from some cameras #1506

This commit is contained in:
Alex X
2024-12-29 11:44:56 +03:00
parent 8ecaabfce9
commit 0d6b8fc6fc
+8 -1
View File
@@ -70,9 +70,16 @@ func UnmarshalSDP(rawSDP []byte) ([]*core.Media, error) {
// Check buggy SDP with fmtp for H264 on another track // Check buggy SDP with fmtp for H264 on another track
// https://github.com/AlexxIT/WebRTC/issues/419 // https://github.com/AlexxIT/WebRTC/issues/419
for _, codec := range media.Codecs { for _, codec := range media.Codecs {
if codec.Name == core.CodecH264 && codec.FmtpLine == "" { switch codec.Name {
case core.CodecH264:
if codec.FmtpLine == "" {
codec.FmtpLine = findFmtpLine(codec.PayloadType, sd.MediaDescriptions) codec.FmtpLine = findFmtpLine(codec.PayloadType, sd.MediaDescriptions)
} }
case core.CodecOpus:
// fix OPUS for some cameras https://datatracker.ietf.org/doc/html/rfc7587
codec.ClockRate = 48000
codec.Channels = 2
}
} }
if media.Direction == "" || forceDirection { if media.Direction == "" || forceDirection {