1 /* GStreamer plugin for forward error correction
2  * Copyright (C) 2017 Pexip
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Author: Mikhail Fludkov <misha@pexip.com>
19  */
20 
21 #ifndef __GST_RTP_ULPFEC_DEC_H__
22 #define __GST_RTP_ULPFEC_DEC_H__
23 
24 #include <gst/gst.h>
25 
26 #include "rtpstorage.h"
27 
28 G_BEGIN_DECLS
29 
30 #define GST_TYPE_RTP_ULPFEC_DEC \
31   (gst_rtp_ulpfec_dec_get_type())
32 #define GST_RTP_ULPFEC_DEC(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_ULPFEC_DEC,GstRtpUlpFecDec))
34 #define GST_RTP_ULPFEC_DEC_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_ULPFEC_DEC,GstRtpUlpFecDecClass))
36 #define GST_IS_RTP_ULPFEC_DEC(obj) \
37   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_ULPFEC_DEC))
38 #define GST_IS_RTP_ULPFEC_DEC_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_ULPFEC_DEC))
40 
41 typedef struct _GstRtpUlpFecDec GstRtpUlpFecDec;
42 typedef struct _GstRtpUlpFecDecClass GstRtpUlpFecDecClass;
43 
44 struct _GstRtpUlpFecDecClass {
45   GstElementClass parent_class;
46 };
47 
48 struct _GstRtpUlpFecDec {
49   GstElement parent;
50   GstPad *srcpad;
51   GstPad *sinkpad;
52 
53   /* properties */
54   guint8 fec_pt;
55   RtpStorage *storage;
56   gsize packets_recovered;
57   gsize packets_unrecovered;
58 
59   /* internal stuff */
60   GstFlowReturn chain_return_val;
61   gboolean unset_discont_flag;
62   gboolean have_caps_ssrc;
63   gboolean have_caps_pt;
64   guint32 caps_ssrc;
65   guint8 caps_pt;
66   GList *info_media;
67   GPtrArray *info_fec;
68   GArray *info_arr;
69   GArray *scratch_buf;
70   gboolean lost_packet_from_storage;
71   gboolean lost_packet_returned;
72   guint16 next_seqnum;
73 
74   /* stats */
75   gsize fec_packets_received;
76   gsize fec_packets_rejected;
77   gsize packets_rejected;
78 };
79 
80 GType gst_rtp_ulpfec_dec_get_type (void);
81 
82 G_END_DECLS
83 
84 #endif /* __GST_RTP_ULPFEC_DEC_H__ */
85