fix timelatency not take effect and avoid buffer is liner avoid cycle

This commit is contained in:
xiongguangjie
2022-06-05 11:07:42 +08:00
parent 6f05cf803d
commit 62dfed39f7
6 changed files with 290 additions and 120 deletions

29
srt/PacketSendQueue.hpp Normal file
View File

@@ -0,0 +1,29 @@
#ifndef ZLMEDIAKIT_SRT_PACKET_SEND_QUEUE_H
#define ZLMEDIAKIT_SRT_PACKET_SEND_QUEUE_H
#include "Packet.hpp"
#include <algorithm>
#include <list>
#include <memory>
#include <set>
#include <tuple>
#include <utility>
namespace SRT {
class PacketSendQueue {
public:
using Ptr = std::shared_ptr<PacketSendQueue>;
using LostPair = std::pair<uint32_t, uint32_t>;
PacketSendQueue(uint32_t max_size, uint32_t lantency);
~PacketSendQueue() = default;
bool drop(uint32_t num);
bool inputPacket(DataPacket::Ptr pkt);
std::list<DataPacket::Ptr> findPacketBySeq(uint32_t start,uint32_t end);
private:
uint32_t timeLantency();
private:
std::list<DataPacket::Ptr> _pkt_cache;
uint32_t _pkt_cap;
uint32_t _pkt_lantency;
};
} // namespace SRT
#endif // ZLMEDIAKIT_SRT_PACKET_SEND_QUEUE_H