estimator_common.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef __estimator_common_h_
  2. #define __estimator_common_h_
  3. #include <stdint.h>
  4. #include "../common/cf_stream.h"
  5. enum {
  6. kBwNormal = 0,
  7. kBwUnderusing = 1,
  8. kBwOverusing = 2,
  9. };
  10. enum {
  11. kRcHold,
  12. kRcIncrease,
  13. kRcDecrease
  14. };
  15. enum {
  16. kRcNearMax,
  17. kRcAboveMax,
  18. kRcMaxUnknown
  19. };
  20. typedef struct
  21. {
  22. int state;
  23. uint32_t incoming_bitrate;
  24. double noise_var;
  25. }rate_control_input_t;
  26. #define DEFAULT_RTT 200
  27. typedef struct
  28. {
  29. int64_t create_ts; /*创建时间戳*/
  30. int64_t arrival_ts; /*到达时间戳*/
  31. int64_t send_ts; /*发送时间戳*/
  32. uint16_t sequence_number; /*发送通道的报文序号*/
  33. size_t payload_size; /*包数据大小*/
  34. }packet_feedback_t;
  35. #define init_packet_feedback(p) \
  36. do{ \
  37. (p).create_ts = -1; \
  38. (p).arrival_ts = -1; \
  39. (p).send_ts = -1; \
  40. (p).sequence_number = 0;\
  41. (p).payload_size = 0; \
  42. } while (0)
  43. typedef struct
  44. {
  45. uint16_t seq;
  46. int64_t ts;
  47. }feedback_sample_t;
  48. enum
  49. {
  50. remb_msg = 0x01,
  51. loss_info_msg = 0x02,
  52. proxy_ts_msg = 0x04,
  53. };
  54. #define MAX_FEELBACK_COUNT 128
  55. typedef struct
  56. {
  57. uint8_t flag;
  58. /*remb_msg*/
  59. uint32_t remb;
  60. /*loss info msg*/
  61. uint8_t fraction_loss;
  62. int packet_num;
  63. /*proxy_ts_msg*/
  64. int64_t base_seq;
  65. int64_t min_ts;
  66. uint8_t samples_num;
  67. feedback_sample_t samples[MAX_FEELBACK_COUNT];
  68. }feedback_msg_t;
  69. void feedback_msg_encode(bin_stream_t* strm, feedback_msg_t* msg);
  70. void feedback_msg_decode(bin_stream_t* strm, feedback_msg_t* msg);
  71. #endif