Why Does RTP use UDP instead of TCP?

前端 未结 11 1185
南旧
南旧 2020-12-24 07:28

I wanted to know why UDP is used in RTP rather than TCP ?. Major VoIP Tools used only UDP as i hacked some of the VoIP OSS.

相关标签:
11条回答
  • 2020-12-24 07:49

    RTP is fairly insensitive to packet loss, so it doesn't require the reliability of TCP.

    UDP has less overhead for headers so that one packet can carry more data, so the network bandwidth is utilized more efficiently.

    UDP provides fast data transmission also.

    So UDP is the obvious choice in cases such as this.

    0 讨论(0)
  • 2020-12-24 07:50

    Besides all the others nice and correct answers this article gives a good understanding about the differences between TCP and UDP.

    0 讨论(0)
  • 2020-12-24 07:52

    As DJ pointed out, TCP is about getting a reliable data stream, and will slow down transmission, and re-transmit corrupted packets, in order to achieve that.

    UDP does not care about reliability of the communication, and will not slow down or re-transmit data.

    If your application needs a reliable data stream, for example, to retrieve a file from a webserver, you choose TCP.

    If your application doesn't care about corrupted or lost packets, and you don't need to incur the additional overhead to provide the additional reliability, you can choose UDP instead.

    VOIP is not significantly improved by reliable packet transmission, and in fact, in some cases things in TCP like retransmission and exponential backoff can actually hurt VOIP quality. Therefore, UDP was a better choice.

    0 讨论(0)
  • 2020-12-24 07:54

    just a remark: Each packet sent in an RTP stream is given a number one higher than its predecessor.This allows thr destination to determine if any packets are missing. If a packet is mising, the best action for the destination to take is to approximate the missing vaue by interpolation. Retranmission is not a proctical option since the retransmitted packet would be too late to be useful.

    0 讨论(0)
  • 2020-12-24 07:55

    Technically RTP packets can be interleaved over a TCP connection. There are lots of great answers given here. Two additional minor points:

    RFC 4588 describes how one could use retransmission with RTP data. Most clients that receive RTP streams employ a buffer to account for jitter in the network that is typically 1-5 seconds long and which means there is time available for a retransmit to receive the desired data.

    RTP traffic can be interleaved over a TCP connection. In practice when this is done, the difference between Interleaved RTP (i.e. over TCP) and RTP sent over UDP is how these two perform over a lossy network with insufficient bandwidth available for the user. The Interleaved TCP stream will end up being jerky as the player continually waits in a buffering state for packets to arrive. Depending on the player it may jump ahead to catch up. With an RTP connection you will get artifacts (smearing/tearing) in the video.

    0 讨论(0)
提交回复
热议问题