X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=reorderer.h;h=622083e0563da0f968161e98654f144cc2666fd1;hb=0d7a8406547587b7b1adad9374b4f4985f49dd84;hp=476093fc5e8e136d9fc4d3008d5f6eb81e82e489;hpb=7c67b21504e7758f4148386befc8cd80455a1a85;p=greproxy diff --git a/reorderer.h b/reorderer.h index 476093f..622083e 100644 --- a/reorderer.h +++ b/reorderer.h @@ -1,7 +1,9 @@ #ifndef _REORDERER_H #define _REORDERER_H 1 +#include #include +#include #include #include @@ -9,28 +11,31 @@ #include #include -class Protocol; +#include "protocol.h" struct GREPacket { int seq; uint16_t proto; std::string data; + timeval ts; bool operator> (const GREPacket &other) const { return seq > other.seq; } }; -class Reorderer { +class Reorderer : public Sender { public: - Reorderer(Protocol* sender); - void handle_packet(uint16_t proto, const std::string& data, int seq); + Reorderer(Sender* sender); + void send_packet(uint16_t proto, const std::string& data, int seq); + void possibly_adjust_tv(timeval *tv); private: - void send_packet(uint16_t proto, const std::string &data, bool silence); + void check_ts_discontinuity(uint16_t proto, const std::string &data, bool silence); - Protocol* sender; + Sender* sender; int last_seq; + timeval last_sent_packet; std::priority_queue, std::greater> packet_buffer; std::map ccs;