mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-03 00:47:34 +08:00
format code and remove some useless code
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#ifndef ZLMEDIAKIT_SRT_TRANSPORT_H
|
||||
#define ZLMEDIAKIT_SRT_TRANSPORT_H
|
||||
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
#include "Network/Session.h"
|
||||
#include "Poller/EventPoller.h"
|
||||
@@ -43,26 +43,25 @@ public:
|
||||
virtual void onSendTSData(const Buffer::Ptr &buffer, bool flush);
|
||||
|
||||
std::string getIdentifier();
|
||||
|
||||
|
||||
void unregisterSelfHandshake();
|
||||
void unregisterSelf();
|
||||
|
||||
protected:
|
||||
virtual void onHandShakeFinished(std::string& streamid,struct sockaddr_storage *addr){};
|
||||
virtual void onSRTData(DataPacket::Ptr pkt){};
|
||||
virtual void onHandShakeFinished(std::string &streamid, struct sockaddr_storage *addr) {};
|
||||
virtual void onSRTData(DataPacket::Ptr pkt) {};
|
||||
virtual void onShutdown(const SockException &ex);
|
||||
virtual bool isPusher(){
|
||||
return true;
|
||||
};
|
||||
virtual bool isPusher() { return true; };
|
||||
|
||||
private:
|
||||
void registerSelfHandshake();
|
||||
void registerSelf();
|
||||
|
||||
void switchToOtherTransport(uint8_t *buf, int len,uint32_t socketid, struct sockaddr_storage *addr);
|
||||
void switchToOtherTransport(uint8_t *buf, int len, uint32_t socketid, struct sockaddr_storage *addr);
|
||||
|
||||
void handleHandshake(uint8_t *buf, int len, struct sockaddr_storage *addr);
|
||||
void handleHandshakeInduction(HandshakePacket& pkt,struct sockaddr_storage *addr);
|
||||
void handleHandshakeConclusion(HandshakePacket& pkt,struct sockaddr_storage *addr);
|
||||
void handleHandshakeInduction(HandshakePacket &pkt, struct sockaddr_storage *addr);
|
||||
void handleHandshakeConclusion(HandshakePacket &pkt, struct sockaddr_storage *addr);
|
||||
|
||||
void handleKeeplive(uint8_t *buf, int len, struct sockaddr_storage *addr);
|
||||
void handleACK(uint8_t *buf, int len, struct sockaddr_storage *addr);
|
||||
@@ -74,27 +73,27 @@ private:
|
||||
void handleUserDefinedType(uint8_t *buf, int len, struct sockaddr_storage *addr);
|
||||
void handlePeerError(uint8_t *buf, int len, struct sockaddr_storage *addr);
|
||||
void handleDataPacket(uint8_t *buf, int len, struct sockaddr_storage *addr);
|
||||
|
||||
void sendNAKPacket(std::list<PacketQueue::LostPair>& lost_list);
|
||||
|
||||
void sendNAKPacket(std::list<PacketQueue::LostPair> &lost_list);
|
||||
void sendACKPacket();
|
||||
void sendLightACKPacket();
|
||||
void sendKeepLivePacket();
|
||||
void sendShutDown();
|
||||
void sendMsgDropReq(uint32_t first ,uint32_t last);
|
||||
void sendMsgDropReq(uint32_t first, uint32_t last);
|
||||
|
||||
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;
|
||||
};
|
||||
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;
|
||||
//链接迁移前后使用过的udp链接
|
||||
std::unordered_map<Session *, std::weak_ptr<Session> > _history_sessions;
|
||||
std::unordered_map<Session *, std::weak_ptr<Session>> _history_sessions;
|
||||
|
||||
EventPoller::Ptr _poller;
|
||||
|
||||
@@ -109,7 +108,7 @@ private:
|
||||
|
||||
uint32_t _mtu = 1500;
|
||||
uint32_t _max_window_size = 8192;
|
||||
uint32_t _init_seq_number = 0;
|
||||
uint32_t _init_seq_number = 0;
|
||||
|
||||
std::string _stream_id;
|
||||
uint32_t _sync_cookie = 0;
|
||||
@@ -119,13 +118,13 @@ private:
|
||||
PacketSendQueue::Ptr _send_buf;
|
||||
uint32_t _buf_delay = 120;
|
||||
PacketQueue::Ptr _recv_buf;
|
||||
uint32_t _rtt = 100*1000;
|
||||
uint32_t _rtt_variance =50*1000;
|
||||
uint32_t _rtt = 100 * 1000;
|
||||
uint32_t _rtt_variance = 50 * 1000;
|
||||
uint32_t _light_ack_pkt_count = 0;
|
||||
uint32_t _ack_number_count = 0;
|
||||
uint32_t _last_ack_pkt_seq_num = 0;
|
||||
UTicker _ack_ticker;
|
||||
std::map<uint32_t,TimePoint> _ack_send_timestamp;
|
||||
std::map<uint32_t, TimePoint> _ack_send_timestamp;
|
||||
|
||||
std::shared_ptr<PacketRecvRateContext> _pkt_recv_rate_context;
|
||||
std::shared_ptr<EstimatedLinkCapacityContext> _estimated_link_capacity_context;
|
||||
@@ -137,7 +136,6 @@ private:
|
||||
HandshakePacket::Ptr _handleshake_res;
|
||||
|
||||
ResourcePool<BufferRaw> _packet_pool;
|
||||
|
||||
};
|
||||
|
||||
class SrtTransportManager {
|
||||
@@ -150,6 +148,7 @@ public:
|
||||
void addHandshakeItem(const std::string &key, const SrtTransport::Ptr &ptr);
|
||||
void removeHandshakeItem(const std::string &key);
|
||||
SrtTransport::Ptr getHandshakeItem(const std::string &key);
|
||||
|
||||
private:
|
||||
SrtTransportManager() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user