fix streamid zero error

This commit is contained in:
xiongguangjie 2022-06-04 12:03:56 +08:00
parent 91aa9c494c
commit af9bd2dd0a
3 changed files with 9 additions and 3 deletions

View File

@ -81,7 +81,9 @@ bool HSExtStreamID::loadFromData(uint8_t *buf, size_t len) {
ptr+=4;
}
char zero = 0x00;
if(streamid.back() == zero){
streamid.erase(streamid.find_first_of(zero),streamid.size());
}
return true;
}

View File

@ -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 "<<addr_len;
getpeername(sock->rawFD(), (struct sockaddr *)&_peer_addr, &addr_len);
TraceL<<"after addr len "<<addr_len<<" family "<<_peer_addr.ss_family;
}
SrtSession::~SrtSession() {

View File

@ -1,4 +1,5 @@
#include "Util/onceToken.h"
#include <stdlib.h>
#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);