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 guint8 pt; 53 }; 54 55 RTPTWCCManager * rtp_twcc_manager_new (guint mtu); 56 57 void rtp_twcc_manager_parse_recv_ext_id (RTPTWCCManager * twcc, 58 const GstStructure * s); 59 void rtp_twcc_manager_parse_send_ext_id (RTPTWCCManager * twcc, 60 const GstStructure * s); 61 62 void rtp_twcc_manager_set_mtu (RTPTWCCManager * twcc, guint mtu); 63 void rtp_twcc_manager_set_feedback_interval (RTPTWCCManager * twcc, 64 GstClockTime feedback_interval); 65 GstClockTime rtp_twcc_manager_get_feedback_interval (RTPTWCCManager * twcc); 66 67 gboolean rtp_twcc_manager_recv_packet (RTPTWCCManager * twcc, 68 RTPPacketInfo * pinfo); 69 void rtp_twcc_manager_send_packet (RTPTWCCManager * twcc, 70 RTPPacketInfo * pinfo); 71 72 GstBuffer * rtp_twcc_manager_get_feedback (RTPTWCCManager * twcc, 73 guint32 sender_ssrc); 74 75 GArray * rtp_twcc_manager_parse_fci (RTPTWCCManager * twcc, 76 guint8 * fci_data, guint fci_length); 77 78 #endif /* __RTP_TWCC_H__ */ 79