Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

5 місяці тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef ZLMEDIAKIT_SRT_STATISTIC_H
  2. #define ZLMEDIAKIT_SRT_STATISTIC_H
  3. #include <map>
  4. #include "Common.hpp"
  5. #include "Packet.hpp"
  6. namespace SRT {
  7. class PacketRecvRateContext {
  8. public:
  9. PacketRecvRateContext(TimePoint start);
  10. ~PacketRecvRateContext() = default;
  11. void inputPacket(TimePoint &ts,size_t len = 0);
  12. uint32_t getPacketRecvRate(uint32_t& bytesps);
  13. std::string dump();
  14. static const int SIZE = 16;
  15. private:
  16. TimePoint _last_arrive_time;
  17. int64_t _ts_arr[SIZE];
  18. size_t _size_arr[SIZE];
  19. size_t _cur_idx;
  20. //std::map<int64_t, int64_t> _pkt_map;
  21. };
  22. class EstimatedLinkCapacityContext {
  23. public:
  24. EstimatedLinkCapacityContext(TimePoint start);
  25. ~EstimatedLinkCapacityContext() = default;
  26. void setLastSeq(uint32_t seq){
  27. _last_seq = seq;
  28. }
  29. void inputPacket(TimePoint &ts,DataPacket::Ptr& pkt);
  30. uint32_t getEstimatedLinkCapacity();
  31. static const int SIZE = 64;
  32. private:
  33. void probe1Arrival(TimePoint &ts,const DataPacket::Ptr& pkt, bool unordered);
  34. void probe2Arrival(TimePoint &ts,const DataPacket::Ptr& pkt);
  35. private:
  36. TimePoint _start;
  37. TimePoint _ts_probe_time;
  38. int64_t _dur_probe_arr[SIZE];
  39. size_t _cur_idx;
  40. uint32_t _last_seq = 0;
  41. uint32_t _probe1_seq = SEQ_NONE;
  42. //std::map<int64_t, int64_t> _pkt_map;
  43. };
  44. /*
  45. class RecvRateContext {
  46. public:
  47. RecvRateContext(TimePoint start)
  48. : _start(start) {};
  49. ~RecvRateContext() = default;
  50. void inputPacket(TimePoint &ts, size_t size);
  51. uint32_t getRecvRate();
  52. private:
  53. TimePoint _start;
  54. std::map<int64_t, size_t> _pkt_map;
  55. };
  56. */
  57. } // namespace SRT
  58. #endif // ZLMEDIAKIT_SRT_STATISTIC_H