rtpmanager: Update codes based on 1.18.4
[platform/upstream/gst-plugins-good.git] / gst / rtpmanager / rtptwcc.h
1 /* GStreamer
2  * Copyright (C) 2019 Pexip (http://pexip.com/)
3  *   @author: Havard Graff <havard@pexip.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef __RTP_TWCC_H__
22 #define __RTP_TWCC_H__
23
24 #include <gst/gst.h>
25 #include <gst/rtp/rtp.h>
26 #include "rtpstats.h"
27
28 typedef struct _RTPTWCCPacket RTPTWCCPacket;
29 typedef enum _RTPTWCCPacketStatus RTPTWCCPacketStatus;
30
31 G_DECLARE_FINAL_TYPE (RTPTWCCManager, rtp_twcc_manager, RTP, TWCC_MANAGER, GObject)
32 #define RTP_TYPE_TWCC_MANAGER (rtp_twcc_manager_get_type())
33 #define RTP_TWCC_MANAGER_CAST(obj) ((RTPTWCCManager *)(obj))
34
35 enum _RTPTWCCPacketStatus
36 {
37   RTP_TWCC_PACKET_STATUS_NOT_RECV = 0,
38   RTP_TWCC_PACKET_STATUS_SMALL_DELTA = 1,
39   RTP_TWCC_PACKET_STATUS_LARGE_NEGATIVE_DELTA = 2,
40 };
41
42 struct _RTPTWCCPacket
43 {
44   GstClockTime local_ts;
45   GstClockTime remote_ts;
46   GstClockTimeDiff local_delta;
47   GstClockTimeDiff remote_delta;
48   GstClockTimeDiff delta_delta;
49   RTPTWCCPacketStatus status;
50   guint16 seqnum;
51   guint size;
52 };
53
54 RTPTWCCManager * rtp_twcc_manager_new (guint mtu);
55
56 void rtp_twcc_manager_set_mtu (RTPTWCCManager * twcc, guint mtu);
57
58 gboolean rtp_twcc_manager_recv_packet (RTPTWCCManager * twcc,
59     guint16 seqnum, RTPPacketInfo * pinfo);
60
61 void rtp_twcc_manager_send_packet (RTPTWCCManager * twcc,
62     guint16 seqnum, RTPPacketInfo * pinfo);
63 void rtp_twcc_manager_set_send_packet_ts (RTPTWCCManager * twcc,
64     guint packet_id, GstClockTime ts);
65
66 GstBuffer * rtp_twcc_manager_get_feedback (RTPTWCCManager * twcc,
67     guint32 sender_ssrc);
68
69 GArray * rtp_twcc_manager_parse_fci (RTPTWCCManager * twcc,
70     guint8 * fci_data, guint fci_length);
71
72 #endif /* __RTP_TWCC_H__ */