5

I am developing a WebRTC video streaming program which must be able to renegotiate rtc connections when a user wants to add a video stream. As it is my program closes the existing RTCPeerConnection sets the Connection variable to null then creates a new RTCPeerConnection and restarts the offer/answer exchange anew.

I have been getting the error :

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

after setting up the initial connection.

Why is this happening despite the fact that the connection was fully closed and set to null on both ends?

shrys
  • 5,860
  • 2
  • 21
  • 36
Pj Rigor
  • 391
  • 6
  • 17
  • The error message is already explaining the problem. Now, you might want to take a closer look in your SDP(s). It quite difficult to point where is the exact problem without looking into the SDP(s). Can you please share your offer and answer SDP ? – Pallab Gain Jul 09 '19 at 11:06
  • One thing that is probably happening there - ***the order of the m-lines is wrong***. Can you please take a look - "if in your offer, the first m-line is audio followed by video ; then in your answer it is also maintaining the same order" (m-line audio followed by video) ? – Pallab Gain Jul 09 '19 at 11:10
  • the offer : `v=0 o=- 501124397863207866 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE 0 a=msid-semantic: WMS m=application 9 DTLS/SCTP 5000 c=IN IP4 0.0.0.0 a=ice-ufrag:hIPz a=ice-pwd:itgGwKYm41i479vAbD97u4Ia a=ice-options:trickle a=fingerprint:sha-256 60:DA:04:D9:3D:00:24:94:07:FF:DF:15:C2:3E:74:F9:2D:D4:17:B1:A9:1B:21:42:89:3B:2D:26:33:D2:F5:43 a=setup:actpass a=mid:0 a=sctpmap:5000 webrtc-datachannel 1024` – Pj Rigor Jul 09 '19 at 16:35
  • the answer : `v=0 o=- 8994533182593292479 2 IN IP4 127.0.0.1 s=- t=0 0 a=group:BUNDLE 0 a=msid-semantic: WMS m=application 9 DTLS/SCTP 5000 c=IN IP4 0.0.0.0 b=AS:30 a=ice-ufrag:KDAg a=ice-pwd:O8XCd+7bLc8Y2nlCXNMaXjSY a=ice-options:trickle a=fingerprint:sha-256 C3:17:0F:A5:B0:2A:4C:9B:A7:D2:A5:95:3A:43:FB:67:E6:24:70:69:F3:64:16:59:3D:17:F5:71:94:DD:C5:98 a=setup:active a=mid:0 a=sctpmap:5000 webrtc-datachannel 1024` – Pj Rigor Jul 09 '19 at 16:36
  • This is a good SDP offer and answer pair. I don't see something wrong here. I was wondering if you can share your application somewhere. There might be some implementation issue that you might need to look into. For example - I quickly [wrote this data channel only demo application](https://jsfiddle.net/pallab8077/c0L5g2xv/) that generates the same SDP line(s) as yours and can connect successfully . – Pallab Gain Jul 10 '19 at 10:15

0 Answers0