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

@@ -68,7 +68,8 @@ void NackContext::drop(uint32_t seq) {
for (auto it = _nack_map.begin(); it != _nack_map.end();) {
if (!is_cycle) {
// 不回环
// 不回环 [AUTO-TRANSLATED:abe3c07b]
// No loop
if (it->first <= seq) {
it = _nack_map.erase(it);
} else {

View File

@@ -436,7 +436,8 @@ void HandshakePacket::assignPeerIP(struct sockaddr_storage *addr) {
memset(peer_ip_addr, 0, sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]));
if (addr->ss_family == AF_INET) {
struct sockaddr_in *ipv4 = (struct sockaddr_in *)addr;
// 抓包 奇怪好像是小头端???
// 抓包 奇怪好像是小头端??? [AUTO-TRANSLATED:40eb164c]
// Packet capture, weird, seems to be from the client side
storeUint32LE(peer_ip_addr, ipv4->sin_addr.s_addr);
} else if (addr->ss_family == AF_INET6) {
if (IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)addr)->sin6_addr)) {

View File

@@ -78,7 +78,8 @@ bool PacketQueue::inputPacket(DataPacket::Ptr pkt, std::list<DataPacket::Ptr> &o
}
while (_pkt_map.size() > _pkt_cap) {
// 防止回环
// 防止回环 [AUTO-TRANSLATED:5999c704]
// Prevent circular references
it = _pkt_map.find(_pkt_expected_seq);
if (it != _pkt_map.end()) {
out.push_back(it->second);

View File

@@ -32,7 +32,8 @@ void SrtSession::onRecv(const Buffer::Ptr &buffer) {
size_t size = buffer->size();
if (_find_transport) {
//只允许寻找一次transport
// 只允许寻找一次transport [AUTO-TRANSLATED:620078e7]
// Only allow finding transport once
_find_transport = false;
_transport = querySrtTransport(data, size, getPoller());
if (_transport) {
@@ -50,20 +51,25 @@ void SrtSession::onRecv(const Buffer::Ptr &buffer) {
}
void SrtSession::onError(const SockException &err) {
// udp链接超时但是srt链接不一定超时因为可能存在udp链接迁移的情况
//在udp链接迁移时新的SrtSession对象将接管SrtSession对象的生命周期
//本SrtSession对象将在超时后自动销毁
// udp链接超时但是srt链接不一定超时因为可能存在udp链接迁移的情况 [AUTO-TRANSLATED:8673c03c]
// UDP connection timed out, but SRT connection may not time out due to possible UDP connection migration
// 在udp链接迁移时新的SrtSession对象将接管SrtSession对象的生命周期 [AUTO-TRANSLATED:13f0a9e6]
// When UDP connection migrates, a new SrtSession object will take over the lifecycle of the SrtSession object
// 本SrtSession对象将在超时后自动销毁 [AUTO-TRANSLATED:d0a34ab8]
// This SrtSession object will be automatically destroyed after timeout
WarnP(this) << err;
if (!_transport) {
return;
}
// 防止互相引用导致不释放
// 防止互相引用导致不释放 [AUTO-TRANSLATED:82547e46]
// Prevent mutual reference from causing non-release
auto transport = std::move(_transport);
getPoller()->async(
[transport] {
//延时减引用防止使用transport对象时销毁对象
// 延时减引用防止使用transport对象时销毁对象 [AUTO-TRANSLATED:09dd6609]
// Delayed dereference to prevent object destruction when using the transport object
//transport->onShutdown(err);
},
false);

View File

@@ -10,9 +10,11 @@
namespace SRT {
#define SRT_FIELD "srt."
// srt 超时时间
// srt 超时时间 [AUTO-TRANSLATED:7828ddb5]
// SRT timeout time
const std::string kTimeOutSec = SRT_FIELD "timeoutSec";
// srt 单端口udp服务器
// srt 单端口udp服务器 [AUTO-TRANSLATED:af5210db]
// SRT single-port UDP server
const std::string kPort = SRT_FIELD "port";
const std::string kLatencyMul = SRT_FIELD "latencyMul";
const std::string kPktBufSize = SRT_FIELD "pktBufSize";
@@ -107,7 +109,8 @@ void SrtTransport::inputSockData(uint8_t *buf, int len, struct sockaddr_storage
s_control_functions.emplace(ControlPacket::USERDEFINEDTYPE, &SrtTransport::handleUserDefinedType);
});
_now = SteadyClock::now();
// 处理srt数据
// 处理srt数据 [AUTO-TRANSLATED:b8b065b8]
// Handling SRT data
if (DataPacket::isDataPacket(buf, len)) {
uint32_t socketId = DataPacket::getSocketID(buf, len);
if (socketId == _socket_id) {
@@ -492,7 +495,8 @@ void SrtTransport::handleACKACK(uint8_t *buf, int len, struct sockaddr_storage *
// clear data
for(auto it = _ack_send_timestamp.begin(); it != _ack_send_timestamp.end();){
if(DurationCountMicroseconds(_now-it->second)>5e6){
// 超过五秒没有ackack 丢弃
// 超过五秒没有ackack 丢弃 [AUTO-TRANSLATED:9626442f]
// Discard if no ACK for more than five seconds
it = _ack_send_timestamp.erase(it);
}else{
it++;