Search code examples
c++webrtcvideo-streamingnlohmann-jsonlibdatachannel

OvenMediaEngine Answer Sdp parsing error: a=group:LS locQqN


I cannot connect to OvenMediaEngine server with a libdatachannel library. When I send answer message it returns Could not parse SDP error. I can't find true format of answer type message.

I sent request offer with:

{"command", "request_offer"}

Response:

{"candidates":[{"candidate":"candidate:9845236701 1 UDP 50 192.168.xx.xx 10001 typ host","sdpMLineIndex":0},{"candidate":"candidate:8725610493 1 UDP 50 1xx.xx.0.1 10001 typ host","sdpMLineIndex":0}],"code":200,"command":"offer","id":508901731,"peer_id":0,"sdp":{"sdp":"v=0\r\no=OvenMediaEngine 101 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE locQqN\r\na=msid-semantic:WMS FrzS2IOoXH0GTmc93hD7njBQwtJ15CPNKRMu\r\na=fingerprint:sha-256 AA:11:19:C1:60:07:5A:C6:xx:xx:D3:A1:5D:4C:C3:44:C2:59:F6:09:88:36:79:13:73:34:C9:F8:12:E3:8B:47\r\na=ice-options:trickle\r\na=ice-ufrag:3ieW7O\r\na=ice-pwd:wY0yg2pcLTths19xUZ5PGfAk7XjiClQN\r\nm=video 9 UDP/TLS/RTP/SAVPF 98\r\nc=IN IP4 0.0.0.0\r\na=sendonly\r\na=mid:locQqN\r\na=setup:actpass\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=msid:FrzS2IOoXH0GTmc93hD7njBQwtJ15CPNKRMu c3Q4JeTvx29WAi7btFaSR6dZsrLnjIoMCuzE\r\na=extmap:1 urn:ietf:params:rtp-hdrext:framemarking\r\na=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=rtpmap:98 H264/90000\r\na=fmtp:98 packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1\r\na=rtcp-fb:98 goog-remb\r\na=ssrc:2526952431 cname:1AThzs46gkvOHrDS\r\na=ssrc:2526952431 msid:FrzS2IOoXH0GTmc93hD7njBQwtJ15CPNKRMu c3Q4JeTvx29WAi7btFaSR6dZsrLnjIoMCuzE\r\na=ssrc:2526952431 mslabel:FrzS2IOoXH0GTmc93hD7njBQwtJ15CPNKRMu\r\na=ssrc:2526952431 label:c3Q4JeTvx29WAi7btFaSR6dZsrLnjIoMCuzE\r\n","type":"offer"}}

I create answer message:

{"command":"answer","id":508901731,"peer_id":0,"sdp":{"sdp":"v=0\r\no=rtc 2314657025 0 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE locQqN\r\na=group:LS locQqN\r\na=msid-semantic:WMS *\r\na=setup:active\r\na=ice-ufrag:hptN\r\na=ice-pwd:Ai0Bb1M+FufKdPNsatTQ6z\r\na=ice-options:ice2,trickle\r\na=fingerprint:sha-256 2B:A0:66:23:E9:74:AE:98:50:xx:xx:xx:EF:8C:DA:41:AA:8A:96:2C:C6:9B:C6:0B:EC:FA:B5:DF:E7:95:D7:BB\r\nm=video 9 UDP/TLS/RTP/SAVPF 98\r\nc=IN IP4 0.0.0.0\r\na=mid:locQqN\r\na=extmap:1 urn:ietf:params:rtp-hdrext:framemarking\r\na=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=recvonly\r\na=msid:FrzS2IOoXH0GTmc93hD7njBQwtJ15CPNKRMu c3Q4JeTvx29WAi7btFaSR6dZsrLnjIoMCuzE\r\na=rtcp-mux\r\na=rtpmap:98 H264/90000\r\na=rtcp-fb:98 goog-remb\r\na=fmtp:98 packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1\r\n","type":"answer"}}

Response:

{"code":400,"error":"Could not parse SDP"}

I saw this error message on the server:

[2023-04-03 17:23:44.946] E [SPRtcSig-t15000:1439483] Signalling | rtc_signalling_server.cpp:410  | An error occurred while dispatch command answer for stream [#default#app/stream3]: [HTTP] Could not parse SDP (400), disconnecting...
terminate called after throwing an instance of 'Json::LogicError'
what():  in Json::Value::find(begin, end): requires objectValue or nullValue
[2023-04-03 17:23:44.946] C [SPRtcSig-t15000:1439483] OvenMediaEngine | signals.cpp:114  | OME received signal 6 (SIGABRT), interrupt.

I tried different types of answer messages but the result didn't change. When I try wrong JSON format server down. I can't find the message format for answer. This link has ostensibly figured out the include message format but it didn't work.

Does anyone know format of answer message or is it my fault?


Solution

  • I am not familiar with OvenMediaEngine, so please take this with a grain of salt.

    I would start the investigation by noticing that your offer contains only BUNDLE group attribute (all streams are bundled over the same socket). In your case, you only have a video stream, so that is redundant but definitely not wrong.

    However, your answer contains two groups: BUNDLE and LS. BUNDLE is ok because the offer had it, but I question whether the answer can contain a group not listed in the offer. Can you just remove

    a=group:LS locQqN

    from your answer and see what happens. Incidentally, LS is for lipsync and you only have one video stream, so lipsync is not useful here.

    See https://datatracker.ietf.org/doc/rfc3388/ 8.4.1, which says that

    ...grouping requests are always performed by offerers, not by answerers