With the continuous development of Internet infrastructure and hardware equipment. The majority of live viewers have higher and higher requirements for the clarity and delay of live broadcast viewing, and live broadcast has entered an era of low delay and high bit rate, and the transmission technology of live broadcast is also facing higher and higher requirements and challenges. Tencent video cloud on all links for streaming media transmission for further optimization, made on the important events have high reliability, low latency, high quality and quality requirements, at the same time with the customer, such as density, deep cooperation, not only on the server, in APP side also has carried on the SRT cooperation, as well as competition from the source to ensure stability.

In the process of live broadcast, network packet loss will cause various frame loss, end lag or even screen splintering, which will cause bad watching experience for the audience. How can SRT solve the link packet loss?

SRT adopts the ACK+ NACK solution. Every 10ms, the SRT receiver will send a “normal “ACK packet, informing the sender of the serial number of the maximum consecutive packets in the current received buffer. After receiving the” normal “ACK packet, the sender will acknowledge the data, move the sending window forward, and send the ACKACK at the same time. The receiver calculates the LINK RTT according to T(ackack) -t (ACK). For a high bit rate link, a confirmation every 10ms May not be timely. For this reason, the SRT replies with an extra LITEACK for every 64 packets it receives to quickly confirm the data and move the sending window as quickly as possible.

Each time a packet is received, SRT calculates the current “out-of-order”. For example, look at the picture below:

In the current figure, the “disorder degree” is 2. When packet loss is found and retransmission is required, SRT will delay the NACK of two packets to reduce a part of invalid retransmission caused by UDP disorder.

As we all know, TCP packets in a window are usually sent at one time without interval, which is easy to cause traffic burst. The Pacing mechanism prevents this problem by smoothing the sending interval.

SRT adjusts the send interval based on the bandwidth evaluation. The maximum transmission rate can be sampled from the input rate, or the user can set the maximum bandwidth (maxBW) and set aside a portion of the retransmission bandwidth (overheadBW), the sum of which is the maximum transmission rate.

As shown in the figure above, if the maxBW is 800Kbps, the overheadBW is 200Kbps, and the maximum bandwidth limit is 1Mbps, SRT will be sent smoothly at an interval of 1ms based on the packet size of 1Kb.

Based on the above features, Tencent Video Cloud takes SRT as the protocol over the transport layer and can transform any APPLICATION layer protocol based on TCP into an application layer protocol based on SRT. Tencent and Douyu choose RTMP over SRT to try to apply SRT on the APP side and optimize the source of weak network anchors.

After the first attempt to use SRT in the Douyu outdoor section, the comparison of RTMP push flow and SRT push flow is as follows:

An outdoor anchor who loses packets for a long time, pushes the stream after turning on the SRT switch, and plays the following card: