OiO.lk Blog java Issue: Failed to Set Remote Description
java

Issue: Failed to Set Remote Description


I’m encountering an error while trying to set the remote description in a WebRTC application. The error message is:

Failed to set remote description: Failed to set remote answer SDP: The order of m-lines in the answer doesn’t match the order in the offer. Rejecting answer.

Context:

In my application, there is only one peer. I send an offer to the server, which processes the video by applying a grayscale effect and then returns the modified video. The video chat works successfully on the website without any errors during communication with the server.

Here is the offer that I set as the local description before sending it to the server using a POST API:

v\u003d0\r\r\no\u003d- 8996844841327341870 2 IN IP4 127.0.0.1\r\r\ns\u003d-\r\r\nt\u003d0 0\r\r\na\u003dgroup:BUNDLE video\r\r\na\u003dmsid-semantic: WMS local_stream\r\r\nm\u003dvideo 9 RTP/AVPF 96 97 98 99 100 101 127 124 125\r\r\nc\u003dIN IP4 0.0.0.0\r\r\na\u003drtcp:9 IN IP4 0.0.0.0\r\r\na\u003dice-ufrag:6Vbo\r\r\na\u003dice-pwd:x6X5XlXLQjcC7goUggc50zoW\r\r\na\u003dice-options:trickle renomination\r\r\na\u003dmid:video\r\r\na\u003dextmap:14 urn:ietf:params:rtp-hdrext:toffset\r\r\na\u003dextmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\\r\\na\u003dextmap:13 urn:3gpp:video-orientation\r\r\na\u003dextmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\\r\\na\u003dextmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\\r\\na\u003dextmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\\r\\na\u003dextmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\\r\\na\u003dextmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07\r\\r\\na\u003dextmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\\r\\na\u003dsendrecv\r\\r\\na\u003drtcp-mux\r\\r\\na\u003drtcp-rsize\r\\r\\na\u003drtpmap:96 VP8/90000\r\r\na\u003drtcp-fb:96 goog-remb\r\r\na\u003drtcp-fb:96 transport-cc\r\r\na\u003drtcp-fb:96 ccm fir\r\r\na\u003drtcp-fb:96 nack\r\r\na\u003drtcp-fb:96 nack pli\r\r\na\u003drtpmap:97 rtx/90000\r\r\na\u003dfmtp:97 apt\u003d96\r\r\na\u003drtpmap:98 VP9/90000\r\r\na\u003drtcp-fb:98 goog-remb\r\r\na\u003drtcp-fb:98 transport-cc\r\r\na\u003drtcp-fb:98 ccm fir\r\r\na\u003drtcp-fb:98 nack\r\r\na\u003drtcp-fb:98 nack pli\r\r\na\u003drtpmap:99 rtx/90000\r\r\na\u003dfmtp:99 apt\u003d98\r\r\na\u003drtpmap:100 H264/90000\r\r\na\u003drtcp-fb:100 goog-remb\r\r\na\u003drtcp-fb:100 transport-cc\r\r\na\u003drtcp-fb:100 ccm fir\r\r\na\u003drtcp-fb:100 nack\r\r\na\u003drtcp-fb:100 nack pli\r\r\na\u003dfmtp:100 level-asymmetry-allowed\u003d1;packetization-mode\u003d1;profile-level-id\u003d42e01f\r\r\na\u003drtpmap:101 rtx/90000\r\r\na\u003dfmtp:101 apt\u003d100\r\r\na\u003drtpmap:127 red/90000\r\r\na\u003drtpmap:124 rtx/90000\r\r\na\u003dfmtp:124 apt\u003d127\r\r\na\u003drtpmap:125 ulpfec/90000\r\r\na\u003dssrc-group:FID 4025633256 1896288432\r\r\na\u003dssrc:4025633256 cname:6Xh3mkDwdr53qWNL\r\r\na\u003dssrc:4025633256 msid:local_stream local_track\r\r\na\u003dssrc:4025633256 mslabel:local_stream\r\r\na\u003dssrc:4025633256 label:local_track\r\r\na\u003dssrc:1896288432 cname:6Xh3mkDwdr53qWNL\r\r\na\u003dssrc:1896288432 msid:local_stream local_track\r\r\na\u003dssrc:1896288432 mslabel:local_stream\r\r\na\u003dssrc:1896288432 label:local_track\r\r\n

The API returns the following answer:

v=0\r\no=- 3938835560 3938835560 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=group:BUNDLE \r\na=msid-semantic:WMS *\r\n

When I attempt to set this answer as the remote description, I receive the same error regarding the order of m-lines.

Here’s the relevant code snippet:

peerConnection?.setRemoteDescription(object : SdpObserver {
override fun onCreateSuccess(p0: SessionDescription?) {
    Log.d("WebRTC", "Remote description created successfully: $p0")
}

override fun onSetSuccess() {
    Log.d("WebRTC", "Remote description set successfully")
}

override fun onCreateFailure(error: String?) {
    Log.e("WebRTC", "Failed to create remote description: $error")
}

override fun onSetFailure(error: String?) {
    Log.e("WebRTC", "Failed to set remote description: $error")
}
}, session)



You need to sign in to view this answers

Exit mobile version