Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

[question] 'Value does not fall within the expected range.' exception #844

Open
levboy1 opened this issue Jan 20, 2022 · 1 comment
Open

Comments

@levboy1
Copy link

levboy1 commented Jan 20, 2022

Describe the bug

I am trying to implement a C# desktop application on Windows which is able to connect to a remote peer and establish a WebRTC call. After calling the PeerConnection.SetRemoteDescriptionAsync() method with the SDP answer I get this exception: 'Value does not fall within the expected range.'

To Reproduce

The remote peer is managed by a web API. The remote peer expects me to pass the SDP offer to the web API so I just simply print the SDP offer to the output and send it manually to the API in a HTTP message using Postman. I receive the SDP answer in the body of the successful HTTP answer. So I copy it to the console, then the program reads it from the standard input and parses it to an SdpMessage object.

I am trying to make a connection with the following flow:

  1. I initialize the peer connection object with the PeerConnectionConfiguration. I use the STUN server of Google.
  2. I add a data channel and an audio transreceiver to the peer connection object, then I add a local audio track to the transreceiver object.
  3. I call the PeerConnection.CreateOffer() method.
  4. When LocalSdpReadytoSend event is triggered I store the SDP to a global variable.
  5. When IceCandidateReadytoSend event is triggered I concatenate a 'a={candidate}' line to the SDP offer for each candidate.
  6. When IceGatheringState changes to complete I print the SDP offer to the console and I manually send the SDP to the web API.
  7. I receive a successful answer from the API with the SDP answer, indicating the remote peer is ready to establish the connection.
  8. I copy the SDP answer to the console so the program can read and parse it to an SdpMessage object.
  9. After calling the SetRemoteDescriptionAsync() method the exception is thrown.

I have uploaded my code to a public repository so you can track step by step what I am trying to do:
https://github.com/levboy1/microsoft_mixedreality

SDP messages

Offer message v=0 o=- 8795496105880237725 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE audio data a=msid-semantic: WMS mrsw#0 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:20JD a=ice-pwd:JbJ1IiKjfEfpsgkNvDHlj9Wt a=ice-options:trickle a=fingerprint:sha-256 D0:FE:84:B4:90:0C:FA:A9:7A:AA:34:6A:D2:52:4F:35:9C:8D:E8:36:3C:17:65:40:81:74:F5:CA:BA:68:CB:91 a=setup:actpass a=mid:audio a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level 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:3462862450 cname:PkburLTo3Ytfmcfb a=ssrc:3462862450 msid:mrsw#0 437642e8-574b-4375-bd34-54efcec5a2b1 a=ssrc:3462862450 mslabel:mrsw#0 a=ssrc:3462862450 label:437642e8-574b-4375-bd34-54efcec5a2b1 m=application 9 DTLS/SCTP 5000 c=IN IP4 0.0.0.0 a=ice-ufrag:20JD a=ice-pwd:JbJ1IiKjfEfpsgkNvDHlj9Wt a=ice-options:trickle a=fingerprint:sha-256 D0:FE:84:B4:90:0C:FA:A9:7A:AA:34:6A:D2:52:4F:35:9C:8D:E8:36:3C:17:65:40:81:74:F5:CA:BA:68:CB:91 a=setup:actpass a=mid:data a=sctpmap:5000 webrtc-datachannel 1024 a=candidate:974510316 1 udp 2122260223 10.228.240.33 61827 typ host generation 0 ufrag 20JD network-id 1 a=candidate:948785377 1 udp 2122194687 192.168.0.154 61828 typ host generation 0 ufrag 20JD network-id 2 network-cost 10 a=candidate:974510316 1 udp 2122260223 10.228.240.33 61829 typ host generation 0 ufrag 20JD network-id 1 a=candidate:948785377 1 udp 2122194687 192.168.0.154 61830 typ host generation 0 ufrag 20JD network-id 2 network-cost 10 a=candidate:1955996700 1 tcp 1518280447 10.228.240.33 60286 typ host tcptype passive generation 0 ufrag 20JD network-id 1 a=candidate:1980673041 1 tcp 1518214911 192.168.0.154 60287 typ host tcptype passive generation 0 ufrag 20JD network-id 2 network-cost 10 a=candidate:1955996700 1 tcp 1518280447 10.228.240.33 60288 typ host tcptype passive generation 0 ufrag 20JD network-id 1 a=candidate:1980673041 1 tcp 1518214911 192.168.0.154 60289 typ host tcptype passive generation 0 ufrag 20JD network-id 2 network-cost 10 a=candidate:3116717653 1 udp 1685987071 80.98.2.199 61828 typ srflx raddr 192.168.0.154 rport 61828 generation 0 ufrag 20JD network-id 2 network-cost 10 a=candidate:3116717653 1 udp 1685987071 80.98.2.199 61830 typ srflx raddr 192.168.0.154 rport 61830 generation 0 ufrag 20JD network-id 2 network-cost 10 a=end-of-candidates
Answer message v=0 o=rtcweb 1 1 IN IP4 127.0.0.1 s=- t=0 0 a=ice-lite m=audio 22948 RTP/SAVPF 111 110 c=IN IP4 199.87.123.94 a=ice-ufrag:l+UE a=ice-pwd:PAXI8kXVBo+N91F+8mGGgr5/ a=fingerprint:sha-256 FC:A8:9D:19:A1:0F:76:B5:65:56:B6:A4:8E:C3:2C:1E:F8:90:B7:BF:1B:08:A1:58:05:86:AC:78:E4:2D:A9:6A a=setup:passive a=sendrecv a=rtcp-mux a=rtcp:9 IN IP4 0.0.0.0 a=rtpmap:111 opus/48000/2 a=fmtp:111 minptime=10; useinbandfec=1 a=rtcp-fb:111 transport-cc a=rtpmap:110 telephone-event/48000 a=maxptime:60 a=candidate:0 1 UDP 2113667327 199.87.123.94 22948 typ host a=end-of-candidates a=ssrc:1192398718 cname:67be75c1-339e-4e48-ab65-5c5c6d2f65d7 a=ssrc:1192398718 msid:946e4825-0536-447f-82ec-962dd87fe724 3afca3af-565c-4dca-926a-29de8f0258f6 a=ssrc:1192398718 mslabel:946e4825-0536-447f-82ec-962dd87fe724 a=ssrc:1192398718 label:3afca3af-565c-4dca-926a-29de8f0258f6

