AI automatically translates all comments in the code into English (#3917)

This commit is contained in:
alex
2024-09-19 14:53:50 +08:00
committed by GitHub
parent 046de691cb
commit 4152dcd409
279 changed files with 10602 additions and 3038 deletions

View File

@@ -27,7 +27,8 @@ const char *RtspSplitter::onSearchPacketTail(const char *data, size_t len) {
}
if (len > 256 * 1024) {
//rtp大于256KB
// rtp大于256KB [AUTO-TRANSLATED:d8d8a481]
// rtp is greater than 256KB
ret = (char *) memchr(data, '$', len);
if (!ret) {
WarnL << "rtp缓存溢出:" << hexdump(data, 1024);
@@ -39,21 +40,26 @@ const char *RtspSplitter::onSearchPacketTail(const char *data, size_t len) {
const char *RtspSplitter::onSearchPacketTail_l(const char *data, size_t len) {
if(!_enableRecvRtp || data[0] != '$'){
//这是rtsp包
// 这是rtsp包 [AUTO-TRANSLATED:cdc2211d]
// This is an rtsp packet
_isRtpPacket = false;
return HttpRequestSplitter::onSearchPacketTail(data, len);
}
//这是rtp包
// 这是rtp包 [AUTO-TRANSLATED:627d4881]
// This is an rtp packet
if(len < 4){
//数据不够
// 数据不够 [AUTO-TRANSLATED:72802244]
// Not enough data
return nullptr;
}
uint16_t length = (((uint8_t *)data)[2] << 8) | ((uint8_t *)data)[3];
if(len < (size_t)(length + 4)){
//数据不够
// 数据不够 [AUTO-TRANSLATED:72802244]
// Not enough data
return nullptr;
}
//返回rtp包末尾
// 返回rtp包末尾 [AUTO-TRANSLATED:2546d5ce]
// Return the end of the rtp packet
_isRtpPacket = true;
return data + 4 + length;
}
@@ -74,11 +80,14 @@ ssize_t RtspSplitter::onRecvHeader(const char *data, size_t len) {
_parser.parse(data, len);
} catch (toolkit::AssertFailedException &ex){
if (!_enableRecvRtp) {
// 还在握手中,直接中断握手
// 还在握手中,直接中断握手 [AUTO-TRANSLATED:19dfdf7a]
// Still in handshake, interrupt handshake directly
throw;
}
// 握手已经结束如果rtsp server存在发送缓存溢出的bug那么rtsp信令可能跟rtp混在一起
// 这种情况下rtsp信令解析异常不中断链接只丢弃这个包
// 握手已经结束如果rtsp server存在发送缓存溢出的bug那么rtsp信令可能跟rtp混在一起 [AUTO-TRANSLATED:56c28270]
// Handshake has ended, if rtsp server has a send buffer overflow bug, then rtsp signaling may be mixed with rtp
// 这种情况下rtsp信令解析异常不中断链接只丢弃这个包 [AUTO-TRANSLATED:93cd60b4]
// In this case, rtsp signaling parsing exception does not interrupt the connection, just discard this packet
WarnL << ex.what();
return 0;
}