diff --git a/srt/HSExt.cpp b/srt/HSExt.cpp index 20a5b89c..ab4d4ff2 100644 --- a/srt/HSExt.cpp +++ b/srt/HSExt.cpp @@ -81,7 +81,9 @@ bool HSExtStreamID::loadFromData(uint8_t *buf, size_t len) { ptr+=4; } char zero = 0x00; - streamid.erase(streamid.find_first_of(zero),streamid.size()); + if(streamid.back() == zero){ + streamid.erase(streamid.find_first_of(zero),streamid.size()); + } return true; } diff --git a/srt/SrtSession.cpp b/srt/SrtSession.cpp index 47b0b11f..17a2eff0 100644 --- a/srt/SrtSession.cpp +++ b/srt/SrtSession.cpp @@ -10,7 +10,10 @@ using namespace mediakit; SrtSession::SrtSession(const Socket::Ptr &sock) : UdpSession(sock) { socklen_t addr_len = sizeof(_peer_addr); + memset(&_peer_addr,0,addr_len); + TraceL<<"before addr len "<rawFD(), (struct sockaddr *)&_peer_addr, &addr_len); + TraceL<<"after addr len "< +#include "Util/onceToken.h" #include "SrtTransport.hpp" #include "Packet.hpp" @@ -297,7 +298,7 @@ void SrtTransport::handleACKACK(uint8_t *buf, int len, struct sockaddr_storage * pkt->loadFromData(buf,len); uint32_t rtt = DurationCountMicroseconds(_now - _ack_send_timestamp[pkt->ack_number]); - _rtt_variance = (3*_rtt_variance+abs(_rtt - rtt))/4; + _rtt_variance = (3*_rtt_variance+abs((long)(_rtt - rtt)))/4; _rtt = (7*rtt+_rtt)/8; _ack_send_timestamp.erase(pkt->ack_number);