Send transport sdp offer / answer mismatch in react-native

We are using mediasoup-client v3 (and the latest react-native-webrtc) and are having an issue attempting to produce a track. The error is happening on this line https://github.com/versatica/mediasoup-client/blob/v3/lib/handlers/ReactNative.js#L261

message: "Failed to set remote answer sdp: The order of m-lines in answer doesn't match order in offer. Rejecting answer."
name: "SetRemoteDescriptionFailed"

The offer sdp is:

v=0
o=- 9137409393223652001 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS a5049928-8a2e-4ad2-a0d6-0be611687992
m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:A1pQ
a=ice-pwd:yH4bIlku8LxjCDjTGktgktPj
a=ice-options:trickle renomination
a=fingerprint:sha-256 4D:CD:53:87:68:05:07:12:3E:9E:E4:BC:7F:D1:CF:90:65:D6:B9:F6:C3:F4:0D:32:18:A3:2A:B3:51:B3:AE:93
a=setup:actpass
a=mid:audio
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:9 G722/8000
a=rtpmap:102 ILBC/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:112 telephone-event/32000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:158518221 cname:3vYYXCvfbsqwfiZ8
a=ssrc:158518221 msid:a5049928-8a2e-4ad2-a0d6-0be611687992 51843BE0-5092-410F-BDC0-A5AFB6702DA6
a=ssrc:158518221 mslabel:a5049928-8a2e-4ad2-a0d6-0be611687992
a=ssrc:158518221 label:51843BE0-5092-410F-BDC0-A5AFB6702DA6
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 123 125 122 124
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:A1pQ
a=ice-pwd:yH4bIlku8LxjCDjTGktgktPj
a=ice-options:trickle renomination
a=fingerprint:sha-256 4D:CD:53:87:68:05:07:12:3E:9E:E4:BC:7F:D1:CF:90:65:D6:B9:F6:C3:F4:0D:32:18:A3:2A:B3:51:B3:AE:93
a=setup:actpass
a=mid:video
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 urn:3gpp:video-orientation
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
a=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 H264/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640c1f
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 H264/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=fmtp:98 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP8/90000
a=rtcp-fb:100 goog-remb
a=rtcp-fb:100 transport-cc
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:127 VP9/90000
a=rtcp-fb:127 goog-remb
a=rtcp-fb:127 transport-cc
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack
a=rtcp-fb:127 nack pli
a=rtpmap:123 rtx/90000
a=fmtp:123 apt=127
a=rtpmap:125 red/90000
a=rtpmap:122 rtx/90000
a=fmtp:122 apt=125
a=rtpmap:124 ulpfec/90000

And the answer sdp is

v=0
o=mediasoup-client 10000 1 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-lite
a=fingerprint:sha-512 37:AB:5C:2F:DC:01:4F:50:CE:5F:38:A9:A1:B3:95:56:C3:7D:39:EA:32:3E:1E:F6:4A:05:C0:73:DD:46:23:43:44:0C:30:2F:22:D3:E2:94:7D:53:CE:BF:32:C0:65:98:ED:24:47:0C:35:20:28:A5:8F:46:C1:06:B6:89:2D:FE
a=msid-semantic: WMS *
a=group:BUNDLE audio
m=audio 7 UDP/TLS/RTP/SAVPF 111
c=IN IP4 127.0.0.1
a=rtpmap:111 opus/48000/2
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=setup:active
a=mid:audio
a=recvonly
a=ice-ufrag:acakvshuxdt0y9wy
a=ice-pwd:fx790lin6i21zuhz020u1qr8jfvmkjyw
a=candidate:udpcandidate 1 udp 1076558079 127.0.0.1 49678 typ host
a=candidate:tcpcandidate 1 tcp 1076302079 127.0.0.1 46853 typ host tcptype passive
a=candidate:udpcandidate 1 udp 1076532479 0.0.0.0 42864 typ host
a=candidate:tcpcandidate 1 tcp 1076276479 0.0.0.0 47102 typ host tcptype passive
a=end-of-candidates
a=ice-options:renomination
a=rtcp-mux
a=rtcp-rsize

(The last ICE candidate IP addresses have been 0’ed out)

Any help or insight would be greatly appreciated

Can you build full debugging and paste the logs here?

Also, what are the steps for it to happen?

@ibc I have pasted the logs below:

The steps are:

  1. create device
  2. load device with remote router RTP capabilities
  3. create receive and send transports each with the remote {iceParameters, iceCandidates, dtlsParameters} options
  4. produce a track on the send transport

For what its worth, this works seamlessly on Chrome and Firefox and just seems to be an issue with React Native. Still unsure what the exact issue is, have attempting mangling the offer/answer but haven’t had any luck so far

@ibc after digging in more, it seems to be the fact that React Native has video in its offer, and the answer does not (our remote is audio-only). I mangled the offer sdp to remove the video component and was able to connect as expected.

Any idea what the correct way to only offer audio from the client is? Not sure why Chrome would only be offering audio, assumed that it would respect the remote router capabilities but that appears to not be the case for React Native. Might have to fork and adjust the code for the React Native handler.

Thanks for your time!

Just wondering, have you ever check the recent commits and announcements?

Please, subscribe to the “Annoouncements” category.

Oooo yes that looks like the fix, awesome thank you! I will subscribe.