1 /* GStreamer plugin for forward error correction
2 * Copyright (C) 2017 Pexip
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.
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.
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
18 * Author: Mikhail Fludkov <misha@pexip.com>
22 * SECTION:element-rtpulpfecdec
23 * @short_description: Generic RTP Forward Error Correction (FEC) decoder
24 * @title: rtpulpfecdec
26 * Generic Forward Error Correction (FEC) decoder for Uneven Level
27 * Protection (ULP) as described in RFC 5109.
29 * This element will work in combination with an upstream #GstRtpStorage
30 * element and attempt to recover packets declared lost through custom
31 * 'GstRTPPacketLost' events, usually emitted by #GstRtpJitterBuffer.
33 * As such, this element cannot be usefully used from the command line,
34 * because a reference to the upstream storage object needs to be
35 * provided to it through its #GstRtpUlpFecDec:storage property, example
36 * programs are available at
37 * <https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/rtpfecserver.rs>
39 * <https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/rtpfecclient.rs>.
41 * Additionally, the payload types of the protection packets *must* be
42 * provided to this element via its #GstRtpUlpFecDec:pt property.
44 * When using #GstRtpBin, this element should be inserted through the
45 * #GstRtpBin::request-fec-decoder signal.
47 * See also: #GstRtpUlpFecEnc, #GstRtpBin, #GstRtpStorage
51 #include <gst/rtp/gstrtpbuffer.h>
52 #include <gst/rtp/gstrtp-enumtypes.h>
54 #include "rtpulpfeccommon.h"
55 #include "gstrtpulpfecdec.h"
57 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
60 GST_STATIC_CAPS ("application/x-rtp")
63 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
66 GST_STATIC_CAPS ("application/x-rtp")
79 #define DEFAULT_FEC_PT 0
81 static GParamSpec *klass_properties[N_PROPERTIES] = { NULL, };
83 GST_DEBUG_CATEGORY (gst_rtp_ulpfec_dec_debug);
84 #define GST_CAT_DEFAULT (gst_rtp_ulpfec_dec_debug)
86 G_DEFINE_TYPE (GstRtpUlpFecDec, gst_rtp_ulpfec_dec, GST_TYPE_ELEMENT);
88 #define RTP_FEC_MAP_INFO_NTH(dec, data) (&g_array_index (\
89 ((GstRtpUlpFecDec *)dec)->info_arr, \
91 GPOINTER_TO_UINT(data)))
94 _compare_fec_map_info (gconstpointer a, gconstpointer b, gpointer userdata)
97 gst_rtp_buffer_get_seq (&RTP_FEC_MAP_INFO_NTH (userdata, a)->rtp);
99 gst_rtp_buffer_get_seq (&RTP_FEC_MAP_INFO_NTH (userdata, b)->rtp);
100 return gst_rtp_buffer_compare_seqnum (bseq, aseq);
104 gst_rtp_ulpfec_dec_start (GstRtpUlpFecDec * self, GstBufferList * buflist,
105 guint8 fec_pt, guint16 lost_seq)
107 guint fec_packets = 0;
110 g_assert (NULL == self->info_media);
111 g_assert (0 == self->info_fec->len);
112 g_assert (0 == self->info_arr->len);
114 g_array_set_size (self->info_arr, gst_buffer_list_length (buflist));
117 i < gst_buffer_list_length (buflist) && !self->lost_packet_from_storage;
119 GstBuffer *buffer = gst_buffer_list_get (buflist, i);
120 RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, i);
122 if (!rtp_ulpfec_map_info_map (gst_buffer_ref (buffer), info))
123 g_assert_not_reached ();
125 if (fec_pt == gst_rtp_buffer_get_payload_type (&info->rtp)) {
126 GST_DEBUG_RTP_PACKET (self, "rtp header (fec)", &info->rtp);
129 if (rtp_ulpfec_buffer_is_valid (&info->rtp)) {
130 GST_DEBUG_FEC_PACKET (self, &info->rtp);
131 g_ptr_array_add (self->info_fec, GUINT_TO_POINTER (i));
134 GST_LOG_RTP_PACKET (self, "rtp header (incoming)", &info->rtp);
136 if (lost_seq == gst_rtp_buffer_get_seq (&info->rtp)) {
137 GST_DEBUG_OBJECT (self, "Received lost packet from the storage");
138 g_list_free (self->info_media);
139 self->info_media = NULL;
140 self->lost_packet_from_storage = TRUE;
143 g_list_insert_sorted_with_data (self->info_media,
144 GUINT_TO_POINTER (i), _compare_fec_map_info, self);
147 if (!self->lost_packet_from_storage) {
148 self->fec_packets_received += fec_packets;
149 self->fec_packets_rejected += fec_packets - self->info_fec->len;
154 gst_rtp_ulpfec_dec_stop (GstRtpUlpFecDec * self)
156 g_array_set_size (self->info_arr, 0);
157 g_ptr_array_set_size (self->info_fec, 0);
158 g_list_free (self->info_media);
159 self->info_media = NULL;
160 self->lost_packet_from_storage = FALSE;
161 self->lost_packet_returned = FALSE;
165 gst_rtp_ulpfec_dec_get_media_buffers_mask (GstRtpUlpFecDec * self,
166 guint16 fec_seq_base)
171 for (it = self->info_media; it; it = it->next) {
172 RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
174 rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
181 gst_rtp_ulpfec_dec_is_recovered_pt_valid (GstRtpUlpFecDec * self, gint media_pt,
185 if (media_pt == recovered_pt)
188 for (it = self->info_media; it; it = it->next) {
189 RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
190 if (gst_rtp_buffer_get_payload_type (&info->rtp) == recovered_pt)
197 gst_rtp_ulpfec_dec_recover_from_fec (GstRtpUlpFecDec * self,
198 RtpUlpFecMapInfo * info_fec, guint32 ssrc, gint media_pt, guint16 seq,
201 guint64 fec_mask = rtp_ulpfec_buffer_get_mask (&info_fec->rtp);
202 gboolean fec_mask_long = rtp_ulpfec_buffer_get_fechdr (&info_fec->rtp)->L;
203 guint16 fec_seq_base = rtp_ulpfec_buffer_get_seq_base (&info_fec->rtp);
207 g_array_set_size (self->scratch_buf, 0);
208 rtp_buffer_to_ulpfec_bitstring (&info_fec->rtp, self->scratch_buf, TRUE,
211 for (it = self->info_media; it; it = it->next) {
212 RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
213 guint64 packet_mask =
214 rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
217 if (fec_mask & packet_mask) {
218 fec_mask ^= packet_mask;
219 rtp_buffer_to_ulpfec_bitstring (&info->rtp, self->scratch_buf, FALSE,
225 rtp_ulpfec_bitstring_to_media_rtp_buffer (self->scratch_buf,
226 fec_mask_long, ssrc, seq);
228 /* We are about to put recovered packet back in self->info_media to be able
229 * to reuse it later for recovery of other packets
231 gint i = self->info_arr->len;
232 RtpUlpFecMapInfo *info;
235 g_array_set_size (self->info_arr, self->info_arr->len + 1);
236 info = RTP_FEC_MAP_INFO_NTH (self, i);
238 if (!rtp_ulpfec_map_info_map (gst_buffer_ref (ret), info)) {
239 GST_WARNING_OBJECT (self, "Invalid recovered packet");
240 goto recovered_packet_invalid;
243 recovered_pt = gst_rtp_buffer_get_payload_type (&info->rtp);
244 if (!gst_rtp_ulpfec_dec_is_recovered_pt_valid (self, media_pt,
246 GST_WARNING_OBJECT (self,
247 "Recovered packet has unexpected payload type (%u)", recovered_pt);
248 goto recovered_packet_invalid;
251 GST_DEBUG_RTP_PACKET (self, "rtp header (recovered)", &info->rtp);
253 g_list_insert_sorted_with_data (self->info_media, GUINT_TO_POINTER (i),
254 _compare_fec_map_info, self);
255 *dst_pt = recovered_pt;
259 recovered_packet_invalid:
260 g_array_set_size (self->info_arr, self->info_arr->len - 1);
261 gst_buffer_unref (ret);
266 gst_rtp_ulpfec_dec_recover_from_storage (GstRtpUlpFecDec * self,
267 guint8 * dst_pt, guint16 * dst_seq)
269 RtpUlpFecMapInfo *info;
271 if (self->lost_packet_returned)
274 g_assert (g_list_length (self->info_media) == 1);
276 info = RTP_FEC_MAP_INFO_NTH (self, self->info_media->data);
277 *dst_seq = gst_rtp_buffer_get_seq (&info->rtp);
278 *dst_pt = gst_rtp_buffer_get_payload_type (&info->rtp);
279 self->lost_packet_returned = TRUE;
280 GST_DEBUG_RTP_PACKET (self, "rtp header (recovered)", &info->rtp);
281 return gst_buffer_ref (info->rtp.buffer);
284 /* __has_builtin only works with clang, so test compiler version for gcc */
285 /* Intel compiler and MSVC probably have their own things as well */
286 /* TODO: make sure we use builtin for clang as well */
287 #if defined(__GNUC__) && __GNUC__ >= 4
288 #define rtp_ulpfec_ctz64 __builtin_ctzll
291 rtp_ulpfec_ctz64_inline (guint64 mask)
299 } while (++nth_bit < 64);
301 return -1; /* should not be reached, since mask must not be 0 */
304 #define rtp_ulpfec_ctz64 rtp_ulpfec_ctz64_inline
308 gst_rtp_ulpfec_dec_recover (GstRtpUlpFecDec * self, guint32 ssrc, gint media_pt,
309 guint8 * dst_pt, guint16 * dst_seq)
311 guint64 media_mask = 0;
312 gint media_mask_seq_base = -1;
315 if (self->lost_packet_from_storage)
316 return gst_rtp_ulpfec_dec_recover_from_storage (self, dst_pt, dst_seq);
318 /* Looking for a FEC packet which can be used for recovery */
319 for (i = 0; i < self->info_fec->len; ++i) {
320 RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self,
321 g_ptr_array_index (self->info_fec, i));
322 guint16 seq_base = rtp_ulpfec_buffer_get_seq_base (&info->rtp);
323 guint64 fec_mask = rtp_ulpfec_buffer_get_mask (&info->rtp);
324 guint64 missing_packets_mask;
326 if (media_mask_seq_base != (gint) seq_base) {
327 media_mask_seq_base = seq_base;
328 media_mask = gst_rtp_ulpfec_dec_get_media_buffers_mask (self, seq_base);
331 /* media_mask has 1s if packet exist.
332 * fec_mask is the mask of protected packets
333 * The statement below excludes existing packets from the protected. So
334 * we are left with 1s only for missing packets which can be recovered
335 * by this FEC packet. */
336 missing_packets_mask = fec_mask & (~media_mask);
338 /* Do we have any 1s? Checking if current FEC packet can be used for recovery */
339 if (0 != missing_packets_mask) {
340 guint trailing_zeros = rtp_ulpfec_ctz64 (missing_packets_mask);
342 /* Is it the only 1 in the mask? Checking if we lacking single packet in
343 * that case FEC packet can be used for recovery */
344 if (missing_packets_mask == (G_GUINT64_CONSTANT (1) << trailing_zeros)) {
348 seq_base + (RTP_ULPFEC_SEQ_BASE_OFFSET_MAX (TRUE) - trailing_zeros);
350 gst_rtp_ulpfec_dec_recover_from_fec (self, info, ssrc, media_pt,
361 gst_rtp_ulpfec_dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
363 GstRtpUlpFecDec *self = GST_RTP_ULPFEC_DEC (parent);
365 if (G_LIKELY (GST_FLOW_OK == self->chain_return_val)) {
366 GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
367 buf = gst_buffer_make_writable (buf);
369 if (G_UNLIKELY (self->unset_discont_flag)) {
370 self->unset_discont_flag = FALSE;
371 GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT);
374 gst_rtp_buffer_map (buf, GST_MAP_WRITE, &rtp);
375 gst_rtp_buffer_set_seq (&rtp, self->next_seqnum++);
376 gst_rtp_buffer_unmap (&rtp);
378 return gst_pad_push (self->srcpad, buf);
381 gst_buffer_unref (buf);
382 return self->chain_return_val;
386 gst_rtp_ulpfec_dec_handle_packet_loss (GstRtpUlpFecDec * self, guint16 seqnum,
387 GstClockTime timestamp, GstClockTime duration)
389 gint caps_pt = self->have_caps_pt ? self->caps_pt : -1;
391 GstBufferList *buflist =
392 rtp_storage_get_packets_for_recovery (self->storage, self->fec_pt,
393 self->caps_ssrc, seqnum);
396 GstBuffer *recovered_buffer = NULL;
397 guint16 recovered_seq = 0;
398 guint8 recovered_pt = 0;
400 gst_rtp_ulpfec_dec_start (self, buflist, self->fec_pt, seqnum);
402 while (NULL != (recovered_buffer =
403 gst_rtp_ulpfec_dec_recover (self, self->caps_ssrc, caps_pt,
404 &recovered_pt, &recovered_seq))) {
405 if (seqnum == recovered_seq) {
406 GstBuffer *sent_buffer;
407 GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
409 recovered_buffer = gst_buffer_make_writable (recovered_buffer);
410 GST_BUFFER_PTS (recovered_buffer) = timestamp;
411 /* GST_BUFFER_DURATION (recovered_buffer) = duration;
412 * JB does not set the duration, so we will not too */
414 if (!self->lost_packet_from_storage)
415 rtp_storage_put_recovered_packet (self->storage,
416 recovered_buffer, recovered_pt, self->caps_ssrc, recovered_seq);
418 GST_DEBUG_OBJECT (self,
419 "Pushing recovered packet ssrc=0x%08x seq=%u %" GST_PTR_FORMAT,
420 self->caps_ssrc, seqnum, recovered_buffer);
422 sent_buffer = gst_buffer_copy_deep (recovered_buffer);
424 if (self->lost_packet_from_storage)
425 gst_buffer_unref (recovered_buffer);
427 gst_rtp_buffer_map (sent_buffer, GST_MAP_WRITE, &rtp);
428 gst_rtp_buffer_set_seq (&rtp, self->next_seqnum++);
429 gst_rtp_buffer_unmap (&rtp);
432 self->unset_discont_flag = TRUE;
433 self->chain_return_val = gst_pad_push (self->srcpad, sent_buffer);
437 if (!self->lost_packet_from_storage) {
438 rtp_storage_put_recovered_packet (self->storage,
439 recovered_buffer, recovered_pt, self->caps_ssrc, recovered_seq);
441 gst_buffer_unref (recovered_buffer);
445 gst_rtp_ulpfec_dec_stop (self);
446 gst_buffer_list_unref (buflist);
449 GST_DEBUG_OBJECT (self, "Packet lost ssrc=0x%08x seq=%u", self->caps_ssrc,
456 gst_rtp_ulpfec_dec_handle_sink_event (GstPad * pad, GstObject * parent,
459 GstRtpUlpFecDec *self = GST_RTP_ULPFEC_DEC (parent);
460 gboolean forward = TRUE;
462 GST_LOG_OBJECT (self, "Received event %" GST_PTR_FORMAT, event);
464 if (GST_FLOW_OK == self->chain_return_val &&
465 GST_EVENT_CUSTOM_DOWNSTREAM == GST_EVENT_TYPE (event) &&
466 gst_event_has_name (event, "GstRTPPacketLost")) {
468 GstClockTime timestamp, duration;
471 event = gst_event_make_writable (event);
472 s = gst_event_writable_structure (event);
474 g_assert (self->have_caps_ssrc);
475 g_assert (self->storage);
477 if (!gst_structure_get (s,
478 "seqnum", G_TYPE_UINT, &seqnum,
479 "timestamp", G_TYPE_UINT64, ×tamp,
480 "duration", G_TYPE_UINT64, &duration, NULL))
481 g_assert_not_reached ();
484 gst_rtp_ulpfec_dec_handle_packet_loss (self, seqnum, timestamp,
488 gst_structure_remove_field (s, "seqnum");
489 gst_structure_set (s, "might-have-been-fec", G_TYPE_BOOLEAN, TRUE, NULL);
490 ++self->packets_unrecovered;
492 ++self->packets_recovered;
495 GST_DEBUG_OBJECT (self, "Unrecovered / Recovered: %lu / %lu",
496 (gulong) self->packets_unrecovered, (gulong) self->packets_recovered);
497 } else if (GST_EVENT_CAPS == GST_EVENT_TYPE (event)) {
499 gboolean have_caps_pt = FALSE;
500 gboolean have_caps_ssrc = FALSE;
504 gst_event_parse_caps (event, &caps);
506 gst_structure_get_uint (gst_caps_get_structure (caps, 0), "ssrc",
509 gst_structure_get_int (gst_caps_get_structure (caps, 0), "payload",
512 if (self->have_caps_ssrc != have_caps_ssrc || self->caps_ssrc != caps_ssrc)
513 GST_DEBUG_OBJECT (self, "SSRC changed %u, 0x%08x -> %u, 0x%08x",
514 self->have_caps_ssrc, self->caps_ssrc, have_caps_ssrc, caps_ssrc);
515 if (self->have_caps_pt != have_caps_pt || self->caps_pt != caps_pt)
516 GST_DEBUG_OBJECT (self, "PT changed %u, %u -> %u, %u",
517 self->have_caps_pt, self->caps_pt, have_caps_pt, caps_pt);
519 self->have_caps_ssrc = have_caps_ssrc;
520 self->have_caps_pt = have_caps_pt;
521 self->caps_ssrc = caps_ssrc;
522 self->caps_pt = caps_pt;
526 return gst_pad_push_event (self->srcpad, event);
527 gst_event_unref (event);
532 gst_rtp_ulpfec_dec_init (GstRtpUlpFecDec * self)
534 self->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
535 self->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
536 GST_PAD_SET_PROXY_CAPS (self->sinkpad);
537 GST_PAD_SET_PROXY_ALLOCATION (self->sinkpad);
538 gst_pad_set_chain_function (self->sinkpad,
539 GST_DEBUG_FUNCPTR (gst_rtp_ulpfec_dec_chain));
540 gst_pad_set_event_function (self->sinkpad,
541 GST_DEBUG_FUNCPTR (gst_rtp_ulpfec_dec_handle_sink_event));
543 gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
544 gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
546 self->fec_pt = DEFAULT_FEC_PT;
548 self->next_seqnum = g_random_int_range (0, G_MAXINT16);
550 self->chain_return_val = GST_FLOW_OK;
551 self->have_caps_ssrc = FALSE;
553 self->info_fec = g_ptr_array_new ();
554 self->info_arr = g_array_new (FALSE, TRUE, sizeof (RtpUlpFecMapInfo));
555 g_array_set_clear_func (self->info_arr,
556 (GDestroyNotify) rtp_ulpfec_map_info_unmap);
557 self->scratch_buf = g_array_new (FALSE, TRUE, sizeof (guint8));
561 gst_rtp_ulpfec_dec_dispose (GObject * obj)
563 GstRtpUlpFecDec *self = GST_RTP_ULPFEC_DEC (obj);
565 GST_INFO_OBJECT (self,
567 " packets_recovered=%" G_GSIZE_FORMAT
568 " packets_unrecovered=%" G_GSIZE_FORMAT,
569 self->caps_ssrc, self->caps_pt,
570 self->packets_recovered, self->packets_unrecovered);
573 g_object_unref (self->storage);
575 g_assert (NULL == self->info_media);
576 g_assert (0 == self->info_fec->len);
577 g_assert (0 == self->info_arr->len);
579 if (self->fec_packets_received) {
580 GST_INFO_OBJECT (self,
581 " fec_packets_received=%" G_GSIZE_FORMAT
582 " fec_packets_rejected=%" G_GSIZE_FORMAT
583 " packets_rejected=%" G_GSIZE_FORMAT,
584 self->fec_packets_received,
585 self->fec_packets_rejected, self->packets_rejected);
588 g_ptr_array_free (self->info_fec, TRUE);
589 g_array_free (self->info_arr, TRUE);
590 g_array_free (self->scratch_buf, TRUE);
592 G_OBJECT_CLASS (gst_rtp_ulpfec_dec_parent_class)->dispose (obj);
596 gst_rtp_ulpfec_dec_set_property (GObject * object, guint prop_id,
597 const GValue * value, GParamSpec * pspec)
599 GstRtpUlpFecDec *self = GST_RTP_ULPFEC_DEC (object);
603 self->fec_pt = g_value_get_uint (value);
607 g_object_unref (self->storage);
608 self->storage = g_value_get_object (value);
610 g_object_ref (self->storage);
613 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
619 gst_rtp_ulpfec_dec_get_property (GObject * object, guint prop_id,
620 GValue * value, GParamSpec * pspec)
622 GstRtpUlpFecDec *self = GST_RTP_ULPFEC_DEC (object);
626 g_value_set_uint (value, self->fec_pt);
629 g_value_set_object (value, self->storage);
632 g_value_set_uint (value, (guint) self->packets_recovered);
634 case PROP_UNRECOVERED:
635 g_value_set_uint (value, (guint) self->packets_unrecovered);
638 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
644 gst_rtp_ulpfec_dec_class_init (GstRtpUlpFecDecClass * klass)
646 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
647 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
649 GST_DEBUG_CATEGORY_INIT (gst_rtp_ulpfec_dec_debug,
650 "rtpulpfecdec", 0, "RTP FEC Decoder");
652 gst_element_class_add_pad_template (element_class,
653 gst_static_pad_template_get (&srctemplate));
654 gst_element_class_add_pad_template (element_class,
655 gst_static_pad_template_get (&sinktemplate));
657 gst_element_class_set_static_metadata (element_class,
659 "Codec/Depayloader/Network/RTP",
660 "Decodes RTP FEC (RFC5109)", "Mikhail Fludkov <misha@pexip.com>");
662 gobject_class->set_property =
663 GST_DEBUG_FUNCPTR (gst_rtp_ulpfec_dec_set_property);
664 gobject_class->get_property =
665 GST_DEBUG_FUNCPTR (gst_rtp_ulpfec_dec_get_property);
666 gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_rtp_ulpfec_dec_dispose);
668 klass_properties[PROP_PT] = g_param_spec_uint ("pt", "pt",
669 "FEC packets payload type", 0, 127,
670 DEFAULT_FEC_PT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
671 klass_properties[PROP_STORAGE] =
672 g_param_spec_object ("storage", "RTP storage", "RTP storage",
673 G_TYPE_OBJECT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
674 klass_properties[PROP_RECOVERED] =
675 g_param_spec_uint ("recovered", "recovered",
676 "The number of recovered packets", 0, G_MAXUINT, 0,
677 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
678 klass_properties[PROP_UNRECOVERED] =
679 g_param_spec_uint ("unrecovered", "unrecovered",
680 "The number of unrecovered packets", 0, G_MAXUINT, 0,
681 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
683 g_object_class_install_properties (gobject_class, N_PROPERTIES,
686 g_assert (rtp_ulpfec_ctz64 (G_GUINT64_CONSTANT (0x1)) == 0);
687 g_assert (rtp_ulpfec_ctz64 (G_GUINT64_CONSTANT (0x8000000000000000)) == 63);