ZLMediaKit/srt/PacketSendQueue.hpp

38 lines
889 B
C++
Raw Normal View History

#ifndef ZLMEDIAKIT_SRT_PACKET_SEND_QUEUE_H
#define ZLMEDIAKIT_SRT_PACKET_SEND_QUEUE_H
2022-06-07 09:52:20 +08:00
#include "Packet.hpp"
#include <algorithm>
#include <list>
#include <memory>
#include <set>
#include <tuple>
#include <utility>
2022-06-07 09:52:20 +08:00
namespace SRT {
2022-06-07 09:52:20 +08:00
class PacketSendQueue {
public:
using Ptr = std::shared_ptr<PacketSendQueue>;
using LostPair = std::pair<uint32_t, uint32_t>;
2022-06-07 09:52:20 +08:00
2022-06-18 13:01:04 +08:00
PacketSendQueue(uint32_t max_size, uint32_t latency,uint32_t flag = 0xbf);
~PacketSendQueue() = default;
2022-06-07 09:52:20 +08:00
bool drop(uint32_t num);
bool inputPacket(DataPacket::Ptr pkt);
2022-06-07 09:52:20 +08:00
std::list<DataPacket::Ptr> findPacketBySeq(uint32_t start, uint32_t end);
private:
2022-06-07 09:52:20 +08:00
uint32_t timeLatency();
2022-06-18 13:01:04 +08:00
bool TLPKTDrop();
private:
2022-06-18 13:01:04 +08:00
uint32_t _srt_flag;
uint32_t _pkt_cap;
2022-06-07 09:52:20 +08:00
uint32_t _pkt_latency;
std::list<DataPacket::Ptr> _pkt_cache;
};
2022-06-07 09:52:20 +08:00
} // namespace SRT
#endif // ZLMEDIAKIT_SRT_PACKET_SEND_QUEUE_H