mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
add srt config for lantency multiplier
This commit is contained in:
parent
9f357c24b8
commit
83d75c9a72
@ -291,6 +291,9 @@ timeoutSec=5
|
||||
#该端口是多线程的,同时支持客户端网络切换导致的连接迁移
|
||||
port=9000
|
||||
|
||||
#srt 协议中延迟缓存的估算参数,在握手阶段估算rtt ,然后lantencyMul*rtt 为最大缓存时长,此参数越大,表示等待重传的时长就越大
|
||||
lantencyMul=4
|
||||
|
||||
|
||||
[rtsp]
|
||||
#rtsp专有鉴权方式是采用base64还是md5方式
|
||||
|
@ -11,6 +11,8 @@ const std::string kTimeOutSec = SRT_FIELD"timeoutSec";
|
||||
//srt 单端口udp服务器
|
||||
const std::string kPort = SRT_FIELD"port";
|
||||
|
||||
const std::string kLantencyMul = SRT_FIELD"lantencyMul";
|
||||
|
||||
static std::atomic<uint32_t> s_srt_socket_id_generate{125};
|
||||
//////////// SrtTransport //////////////////////////
|
||||
SrtTransport::SrtTransport(const EventPoller::Ptr &poller)
|
||||
@ -155,7 +157,7 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
|
||||
HSExtMessage::Ptr req;
|
||||
HSExtStreamID::Ptr sid;
|
||||
uint32_t srt_flag = 0xbf;
|
||||
uint16_t delay = DurationCountMicroseconds(_now - _induction_ts)*4/1000;
|
||||
uint16_t delay = DurationCountMicroseconds(_now - _induction_ts)*getLantencyMul()/1000;
|
||||
|
||||
for (auto ext : pkt.ext_list) {
|
||||
//TraceL << getIdentifier() << " ext " << ext->dump();
|
||||
@ -210,8 +212,6 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
|
||||
}
|
||||
_last_ack_pkt_seq_num = _init_seq_number;
|
||||
}
|
||||
void SrtTransport::bufCheckInterval(){
|
||||
}
|
||||
void SrtTransport::handleHandshake(uint8_t *buf, int len, struct sockaddr_storage *addr){
|
||||
HandshakePacket pkt;
|
||||
assert(pkt.loadFromData(buf,len));
|
||||
|
@ -21,6 +21,7 @@ using namespace toolkit;
|
||||
|
||||
extern const std::string kPort;
|
||||
extern const std::string kTimeOutSec;
|
||||
extern const std::string kLantencyMul;
|
||||
|
||||
class SrtTransport : public std::enable_shared_from_this<SrtTransport> {
|
||||
public:
|
||||
@ -81,13 +82,14 @@ private:
|
||||
void sendShutDown();
|
||||
void sendMsgDropReq(uint32_t first ,uint32_t last);
|
||||
|
||||
void bufCheckInterval();
|
||||
|
||||
size_t getPayloadSize();
|
||||
protected:
|
||||
void sendDataPacket(DataPacket::Ptr pkt,char* buf,int len,bool flush = false);
|
||||
void sendControlPacket(ControlPacket::Ptr pkt,bool flush = true);
|
||||
virtual void sendPacket(Buffer::Ptr pkt,bool flush = true);
|
||||
virtual int getLantencyMul(){
|
||||
return 4;
|
||||
};
|
||||
private:
|
||||
//当前选中的udp链接
|
||||
Session::Ptr _selected_session;
|
||||
|
@ -273,5 +273,10 @@ void SrtTransportImp::doCachedFunc() {
|
||||
_cached_func.clear();
|
||||
}
|
||||
|
||||
int SrtTransportImp::getLantencyMul(){
|
||||
GET_CONFIG(int, lantencyMul, kLantencyMul);
|
||||
return lantencyMul;
|
||||
}
|
||||
|
||||
|
||||
} // namespace SRT
|
@ -38,6 +38,7 @@ protected:
|
||||
void onHandShakeFinished(std::string& streamid,struct sockaddr_storage *addr) override;
|
||||
void onSRTData(DataPacket::Ptr pkt) override;
|
||||
void onShutdown(const SockException &ex) override;
|
||||
int getLantencyMul() override;
|
||||
|
||||
void sendPacket(Buffer::Ptr pkt,bool flush = true) override{
|
||||
_total_bytes += pkt->size();
|
||||
|
Loading…
Reference in New Issue
Block a user