mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
add srt recv and send packet buf size
This commit is contained in:
parent
f8373302d0
commit
4b9f789c79
@ -294,6 +294,9 @@ port=9000
|
||||
#srt 协议中延迟缓存的估算参数,在握手阶段估算rtt ,然后latencyMul*rtt 为最大缓存时长,此参数越大,表示等待重传的时长就越大
|
||||
latencyMul=4
|
||||
|
||||
#包缓存的大小
|
||||
pktBufSize=8192
|
||||
|
||||
|
||||
[rtsp]
|
||||
#rtsp专有鉴权方式是采用base64还是md5方式
|
||||
|
@ -12,6 +12,7 @@ const std::string kTimeOutSec = SRT_FIELD "timeoutSec";
|
||||
// srt 单端口udp服务器
|
||||
const std::string kPort = SRT_FIELD "port";
|
||||
const std::string kLatencyMul = SRT_FIELD "latencyMul";
|
||||
const std::string kPktBufSize = SRT_FIELD "pktBufSize";
|
||||
|
||||
static std::atomic<uint32_t> s_srt_socket_id_generate { 125 };
|
||||
//////////// SrtTransport //////////////////////////
|
||||
@ -207,8 +208,8 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
|
||||
sendControlPacket(res, true);
|
||||
TraceL << " buf size = " << res->max_flow_window_size << " init seq =" << _init_seq_number
|
||||
<< " latency=" << delay;
|
||||
_recv_buf = std::make_shared<PacketQueue>(res->max_flow_window_size, _init_seq_number, delay * 1e3);
|
||||
_send_buf = std::make_shared<PacketSendQueue>(res->max_flow_window_size, delay * 1e3);
|
||||
_recv_buf = std::make_shared<PacketQueue>(getPktBufSize(), _init_seq_number, delay * 1e3);
|
||||
_send_buf = std::make_shared<PacketSendQueue>(getPktBufSize(), delay * 1e3);
|
||||
_send_packet_seq_number = _init_seq_number;
|
||||
_buf_delay = delay;
|
||||
onHandShakeFinished(_stream_id, addr);
|
||||
|
@ -23,6 +23,7 @@ using namespace toolkit;
|
||||
extern const std::string kPort;
|
||||
extern const std::string kTimeOutSec;
|
||||
extern const std::string kLatencyMul;
|
||||
extern const std::string kPktBufSize;
|
||||
|
||||
class SrtTransport : public std::enable_shared_from_this<SrtTransport> {
|
||||
public:
|
||||
@ -55,6 +56,7 @@ protected:
|
||||
virtual void onHandShakeFinished(std::string &streamid, struct sockaddr_storage *addr) {};
|
||||
virtual void sendPacket(Buffer::Ptr pkt, bool flush = true);
|
||||
virtual int getLatencyMul() { return 4; };
|
||||
virtual int getPktBufSize() { return 8192; };
|
||||
|
||||
private:
|
||||
void registerSelf();
|
||||
|
@ -326,4 +326,10 @@ int SrtTransportImp::getLatencyMul() {
|
||||
return latencyMul;
|
||||
}
|
||||
|
||||
int SrtTransportImp::getPktBufSize() {
|
||||
// kPktBufSize
|
||||
GET_CONFIG(int, pktBufSize, kPktBufSize);
|
||||
return pktBufSize;
|
||||
}
|
||||
|
||||
} // namespace SRT
|
@ -36,6 +36,7 @@ public:
|
||||
protected:
|
||||
///////SrtTransport override///////
|
||||
int getLatencyMul() override;
|
||||
int getPktBufSize() override;
|
||||
void onSRTData(DataPacket::Ptr pkt) override;
|
||||
void onShutdown(const SockException &ex) override;
|
||||
void onHandShakeFinished(std::string &streamid, struct sockaddr_storage *addr) override;
|
||||
|
Loading…
Reference in New Issue
Block a user