network-programmingstreamwebrtcrtp

WebRTC - RTP vs SCTP


What is different between RTP and STCP.

I got error in Chrome when connection occurs from Firefox.

"Expected RTP. Got SCTP."

Googling about RTP and SCTP found that both are transmission protocols. I am curious about knowing what is differences in both protocols and when which one uses.


Solution

  • First, quick definitions

    RTP is application-specific, meant to be used for audio and video. So the RTP header contains fields specific to them (typically SSRC and CSRC). One could say that RTP is to videos what HTTP is to webpages: both are running at the application layer. Both can be sent over TCP (though that may not be optimal for RTP), UDP (though that may not work well for HTTP), or SCTP. RTP's role is to describe an audio/video stream.

    SCTP, on the other hand, is running at the transport layer. Just like TCP or UDP. It is not specific to any application (e.g. its header does not contain video-related fields like RTP). SCTP's role is to transport data with some guarantees (e.g. reliably or not).

    To add to the confusion, SCTP is typically used over UDP. That's because many pieces of infrastructure (routers) do not support SCTP packets and drop them, which is not practical. QUIC does the same. So you can do things like sending HTTP over SCTP over UDP, or sending HTTP over QUIC over UDP, or sending HTTP over TCP. Or sending RTP over SCTP over UDP, or sending RTP over UDP.

    Specifically in WebRTC

    A WebRTC connection can go over TCP or UDP (usually UDP is preferred for performance reasons), and it has two types of streams: