(newPT uint8)
| 965 | } |
| 966 | |
| 967 | func (b *BufferBase) handleCodecChange(newPT uint8) { |
| 968 | var ( |
| 969 | codecFound, rtxFound bool |
| 970 | rtxPt uint8 |
| 971 | newCodec webrtc.RTPCodecParameters |
| 972 | ) |
| 973 | for _, codec := range b.rtpParameters.Codecs { |
| 974 | if !codecFound && uint8(codec.PayloadType) == newPT { |
| 975 | newCodec = codec |
| 976 | codecFound = true |
| 977 | } |
| 978 | |
| 979 | if mime.IsMimeTypeStringRTX(codec.MimeType) && strings.Contains(codec.SDPFmtpLine, fmt.Sprintf("apt=%d", newPT)) { |
| 980 | rtxFound = true |
| 981 | rtxPt = uint8(codec.PayloadType) |
| 982 | } |
| 983 | |
| 984 | if codecFound && rtxFound { |
| 985 | break |
| 986 | } |
| 987 | } |
| 988 | if !codecFound { |
| 989 | b.logger.Errorw( |
| 990 | "could not find codec for new payload type", nil, |
| 991 | "pt", newPT, |
| 992 | "rtpParameters", b.rtpParameters, |
| 993 | ) |
| 994 | return |
| 995 | } |
| 996 | |
| 997 | b.logger.Infow( |
| 998 | "codec changed", |
| 999 | "oldPayload", b.payloadType, "newPayload", newPT, |
| 1000 | "oldRtxPayload", b.rtxPayloadType, "newRtxPayload", rtxPt, |
| 1001 | "oldMime", b.mime, "newMime", newCodec.MimeType, |
| 1002 | ) |
| 1003 | b.payloadType = newPT |
| 1004 | b.rtxPayloadType = rtxPt |
| 1005 | b.mime = mime.NormalizeMimeType(newCodec.MimeType) |
| 1006 | |
| 1007 | if f := b.onCodecChange; f != nil { |
| 1008 | go f(newCodec) |
| 1009 | } |
| 1010 | } |
| 1011 | |
| 1012 | func (b *BufferBase) getExtPacket( |
| 1013 | rtpPacket *rtp.Packet, |
no outgoing calls
no test coverage detected