Screenshots
01
02
03
04
05

Questions

After reading my summary you can easily tell by now that I am not really familiar with WebRTC and SDP attributes. I have read all earlier issues related to this exception and if I understand correctly the problem is the incompatibility of the SDP offer and answer. My questions are: What can cause this exception? There is no matching codec or ICE candidate in the offer and answer? Or I just made simply a wrong implementation?

Environment

  • MR-WebRTC package version: 2.0.2
  • Platform: Windows Desktop
  • Target device: Windows Desktop
  • .NET Core version: 3.1
@mango-martin
Copy link

Hey there. Did you find a solution for this? I am having a similar issue. "Value does not fall within the expected range." But I don't understand what's wrong.

Here's the offer that throws the error. Could anyone have a quick look to see if something's off in the message? I've tested a bunch with different codecs, etc. but it's always the same result.

data=v=0
o=mediasoup-client 10000 1 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-lite
a=fingerprint:sha-512 CF:F8:FD:BB:B2:9D:48:A9:3B:61:9E:F9:04:C6:C2:B2:C7:67:9F:92:BF:FD:AE:AC:E1:F3:C8:9A:F7:18:65:16:22:7E:0A:5E:97:06:72:5A:0F:45:34:3A:36:A6:43:FC:40:C5:34:D0:A3:16:26:E2:C0:8B:07:73:20:12:42:44
a=msid-semantic: WMS *
a=group:BUNDLE 0 1
m=audio 7 UDP/TLS/RTP/SAVPF 111
c=IN IP4 127.0.0.1
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1
a=setup:actpass
a=mid:0
a=msid:b65d595c b65d595c-audio
a=sendonly
a=ice-ufrag:2bp39odyjq6ixzip
a=ice-pwd:3gewute7gjvraoz6stzpvizg98o83hk7
a=candidate:udpcandidate 1 udp 1076302079 127.0.0.1 45339 typ host
a=candidate:udpcandidate 1 udp 1076276479 ::1 49630 typ host
a=candidate:udpcandidate 1 udp 1076250879 xxx.xx.xx.238 42917 typ host
a=end-of-candidates
a=ice-options:renomination
a=ssrc:126830276 cname:lamX5agvRn+k1TYf
a=rtcp-mux
a=rtcp-rsize
m=video 7 UDP/TLS/RTP/SAVPF 96 100
c=IN IP4 127.0.0.1
a=rtpmap:96 VP8/90000
a=rtpmap:100 rtx/90000
a=fmtp:100 apt=96
a=setup:actpass
a=mid:1
a=msid:b65d595c b65d595c-video
a=sendonly
a=ice-ufrag:2bp39odyjq6ixzip
a=ice-pwd:3gewute7gjvraoz6stzpvizg98o83hk7
a=candidate:udpcandidate 1 udp 1076302079 127.0.0.1 45339 typ host
a=candidate:udpcandidate 1 udp 1076276479 ::1 49630 typ host
a=candidate:udpcandidate 1 udp 1076250879 xxx.xx.xx.238 42917 typ host
a=end-of-candidates
a=ice-options:renomination
a=ssrc:711631981 cname:lamX5agvRn+k1TYf
a=ssrc:711631982 cname:lamX5agvRn+k1TYf
a=ssrc-group:FID 711631981 711631982
a=rtcp-mux
a=rtcp-rsize

I'm also not a WebRTC expert, so debugging without any indication of where the error might come from is really hard for me. With my limited knowledge of the SDP process and googling a bunch it seems the offer should pass.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants