rtprtxsend: keep important buffer information in a private structure
[platform/upstream/gst-plugins-good.git] / gst / rtpmanager / gstrtprtxsend.c
1 /* RTP Retransmission sender element for GStreamer
2  *
3  * gstrtprtxsend.c:
4  *
5  * Copyright (C) 2013 Collabora Ltd.
6  *   @author Julien Isorce <julien.isorce@collabora.co.uk>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23
24 /**
25  * SECTION:element-rtprtxsend
26  *
27  * See #GstRtpRtxReceive for examples
28  * 
29  * The purpose of the sender RTX object is to keep a history of RTP packets up
30  * to a configurable limit (max-size-time or max-size-packets). It will listen
31  * for upstream custom retransmission events (GstRTPRetransmissionRequest) that
32  * comes from downstream (#GstRtpSession). When receiving a request it will
33  * look up the requested seqnum in its list of stored packets. If the packet
34  * is available, it will create a RTX packet according to RFC 4588 and send
35  * this as an auxiliary stream. RTX is SSRC-multiplexed
36  */
37
38 #ifdef HAVE_CONFIG_H
39 #include "config.h"
40 #endif
41
42 #include <gst/gst.h>
43 #include <gst/rtp/gstrtpbuffer.h>
44 #include <string.h>
45
46 #include "gstrtprtxsend.h"
47
48 GST_DEBUG_CATEGORY_STATIC (gst_rtp_rtx_send_debug);
49 #define GST_CAT_DEFAULT gst_rtp_rtx_send_debug
50
51 #define DEFAULT_RTX_PAYLOAD_TYPE 0
52 #define DEFAULT_MAX_SIZE_TIME    0
53 #define DEFAULT_MAX_SIZE_PACKETS 100
54
55 enum
56 {
57   PROP_0,
58   PROP_RTX_PAYLOAD_TYPE,
59   PROP_MAX_SIZE_TIME,
60   PROP_MAX_SIZE_PACKETS,
61   PROP_NUM_RTX_REQUESTS,
62   PROP_NUM_RTX_PACKETS,
63   PROP_LAST
64 };
65
66 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
67     GST_PAD_SRC,
68     GST_PAD_ALWAYS,
69     GST_STATIC_CAPS ("application/x-rtp")
70     );
71
72 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
73     GST_PAD_SINK,
74     GST_PAD_ALWAYS,
75     GST_STATIC_CAPS ("application/x-rtp")
76     );
77
78 static gboolean gst_rtp_rtx_send_src_event (GstPad * pad, GstObject * parent,
79     GstEvent * event);
80 static GstFlowReturn gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent,
81     GstBuffer * buffer);
82
83 static GstStateChangeReturn gst_rtp_rtx_send_change_state (GstElement *
84     element, GstStateChange transition);
85
86 static void gst_rtp_rtx_send_set_property (GObject * object, guint prop_id,
87     const GValue * value, GParamSpec * pspec);
88 static void gst_rtp_rtx_send_get_property (GObject * object, guint prop_id,
89     GValue * value, GParamSpec * pspec);
90 static void gst_rtp_rtx_send_finalize (GObject * object);
91
92 G_DEFINE_TYPE (GstRtpRtxSend, gst_rtp_rtx_send, GST_TYPE_ELEMENT);
93
94 typedef struct
95 {
96   guint16 seqnum;
97   guint32 timestamp;
98   GstBuffer *buffer;
99 } BufferQueueItem;
100
101 static void
102 buffer_queue_item_free (BufferQueueItem * item)
103 {
104   gst_buffer_unref (item->buffer);
105   g_free (item);
106 }
107
108 static void
109 gst_rtp_rtx_send_class_init (GstRtpRtxSendClass * klass)
110 {
111   GObjectClass *gobject_class;
112   GstElementClass *gstelement_class;
113
114   gobject_class = (GObjectClass *) klass;
115   gstelement_class = (GstElementClass *) klass;
116
117   gobject_class->get_property = gst_rtp_rtx_send_get_property;
118   gobject_class->set_property = gst_rtp_rtx_send_set_property;
119   gobject_class->finalize = gst_rtp_rtx_send_finalize;
120
121   g_object_class_install_property (gobject_class, PROP_RTX_PAYLOAD_TYPE,
122       g_param_spec_uint ("rtx-payload-type", "RTX Payload Type",
123           "Payload type of the retransmission stream (fmtp in SDP)", 0,
124           G_MAXUINT, DEFAULT_RTX_PAYLOAD_TYPE,
125           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
126
127   g_object_class_install_property (gobject_class, PROP_MAX_SIZE_TIME,
128       g_param_spec_uint ("max-size-time", "Max Size Times",
129           "Amount of ms to queue (0 = unlimited)", 0, G_MAXUINT,
130           DEFAULT_MAX_SIZE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
131
132   g_object_class_install_property (gobject_class, PROP_MAX_SIZE_PACKETS,
133       g_param_spec_uint ("max-size-packets", "Max Size Packets",
134           "Amount of packets to queue (0 = unlimited)", 0, G_MAXUINT,
135           DEFAULT_MAX_SIZE_PACKETS,
136           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
137
138   g_object_class_install_property (gobject_class, PROP_NUM_RTX_REQUESTS,
139       g_param_spec_uint ("num-rtx-requests", "Num RTX Requests",
140           "Number of retransmission events received", 0, G_MAXUINT,
141           0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
142
143   g_object_class_install_property (gobject_class, PROP_NUM_RTX_PACKETS,
144       g_param_spec_uint ("num-rtx-packets", "Num RTX Packets",
145           " Number of retransmission packets sent", 0, G_MAXUINT,
146           0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
147
148   gst_element_class_add_pad_template (gstelement_class,
149       gst_static_pad_template_get (&src_factory));
150   gst_element_class_add_pad_template (gstelement_class,
151       gst_static_pad_template_get (&sink_factory));
152
153   gst_element_class_set_static_metadata (gstelement_class,
154       "RTP Retransmission Sender", "Codec",
155       "Retransmit RTP packets when needed, according to RFC4588",
156       "Julien Isorce <julien.isorce@collabora.co.uk>");
157
158   gstelement_class->change_state =
159       GST_DEBUG_FUNCPTR (gst_rtp_rtx_send_change_state);
160 }
161
162 static void
163 gst_rtp_rtx_send_reset (GstRtpRtxSend * rtx, gboolean full)
164 {
165   g_mutex_lock (&rtx->lock);
166   g_queue_foreach (rtx->queue, (GFunc) buffer_queue_item_free, NULL);
167   g_queue_clear (rtx->queue);
168   g_list_foreach (rtx->pending, (GFunc) gst_buffer_unref, NULL);
169   g_list_free (rtx->pending);
170   rtx->pending = NULL;
171   rtx->master_ssrc = 0;
172   rtx->next_seqnum = g_random_int_range (0, G_MAXUINT16);
173   rtx->rtx_ssrc = g_random_int ();
174   rtx->num_rtx_requests = 0;
175   rtx->num_rtx_packets = 0;
176   g_mutex_unlock (&rtx->lock);
177 }
178
179 static void
180 gst_rtp_rtx_send_finalize (GObject * object)
181 {
182   GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (object);
183
184   gst_rtp_rtx_send_reset (rtx, TRUE);
185   g_queue_free (rtx->queue);
186   g_mutex_clear (&rtx->lock);
187
188   G_OBJECT_CLASS (gst_rtp_rtx_send_parent_class)->finalize (object);
189 }
190
191 static void
192 gst_rtp_rtx_send_init (GstRtpRtxSend * rtx)
193 {
194   GstElementClass *klass = GST_ELEMENT_GET_CLASS (rtx);
195
196   rtx->srcpad =
197       gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
198           "src"), "src");
199   GST_PAD_SET_PROXY_CAPS (rtx->srcpad);
200   GST_PAD_SET_PROXY_ALLOCATION (rtx->srcpad);
201   gst_pad_set_event_function (rtx->srcpad,
202       GST_DEBUG_FUNCPTR (gst_rtp_rtx_send_src_event));
203   gst_element_add_pad (GST_ELEMENT (rtx), rtx->srcpad);
204
205   rtx->sinkpad =
206       gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
207           "sink"), "sink");
208   GST_PAD_SET_PROXY_CAPS (rtx->sinkpad);
209   GST_PAD_SET_PROXY_ALLOCATION (rtx->sinkpad);
210   gst_pad_set_chain_function (rtx->sinkpad,
211       GST_DEBUG_FUNCPTR (gst_rtp_rtx_send_chain));
212   gst_element_add_pad (GST_ELEMENT (rtx), rtx->sinkpad);
213
214   rtx->queue = g_queue_new ();
215   rtx->pending = NULL;
216   g_mutex_init (&rtx->lock);
217
218   rtx->next_seqnum = g_random_int_range (0, G_MAXUINT16);
219   rtx->rtx_ssrc = g_random_int ();
220
221   rtx->max_size_time = DEFAULT_MAX_SIZE_TIME;
222   rtx->max_size_packets = DEFAULT_MAX_SIZE_PACKETS;
223 }
224
225 static guint32
226 choose_ssrc (GstRtpRtxSend * rtx)
227 {
228   guint32 ssrc;
229
230   while (TRUE) {
231     ssrc = g_random_int ();
232
233     /* make sure to be different than master */
234     if (ssrc != rtx->master_ssrc)
235       break;
236   }
237   return ssrc;
238 }
239
240 typedef struct
241 {
242   GstRtpRtxSend *rtx;
243   guint seqnum;
244   gboolean found;
245 } RTXData;
246
247 /* traverse queue history and try to find the buffer that the
248  * requested seqnum */
249 static void
250 push_seqnum (BufferQueueItem * item, RTXData * data)
251 {
252   GstRtpRtxSend *rtx = data->rtx;
253
254   if (data->found)
255     return;
256
257   /* data->seqnum comes from the request */
258   if (item->seqnum == data->seqnum) {
259     data->found = TRUE;
260     GST_DEBUG_OBJECT (rtx, "found %" G_GUINT16_FORMAT, item->seqnum);
261     rtx->pending = g_list_prepend (rtx->pending, gst_buffer_ref (item->buffer));
262   }
263 }
264
265 static gboolean
266 gst_rtp_rtx_send_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
267 {
268   GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
269   gboolean res;
270
271   switch (GST_EVENT_TYPE (event)) {
272     case GST_EVENT_CUSTOM_UPSTREAM:
273     {
274       const GstStructure *s = gst_event_get_structure (event);
275
276       /* This event usually comes from the downstream gstrtpsession */
277       if (gst_structure_has_name (s, "GstRTPRetransmissionRequest")) {
278         guint32 seqnum = 0;
279         guint ssrc = 0;
280         RTXData data;
281
282         /* retrieve seqnum of the packet that need to be restransmisted */
283         if (!gst_structure_get_uint (s, "seqnum", &seqnum))
284           seqnum = -1;
285
286         /* retrieve ssrc of the packet that need to be restransmisted */
287         if (!gst_structure_get_uint (s, "ssrc", &ssrc))
288           ssrc = -1;
289
290         GST_DEBUG_OBJECT (rtx,
291             "request seqnum: %" G_GUINT16_FORMAT ", ssrc: %" G_GUINT32_FORMAT,
292             seqnum, ssrc);
293
294         g_mutex_lock (&rtx->lock);
295         /* check if request is for us */
296         if (rtx->master_ssrc == ssrc) {
297           ++rtx->num_rtx_requests;
298           data.rtx = rtx;
299           data.seqnum = seqnum;
300           data.found = FALSE;
301           /* TODO do a binary search because rtx->queue is sorted by seq num */
302           g_queue_foreach (rtx->queue, (GFunc) push_seqnum, &data);
303         }
304         g_mutex_unlock (&rtx->lock);
305
306         gst_event_unref (event);
307         res = TRUE;
308
309         /* This event usually comes from the downstream gstrtpsession */
310       } else if (gst_structure_has_name (s, "GstRTPCollision")) {
311         guint ssrc = 0;
312
313         if (!gst_structure_get_uint (s, "ssrc", &ssrc))
314           ssrc = -1;
315
316         GST_DEBUG_OBJECT (rtx, "collision ssrc: %" G_GUINT32_FORMAT, ssrc);
317
318         g_mutex_lock (&rtx->lock);
319
320         /* choose another ssrc for our retransmited stream */
321         if (ssrc == rtx->rtx_ssrc) {
322           rtx->rtx_ssrc = choose_ssrc (rtx);
323
324           /* clear buffers we already saved */
325           g_queue_foreach (rtx->queue, (GFunc) gst_buffer_unref, NULL);
326           g_queue_clear (rtx->queue);
327
328           /* clear buffers that are about to be retransmited */
329           g_list_foreach (rtx->pending, (GFunc) gst_buffer_unref, NULL);
330           g_list_free (rtx->pending);
331           rtx->pending = NULL;
332
333           g_mutex_unlock (&rtx->lock);
334
335           /* no need to forward to payloader because we make sure to have
336            * a different ssrc
337            */
338           gst_event_unref (event);
339           res = TRUE;
340         } else {
341           g_mutex_unlock (&rtx->lock);
342
343           /* forward event to payloader in case collided ssrc is
344            * master stream */
345           res = gst_pad_event_default (pad, parent, event);
346         }
347       } else {
348         res = gst_pad_event_default (pad, parent, event);
349       }
350       break;
351     }
352     default:
353       res = gst_pad_event_default (pad, parent, event);
354       break;
355   }
356   return res;
357 }
358
359 /* Copy fixed header and extension. Add OSN before to copy payload
360  * Copy memory to avoid to manually copy each rtp buffer field.
361  */
362 static GstBuffer *
363 _gst_rtp_rtx_buffer_new (GstBuffer * buffer, guint32 ssrc, guint16 seqnum,
364     guint8 fmtp)
365 {
366   GstMemory *mem = NULL;
367   GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
368   GstRTPBuffer new_rtp = GST_RTP_BUFFER_INIT;
369   GstBuffer *new_buffer = gst_buffer_new ();
370   GstMapInfo map;
371   guint payload_len = 0;
372
373   gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
374
375   /* gst_rtp_buffer_map does not map the payload so do it now */
376   gst_rtp_buffer_get_payload (&rtp);
377
378   /* If payload type is not set through SDP/property then
379    * just bump the value */
380   if (fmtp < 96)
381     fmtp = gst_rtp_buffer_get_payload_type (&rtp) + 1;
382
383   /* copy fixed header */
384   mem = gst_memory_copy (rtp.map[0].memory, 0, rtp.size[0]);
385   gst_buffer_append_memory (new_buffer, mem);
386
387   /* copy extension if any */
388   if (rtp.size[1]) {
389     mem = gst_memory_copy (rtp.map[1].memory, 0, rtp.size[1]);
390     gst_buffer_append_memory (new_buffer, mem);
391   }
392
393   /* copy payload and add OSN just before */
394   payload_len = 2 + rtp.size[2];
395   mem = gst_allocator_alloc (NULL, payload_len, NULL);
396
397   gst_memory_map (mem, &map, GST_MAP_WRITE);
398   GST_WRITE_UINT16_BE (map.data, gst_rtp_buffer_get_seq (&rtp));
399   if (rtp.size[2])
400     memcpy (map.data + 2, rtp.data[2], rtp.size[2]);
401   gst_memory_unmap (mem, &map);
402   gst_buffer_append_memory (new_buffer, mem);
403
404   /* everything needed is copied */
405   gst_rtp_buffer_unmap (&rtp);
406
407   /* set ssrc, seqnum and fmtp */
408   gst_rtp_buffer_map (new_buffer, GST_MAP_WRITE, &new_rtp);
409   gst_rtp_buffer_set_ssrc (&new_rtp, ssrc);
410   gst_rtp_buffer_set_seq (&new_rtp, seqnum);
411   gst_rtp_buffer_set_payload_type (&new_rtp, fmtp);
412   /* RFC 4588: let other elements do the padding, as normal */
413   gst_rtp_buffer_set_padding (&new_rtp, FALSE);
414   gst_rtp_buffer_unmap (&new_rtp);
415
416   return new_buffer;
417 }
418
419 /* psuh pending retransmission packet.
420  * it constructs rtx packet from original paclets */
421 static void
422 do_push (GstBuffer * buffer, GstRtpRtxSend * rtx)
423 {
424   /* RFC4588 two streams multiplexed by sending them in the same session using
425    * different SSRC values, i.e., SSRC-multiplexing.  */
426   GST_DEBUG_OBJECT (rtx,
427       "retransmit seqnum: %" G_GUINT16_FORMAT ", ssrc: %" G_GUINT32_FORMAT,
428       rtx->next_seqnum, rtx->rtx_ssrc);
429   gst_pad_push (rtx->srcpad, _gst_rtp_rtx_buffer_new (buffer, rtx->rtx_ssrc,
430           rtx->next_seqnum++, rtx->rtx_payload_type));
431 }
432
433 static GstFlowReturn
434 gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
435 {
436   GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
437   GstFlowReturn ret = GST_FLOW_ERROR;
438   GList *pending = NULL;
439   GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
440   BufferQueueItem *item;
441   guint16 seqnum;
442   guint32 ssrc, rtptime;
443
444   rtx = GST_RTP_RTX_SEND (parent);
445
446   /* read the information we want from the buffer */
447   gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
448   seqnum = gst_rtp_buffer_get_seq (&rtp);
449   ssrc = gst_rtp_buffer_get_ssrc (&rtp);
450   rtptime = gst_rtp_buffer_get_timestamp (&rtp);
451   gst_rtp_buffer_unmap (&rtp);
452
453   g_mutex_lock (&rtx->lock);
454
455   /* retrieve master stream ssrc */
456   rtx->master_ssrc = ssrc;
457   /* check if our initial aux ssrc is equal to master */
458   if (rtx->rtx_ssrc == rtx->master_ssrc)
459     choose_ssrc (rtx);
460
461   /* add current rtp buffer to queue history */
462   item = g_new0 (BufferQueueItem, 1);
463   item->seqnum = seqnum;
464   item->timestamp = rtptime;
465   item->buffer = gst_buffer_ref (buffer);
466   g_queue_push_head (rtx->queue, item);
467
468   /* remove oldest packets from history if they are too many */
469   if (rtx->max_size_packets) {
470     while (g_queue_get_length (rtx->queue) > rtx->max_size_packets)
471       buffer_queue_item_free (g_queue_pop_tail (rtx->queue));
472   }
473
474   /* within lock, get packets that have to be retransmited */
475   pending = rtx->pending;
476   rtx->pending = NULL;
477
478   /* update statistics - assume we will succeed to retransmit those packets */
479   rtx->num_rtx_packets += g_list_length (pending);
480
481   /* transfer payload type while holding the lock */
482   rtx->rtx_payload_type = rtx->rtx_payload_type_pending;
483
484   /* no need to hold the lock to push rtx packets */
485   g_mutex_unlock (&rtx->lock);
486
487   /* retransmit requested packets */
488   g_list_foreach (pending, (GFunc) do_push, rtx);
489   g_list_foreach (pending, (GFunc) gst_buffer_unref, NULL);
490   g_list_free (pending);
491
492   GST_LOG_OBJECT (rtx,
493       "push seqnum: %" G_GUINT16_FORMAT ", ssrc: %" G_GUINT32_FORMAT, seqnum,
494       rtx->master_ssrc);
495
496   /* push current rtp packet */
497   ret = gst_pad_push (rtx->srcpad, buffer);
498
499   return ret;
500 }
501
502 static void
503 gst_rtp_rtx_send_get_property (GObject * object,
504     guint prop_id, GValue * value, GParamSpec * pspec)
505 {
506   GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (object);
507
508   switch (prop_id) {
509     case PROP_RTX_PAYLOAD_TYPE:
510       g_mutex_lock (&rtx->lock);
511       g_value_set_uint (value, rtx->rtx_payload_type_pending);
512       g_mutex_unlock (&rtx->lock);
513       break;
514     case PROP_MAX_SIZE_TIME:
515       g_mutex_lock (&rtx->lock);
516       g_value_set_uint (value, rtx->max_size_time);
517       g_mutex_unlock (&rtx->lock);
518       break;
519     case PROP_MAX_SIZE_PACKETS:
520       g_mutex_lock (&rtx->lock);
521       g_value_set_uint (value, rtx->max_size_packets);
522       g_mutex_unlock (&rtx->lock);
523       break;
524     case PROP_NUM_RTX_REQUESTS:
525       g_mutex_lock (&rtx->lock);
526       g_value_set_uint (value, rtx->num_rtx_requests);
527       g_mutex_unlock (&rtx->lock);
528       break;
529     case PROP_NUM_RTX_PACKETS:
530       g_mutex_lock (&rtx->lock);
531       g_value_set_uint (value, rtx->num_rtx_packets);
532       g_mutex_unlock (&rtx->lock);
533       break;
534     default:
535       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
536       break;
537   }
538 }
539
540 static void
541 gst_rtp_rtx_send_set_property (GObject * object,
542     guint prop_id, const GValue * value, GParamSpec * pspec)
543 {
544   GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (object);
545
546   switch (prop_id) {
547     case PROP_RTX_PAYLOAD_TYPE:
548       g_mutex_lock (&rtx->lock);
549       rtx->rtx_payload_type_pending = g_value_get_uint (value);
550       g_mutex_unlock (&rtx->lock);
551       break;
552     case PROP_MAX_SIZE_TIME:
553       g_mutex_lock (&rtx->lock);
554       rtx->max_size_time = g_value_get_uint (value);
555       g_mutex_unlock (&rtx->lock);
556       break;
557     case PROP_MAX_SIZE_PACKETS:
558       g_mutex_lock (&rtx->lock);
559       rtx->max_size_packets = g_value_get_uint (value);
560       g_mutex_unlock (&rtx->lock);
561       break;
562     default:
563       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
564       break;
565   }
566 }
567
568 static GstStateChangeReturn
569 gst_rtp_rtx_send_change_state (GstElement * element, GstStateChange transition)
570 {
571   GstStateChangeReturn ret;
572   GstRtpRtxSend *rtx;
573
574   rtx = GST_RTP_RTX_SEND (element);
575
576   switch (transition) {
577     default:
578       break;
579   }
580
581   ret =
582       GST_ELEMENT_CLASS (gst_rtp_rtx_send_parent_class)->change_state (element,
583       transition);
584
585   switch (transition) {
586     case GST_STATE_CHANGE_PAUSED_TO_READY:
587       gst_rtp_rtx_send_reset (rtx, TRUE);
588       break;
589     default:
590       break;
591   }
592
593   return ret;
594 }
595
596 gboolean
597 gst_rtp_rtx_send_plugin_init (GstPlugin * plugin)
598 {
599   GST_DEBUG_CATEGORY_INIT (gst_rtp_rtx_send_debug, "rtprtxsend", 0,
600       "rtp retransmission sender");
601
602   return gst_element_register (plugin, "rtprtxsend", GST_RANK_NONE,
603       GST_TYPE_RTP_RTX_SEND);
604 }