Compare commits

...

5 Commits

Author SHA1 Message Date
alex
3caeda27f1
Merge 90bd28249e into 87277ac91a 2024-09-28 10:14:40 +08:00
xiongguangjie
87277ac91a
Optimaztion code for srt (#3934)
Some checks are pending
Android / build (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Docker / build (push) Waiting to run
Linux / build (push) Waiting to run
macOS / build (push) Waiting to run
Windows / build (push) Waiting to run
2024-09-28 10:11:39 +08:00
alex
90bd28249e Translate comments in src/Common/MediaSink.cpp 2024-09-21 09:44:57 +08:00
alex
c3106d514a Translate comments in src/Common/MediaSink.cpp 2024-09-21 09:26:48 +08:00
alex
f03d414e82 Translate comments in src/Common/MediaSink.cpp 2024-09-21 09:26:17 +08:00
3 changed files with 11 additions and 9 deletions

View File

@ -114,12 +114,14 @@ void MediaSink::checkTrackIfReady() {
}
}
// 等待音频超时时间
// 等待音频超时时间 [AUTO-TRANSLATED:5ec16b26]
// Wait for audio timeout time
GET_CONFIG(uint32_t, kWaitAudioTrackDataMS, General::kWaitAudioTrackDataMS);
if (_max_track_size > 1) {
for (auto it = _track_map.begin(); it != _track_map.end();) {
if (it->second.first->getTrackType() == TrackAudio && _ticker.elapsedTime() > kWaitAudioTrackDataMS && !it->second.second) {
// 音频超时且完全没收到音频数据,忽略音频
// 音频超时且完全没收到音频数据,忽略音频 [AUTO-TRANSLATED:0d0fbb13]
// Audio timeout and did not receive any audio data, ignore audio
auto index = it->second.first->getIndex();
WarnL << "Audio track index " << index << " codec " << it->second.first->getCodecName() << " receive no data for long "
<< _ticker.elapsedTime() << "ms. Ignore it!";

View File

@ -292,8 +292,8 @@ bool HandshakePacket::loadFromData(uint8_t *buf, size_t len) {
syn_cookie = loadUint32(ptr);
ptr += 4;
memcpy(peer_ip_addr, ptr, sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]));
ptr += sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]);
memcpy(peer_ip_addr, ptr, sizeof(peer_ip_addr));
ptr += sizeof(peer_ip_addr);
if (encryption_field != NO_ENCRYPTION) {
ErrorL << "not support encryption " << encryption_field;
@ -400,8 +400,8 @@ bool HandshakePacket::storeToData() {
storeUint32(ptr, syn_cookie);
ptr += 4;
memcpy(ptr, peer_ip_addr, sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]));
ptr += sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]);
memcpy(ptr, peer_ip_addr, sizeof(peer_ip_addr));
ptr += sizeof(peer_ip_addr);
if (encryption_field != NO_ENCRYPTION) {
ErrorL << "not support encryption " << encryption_field;
@ -433,7 +433,7 @@ uint32_t HandshakePacket::getSynCookie(uint8_t *buf, size_t len) {
}
void HandshakePacket::assignPeerIP(struct sockaddr_storage *addr) {
memset(peer_ip_addr, 0, sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]));
memset(peer_ip_addr, 0, sizeof(peer_ip_addr));
if (addr->ss_family == AF_INET) {
struct sockaddr_in *ipv4 = (struct sockaddr_in *)addr;
// 抓包 奇怪好像是小头端??? [AUTO-TRANSLATED:40eb164c]
@ -446,7 +446,7 @@ void HandshakePacket::assignPeerIP(struct sockaddr_storage *addr) {
storeUint32LE(peer_ip_addr, addr4.s_addr);
} else {
const sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)addr;
memcpy(peer_ip_addr, ipv6->sin6_addr.s6_addr, sizeof(peer_ip_addr) * sizeof(peer_ip_addr[0]));
memcpy(peer_ip_addr, ipv6->sin6_addr.s6_addr, sizeof(peer_ip_addr));
}
}
}

View File

@ -206,7 +206,7 @@ void SrtTransport::handleHandshakeInduction(HandshakePacket &pkt, struct sockadd
res->srt_socket_id = _peer_socket_id;
res->syn_cookie = HandshakePacket::generateSynCookie(addr, _start_timestamp);
_sync_cookie = res->syn_cookie;
memcpy(res->peer_ip_addr, pkt.peer_ip_addr, sizeof(pkt.peer_ip_addr) * sizeof(pkt.peer_ip_addr[0]));
memcpy(res->peer_ip_addr, pkt.peer_ip_addr, sizeof(pkt.peer_ip_addr));
_handleshake_res = res;
res->storeToData();