From 92420f8392c957f8672fbc2e1248229fb61b91a0 Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Sat, 4 Jun 2022 13:30:59 +0800 Subject: [PATCH] check stream id --- srt/SrtTransport.cpp | 16 +++++++++++----- srt/SrtTransportImp.cpp | 8 +++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/srt/SrtTransport.cpp b/srt/SrtTransport.cpp index 082cdb8f..619c6377 100644 --- a/srt/SrtTransport.cpp +++ b/srt/SrtTransport.cpp @@ -153,6 +153,8 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad // first HSExtMessage::Ptr req; HSExtStreamID::Ptr sid; + uint32_t srt_flag = 0xbf; + uint16_t delay = 120; for (auto ext : pkt.ext_list) { //TraceL << getIdentifier() << " ext " << ext->dump(); @@ -166,6 +168,10 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad if(sid){ _stream_id = sid->streamid; } + if(req){ + srt_flag = req->srt_flag; + delay = req->recv_tsbpd_delay; + } TraceL << getIdentifier() << " CONCLUSION Phase "; HandshakePacket::Ptr res = std::make_shared(); res->dst_socket_id = _peer_socket_id; @@ -183,17 +189,17 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad HSExtMessage::Ptr ext = std::make_shared(); ext->extension_type = HSExt::SRT_CMD_HSRSP; ext->srt_version = srtVersion(1, 5, 0); - ext->srt_flag = req->srt_flag; - ext->recv_tsbpd_delay = ext->send_tsbpd_delay = req->recv_tsbpd_delay; + ext->srt_flag = srt_flag; + ext->recv_tsbpd_delay = ext->send_tsbpd_delay = delay; res->ext_list.push_back(std::move(ext)); res->storeToData(); _handleshake_res = res; unregisterSelfHandshake(); registerSelf(); sendControlPacket(res, true); - TraceL<<" buf size = "<max_flow_window_size<<" init seq ="<<_init_seq_number<<" lantency="<recv_tsbpd_delay; - _recv_buf = std::make_shared(res->max_flow_window_size,_init_seq_number, req->recv_tsbpd_delay*1e6); - _send_buf = std::make_shared(res->max_flow_window_size,_init_seq_number, req->recv_tsbpd_delay*1e6); + TraceL<<" buf size = "<max_flow_window_size<<" init seq ="<<_init_seq_number<<" lantency="<(res->max_flow_window_size,_init_seq_number, delay*1e6); + _send_buf = std::make_shared(res->max_flow_window_size,_init_seq_number, delay*1e6); _send_packet_seq_number = _init_seq_number; onHandShakeFinished(_stream_id,addr); } else { diff --git a/srt/SrtTransportImp.cpp b/srt/SrtTransportImp.cpp index b5d72344..5bae174a 100644 --- a/srt/SrtTransportImp.cpp +++ b/srt/SrtTransportImp.cpp @@ -25,10 +25,16 @@ SrtTransportImp::~SrtTransportImp() { void SrtTransportImp::onHandShakeFinished(std::string &streamid,struct sockaddr_storage *addr) { - // TODO parse streamid like this zlmediakit.com/live/test?token=1213444&type=pusher + // TODO parse streamid like this zlmediakit.com/live/test?token=1213444&type=push if(!_addr){ _addr.reset(new sockaddr_storage(*((sockaddr_storage *)addr))); } + _is_pusher = false; + TraceL<<" stream id "<