summaryrefslogtreecommitdiff
path: root/gst/rtpmanager/rtptwcc.h
blob: bb14dbad28655ec6d77e72edc9e6798e22c006e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* GStreamer
 * Copyright (C) 2019 Pexip (http://pexip.com/)
 *   @author: Havard Graff <havard@pexip.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __RTP_TWCC_H__
#define __RTP_TWCC_H__

#include <gst/gst.h>
#include <gst/rtp/rtp.h>
#include "rtpstats.h"

typedef struct _RTPTWCCPacket RTPTWCCPacket;
typedef enum _RTPTWCCPacketStatus RTPTWCCPacketStatus;

G_DECLARE_FINAL_TYPE (RTPTWCCManager, rtp_twcc_manager, RTP, TWCC_MANAGER, GObject)
#define RTP_TYPE_TWCC_MANAGER (rtp_twcc_manager_get_type())
#define RTP_TWCC_MANAGER_CAST(obj) ((RTPTWCCManager *)(obj))

enum _RTPTWCCPacketStatus
{
  RTP_TWCC_PACKET_STATUS_NOT_RECV = 0,
  RTP_TWCC_PACKET_STATUS_SMALL_DELTA = 1,
  RTP_TWCC_PACKET_STATUS_LARGE_NEGATIVE_DELTA = 2,
};

struct _RTPTWCCPacket
{
  GstClockTime local_ts;
  GstClockTime remote_ts;
  GstClockTimeDiff local_delta;
  GstClockTimeDiff remote_delta;
  GstClockTimeDiff delta_delta;
  RTPTWCCPacketStatus status;
  guint16 seqnum;
  guint size;
};

RTPTWCCManager * rtp_twcc_manager_new (guint mtu);

void rtp_twcc_manager_set_mtu (RTPTWCCManager * twcc, guint mtu);
void rtp_twcc_manager_set_feedback_interval (RTPTWCCManager * twcc,
    GstClockTime feedback_interval);
GstClockTime rtp_twcc_manager_get_feedback_interval (RTPTWCCManager * twcc);

gboolean rtp_twcc_manager_recv_packet (RTPTWCCManager * twcc,
    guint16 seqnum, RTPPacketInfo * pinfo);

void rtp_twcc_manager_send_packet (RTPTWCCManager * twcc,
    guint16 seqnum, RTPPacketInfo * pinfo);

GstBuffer * rtp_twcc_manager_get_feedback (RTPTWCCManager * twcc,
    guint32 sender_ssrc);

GArray * rtp_twcc_manager_parse_fci (RTPTWCCManager * twcc,
    guint8 * fci_data, guint fci_length);

#endif /* __RTP_TWCC_H__ */