mozilla / webrtc-sdp

Rust SDP parser for WebRTC
Mozilla Public License 2.0
155 stars 30 forks source link

Parser error while trying to parse simple INVITE sdp. #96

Closed alishir closed 5 years ago

alishir commented 5 years ago

I'm trying to parse simple INVITE sdp from client, but I got unsupported protocol, here is the sdp string:

let sdp_str = "v=0\r\n
        o=- 4232193541 678199583 IN IP4 192.168.5.33\r\n
        s=-\r\n
        c=IN IP4 192.168.5.33\r\n
        t=0 0\r\n
        m=audio 42498 RTP/AVP 96 0 8 101\r\n
        a=rtpmap:96 opus/48000/2\r\n
        a=fmtp:96 stereo=1;sprop-stereo=1;maxaveragebitrate=28000\r\n
        a=rtpmap:0 PCMU/8000\r\n
        a=rtpmap:8 PCMA/8000\r\n
        a=rtpmap:101 telephone-event/8000\r\n
        a=fmtp:101 0-15\r\n
        a=sendrecv\r\n
        a=label:1\r\n
        a=rtcp-rsize\r\n
        a=ssrc:1526903191 cname:sip:ali@127.0.0.1:8080\r\n
        a=ptime:20\r\n";

And the error is:

error occured: Unsupported { error: Unsupported("unsupported protocol value: RTP/AVP"),
line: "m=audio 42498 RTP/AVP 96 0 8 101", line_number: 10 }
na-g commented 5 years ago

@alishir, WebRTC doesn't allow RTP/AVP, see section 4.2 of https://tools.ietf.org/html/draft-ietf-rtcweb-rtp-usage-26 . This parser conforms to the restrictions imposed by the WebRTC standards, so it may not be a good choice for a general purpose SDP library. @nils-ohlmeier feel free to correct me.

alishir commented 5 years ago

@na-g thanks a lot for detailed explanation.

nils-ohlmeier commented 5 years ago

Yeah webrtc is the primary use case for now. I would prefer to not make things more complex, e.g. when to accept key values from SDP. Maybe in future some kind of configuration profile could it make it possible to adjust the parser per use case.