RTMP acknowledge overflow causes the encoder to stop streaming #730
Closed
Description
ACK SIZE refers to the number of bytes that the PEER should send an Acknowledge message after receiving. In other words, it indicates the number of bytes that the PEER has received.
RTMP is 32, which means it is 4 bytes long, but it does not explicitly state how overflow should be handled, whether it is int32 or uint32.
5.3. Acknowledgement (3)
The client or the server sends the acknowledgment to the peer after
receiving bytes equal to the window size. The window size is the
maximum number of bytes that the sender sends without receiving
acknowledgment from the receiver. The server sends the window size to
the client after application connects. This message specifies the
sequence number, which is the number of the bytes received so far.
0 1 2 3
01234567890123456789012345678901
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| sequence number (4 byte) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 4 shows the payload for the protocol message 'Acknowledgement'.
sequence number: 32 bits
This field holds the number of bytes received so far.
Previously, the bitrate of videos was very low, such as 100kbps, so there would be no overflow issue with these 4 bytes. Now, the bitrate is 80 to 100 times higher, which easily leads to overflow. Some encoders have different rules for handling this overflow, causing them to receive incorrect values and mistakenly assume that the server has not acknowledged, resulting in re-streaming.
TRANS_BY_GPT3