rtpmanager: Update codes based on 1.18.4
[platform/upstream/gst-plugins-good.git] / gst / rtpmanager / rtpstats.h
index b8b26ec..776651f 100644 (file)
@@ -27,6 +27,9 @@
 #include <gst/rtp/rtp.h>
 #include <gio/gio.h>
 
+/* UDP/IP is assumed for bandwidth calculation */
+#define UDP_IP_HEADER_OVERHEAD 28
+
 /**
  * RTPSenderReport:
  *
@@ -74,6 +77,10 @@ typedef struct {
  * @seqnum: the seqnum of the packet
  * @pt: the payload type of the packet
  * @rtptime: the RTP time of the packet
+ * @marker: the marker bit
+ *
+ * @tw_seqnum_ext_id: the extension-header ID for transport-wide seqnums
+ * @tw_seqnum: the transport-wide seqnum of the packet
  *
  * Structure holding information about the packet.
  */
@@ -94,8 +101,11 @@ typedef struct {
   guint16       seqnum;
   guint8        pt;
   guint32       rtptime;
+  gboolean      marker;
   guint32       csrc_count;
   guint32       csrcs[16];
+  GBytes        *header_ext;
+  guint16       header_ext_bit_pattern;
 } RTPPacketInfo;
 
 /**
@@ -242,6 +252,27 @@ typedef struct {
   guint         nacks_received;
 } RTPSessionStats;
 
+/**
+ * RTPTWCCStats:
+ *
+ * Stats kept for a session and used to produce TWCC stats.
+ */
+typedef struct {
+  GArray       *packets;
+  GstClockTime window_size;
+  GstClockTime  last_local_ts;
+  GstClockTime  last_remote_ts;
+
+  guint bitrate_sent;
+  guint bitrate_recv;
+  guint packets_sent;
+  guint packets_recv;
+  gfloat packet_loss_pct;
+  GstClockTimeDiff avg_delta_of_delta;
+  gfloat avg_delta_of_delta_change;
+} RTPTWCCStats;
+
+
 void           rtp_stats_init_defaults              (RTPSessionStats *stats);
 
 void           rtp_stats_set_bandwidths             (RTPSessionStats *stats,
@@ -261,4 +292,10 @@ void           rtp_stats_set_min_interval           (RTPSessionStats *stats,
 gboolean __g_socket_address_equal (GSocketAddress *a, GSocketAddress *b);
 gchar * __g_socket_address_to_string (GSocketAddress * addr);
 
+RTPTWCCStats * rtp_twcc_stats_new (void);
+void rtp_twcc_stats_free (RTPTWCCStats * stats);
+GstStructure * rtp_twcc_stats_process_packets (RTPTWCCStats * stats,
+    GArray * twcc_packets);
+GstStructure * rtp_twcc_stats_get_packets_structure (GArray * twcc_packets);
+
 #endif /* __RTP_STATS_H__ */