Skip to content

Differing Codecs in offer m-lines cause the answer to be malformed #357

Open
@KillingSpark

Description

@KillingSpark

It's me again doing weird stuff with this crate :) This is possibly related to #308

The most minimal example I could come up with is an offer with two m-lines, one with only codec VP9 and one with only codec VP8: (full SDPs attached at the end)

...
m=video 20509 RTP/AVPF 121
a=mid:1
a=rtpmap:121 VP9/90000
a=recvonly
...
m=video 20509 RTP/AVPF 96 97
a=mid:p1_1_2
a=rtpmap:96 VP8/90000
a=sendonly
...

If I set this as a remote offer on a peer connection it produces these transceiver states:
Both of these have (only) the codec video/VP9 selected

Transceiver state
    1:
        Recv RTCRtpParameters { header_extensions: [RTCRtpHeaderExtensionParameters { uri: "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01", id: 7 }, RTCRtpHeaderExtensionParameters { uri: "urn:ietf:params:rtp-hdrext:sdes:mid", id: 4 }], codecs: [RTCRtpCodecParameters { capability: RTCRtpCodecCapability { mime_type: "video/VP9", clock_rate: 90000, channels: 0, sdp_fmtp_line: "max-fs=12288;max-fr=60", rtcp_feedback: [RTCPFeedback { typ: "nack", parameter: "" }, RTCPFeedback { typ: "nack", parameter: "pli" }, RTCPFeedback { typ: "ccm", parameter: "fir" }, RTCPFeedback { typ: "goog-remb", parameter: "" }] }, payload_type: 121, stats_id: "" }] }
    p1_1_2:
        Recv RTCRtpParameters { header_extensions: [RTCRtpHeaderExtensionParameters { uri: "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01", id: 7 }, RTCRtpHeaderExtensionParameters { uri: "urn:ietf:params:rtp-hdrext:sdes:mid", id: 4 }], codecs: [RTCRtpCodecParameters { capability: RTCRtpCodecCapability { mime_type: "video/VP9", clock_rate: 90000, channels: 0, sdp_fmtp_line: "max-fs=12288;max-fr=60", rtcp_feedback: [RTCPFeedback { typ: "nack", parameter: "" }, RTCPFeedback { typ: "nack", parameter: "pli" }, RTCPFeedback { typ: "ccm", parameter: "fir" }, RTCPFeedback { typ: "goog-remb", parameter: "" }] }, payload_type: 121, stats_id: "" }] }

I didn't add a track on the peer connection in this minimal example but when I encountered it, the RTCRtpSender also had the VP9 codec selected.

The answer produced is this:

...
m=video 9 UDP/TLS/RTP/SAVPF 121
a=mid:1
a=rtpmap:121 VP9/90000
a=sendonly
...
m=video 9 UDP/TLS/RTP/SAVPF 121
a=mid:p1_1_2
a=rtpmap:121 VP9/90000
a=recvonly
...

If a track (and by that a RTCRtpSender) exists on MID 1 this causes an error when setting the answer because of incompatible codecs. In my minimal example I did not add a track and then this doesn't even return an error.

Details

Offer SDP

v=0
o=- 1669535888844 1669535888846 IN IP4 10.2.0.77
s=CROWN
c=IN IP4 10.2.0.77
t=0 0
a=group:BUNDLE 0 1 p1_1_2
a=msid-semantic: WMS -
a=extmap-allow-mixed
a=fingerprint:sha-256 4B:44:B2:F4:C7:6B:F5:76:BD:D2:E6:2D:52:97:40:2B:30:44:B3:55:5D:F1:92:4C:C9:51:33:A9:A2:25:53:79
a=ice-ufrag:5ttuxMt6GE0=
a=ice-pwd:h0QyQvBAcDFpcfG7jxYwM5I1ymHIonkjDTQltftlgF8=
a=ice-options:trickle
a=ice-lite
m=video 20509 RTP/AVPF 121
a=mid:1
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=rtpmap:121 VP9/90000
a=fmtp:121 max-fs=12288;max-fr=60
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=recvonly
a=rtcp-rsize
a=setup:passive
a=candidate:1 1 TCP 2105524479 10.2.0.77 20509 typ host tcptype passive
a=end-of-candidates
a=rtcp-xr:voip-metrics stat-summary=loss,dup,jitt
a=rtcp-mux
m=video 20509 RTP/AVPF 96 97
a=mid:p1_1_2
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:13 urn:3gpp:video-orientation
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=msid:- 4dc9e5d5-4abe-405d-8a36-ad2e06951916
a=sendonly
a=rtcp-rsize
a=ssrc:4068221753 cname:c31f53b4-a9d3-4877-8857-acf85d7ac543
a=ssrc:1423026143 cname:c31f53b4-a9d3-4877-8857-acf85d7ac543
a=ssrc-group:FID 4068221753 1423026143
a=setup:passive
a=candidate:1 1 TCP 2105524479 10.2.0.77 20509 typ host tcptype passive
a=end-of-candidates
a=rtcp-xr:voip-metrics stat-summary=loss,dup,jitt
a=rtcp-mux
Answer SDP

v=0
o=- 5960997078167534231 980898000 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 09:68:A4:67:4E:0D:42:08:F6:13:2A:9D:FF:61:B0:6E:CF:D2:32:6E:2E:4E:D2:FA:50:14:DA:34:A4:76:44:62
a=group:BUNDLE 1 p1_1_2
m=video 9 UDP/TLS/RTP/SAVPF 121
c=IN IP4 0.0.0.0
a=setup:active
a=mid:1
a=ice-ufrag:fdLrozfOiZUgYiSE
a=ice-pwd:mKpVgMAEhakBXYkPhzttstVGpgvKgoCq
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:121 VP9/90000
a=fmtp:121 max-fs=12288;max-fr=60
a=rtcp-fb:121 nack 
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb 
a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendonly
m=video 9 UDP/TLS/RTP/SAVPF 121
c=IN IP4 0.0.0.0
a=setup:active
a=mid:p1_1_2
a=ice-ufrag:fdLrozfOiZUgYiSE
a=ice-pwd:mKpVgMAEhakBXYkPhzttstVGpgvKgoCq
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:121 VP9/90000
a=fmtp:121 max-fs=12288;max-fr=60
a=rtcp-fb:121 nack 
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb 
a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=recvonly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions