tdav_session_video.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file tdav_session_video.h
  23. * @brief Video Session plugin.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango.org>
  26. *
  27. */
  28. #ifndef TINYDAV_SESSION_VIDEO_H
  29. #define TINYDAV_SESSION_VIDEO_H
  30. #include "tinydav_config.h"
  31. #include "tinydav/tdav_session_av.h"
  32. #include "tsk_timer.h"
  33. TDAV_BEGIN_DECLS
  34. typedef enum tdav_session_video_pkt_loss_level_e {
  35. tdav_session_video_pkt_loss_level_low,
  36. tdav_session_video_pkt_loss_level_medium,
  37. tdav_session_video_pkt_loss_level_high,
  38. }
  39. tdav_session_video_pkt_loss_level_t;
  40. typedef struct tdav_session_video_s {
  41. TDAV_DECLARE_SESSION_AV;
  42. struct tdav_video_jb_s* jb;
  43. tsk_bool_t jb_enabled;
  44. tsk_bool_t zero_artifacts;
  45. tsk_bool_t fps_changed;
  46. tsk_bool_t started;
  47. unsigned neg_width;
  48. unsigned neg_height;
  49. struct {
  50. tsk_timer_manager_handle_t* mgr;
  51. tsk_timer_id_t id_qos;
  52. } timer;
  53. struct {
  54. const void* context;
  55. tmedia_session_rtcp_onevent_cb_f func;
  56. } cb_rtcpevent;
  57. struct {
  58. void* buffer;
  59. tsk_size_t buffer_size;
  60. int rotation;
  61. tsk_bool_t scale_rotated_frames;
  62. void* conv_buffer;
  63. tsk_size_t conv_buffer_size;
  64. uint64_t last_frame_time;
  65. tsk_bool_t size_changed;
  66. uint8_t payload_type;
  67. struct tmedia_codec_s* codec;
  68. tsk_mutex_handle_t* h_mutex;
  69. } encoder;
  70. struct {
  71. void* buffer;
  72. tsk_size_t buffer_size;
  73. void* conv_buffer;
  74. tsk_size_t conv_buffer_size;
  75. // latest decoded RTP seqnum
  76. uint16_t last_seqnum;
  77. // stream is corrupted if packets are lost
  78. tsk_bool_t stream_corrupted;
  79. uint64_t stream_corrupted_since;
  80. uint32_t last_corrupted_timestamp;
  81. uint8_t codec_payload_type;
  82. struct tmedia_codec_s* codec;
  83. uint64_t codec_decoded_frames_count;
  84. } decoder;
  85. struct {
  86. tsk_size_t consumerLastWidth;
  87. tsk_size_t consumerLastHeight;
  88. struct tmedia_converter_video_s* fromYUV420;
  89. tsk_size_t producerWidth;
  90. tsk_size_t producerHeight;
  91. tsk_size_t xProducerSize;
  92. struct tmedia_converter_video_s* toYUV420;
  93. } conv;
  94. struct {
  95. tsk_list_t* packets;
  96. tsk_size_t count;
  97. tsk_size_t max;
  98. uint64_t last_fir_time;
  99. uint64_t last_pli_time;
  100. } avpf;
  101. unsigned q1_n;
  102. unsigned q2_n;
  103. unsigned q3_n;
  104. unsigned q4_n;
  105. unsigned q5_n;
  106. unsigned in_avg_fps_n;
  107. unsigned dec_avg_time_n;
  108. unsigned enc_avg_time_n;
  109. tsk_mutex_handle_t* h_mutex_qos;
  110. uint64_t last_sendreport_time;
  111. unsigned num_qavg_down;
  112. float qavg_lowest;
  113. signed num_enc_avg_time_high;
  114. }
  115. tdav_session_video_t;
  116. #define TDAV_SESSION_VIDEO(self) ((tdav_session_video_t*)(self))
  117. TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t;
  118. TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcpvideo_plugin_def_t;
  119. TDAV_END_DECLS
  120. #endif /* TINYDAV_SESSION_VIDEO_H */