diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2019-07-26 16:17:59 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2019-08-09 17:45:51 +0000 |
commit | 6c7e7580fb087244302ac5915f8ef500ce54ab54 (patch) | |
tree | f14ad759d69d6a85785f64f206525dcee8f511bb /gst/rist/gstristsink.c | |
parent | 324202d70b7c16afd0aa25b53bb9075ba6515f1e (diff) | |
download | gstreamer-plugins-bad-6c7e7580fb087244302ac5915f8ef500ce54ab54.tar.gz |
ristsink: Only accept RTCP APP packets with subtype==0
Diffstat (limited to 'gst/rist/gstristsink.c')
-rw-r--r-- | gst/rist/gstristsink.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/gst/rist/gstristsink.c b/gst/rist/gstristsink.c index 2e7f35354..297c29da7 100644 --- a/gst/rist/gstristsink.c +++ b/gst/rist/gstristsink.c @@ -296,35 +296,37 @@ on_app_rtcp (GObject * session, guint32 subtype, guint32 ssrc, const gchar * name, GstBuffer * data, GstElement * rtpsession) { if (g_str_equal (name, "RIST")) { - GstEvent *event; - GstPad *send_rtp_sink; - GstMapInfo map; - gint i; - - send_rtp_sink = gst_element_get_static_pad (rtpsession, "send_rtp_sink"); - if (send_rtp_sink) { - gst_buffer_map (data, &map, GST_MAP_READ); - - for (i = 0; i < map.size; i += sizeof (guint32)) { - guint32 dword = GST_READ_UINT32_BE (map.data + i); - guint16 seqnum = dword >> 16; - guint16 num = dword & 0x0000FFFF; - guint16 j; - - GST_DEBUG ("got RIST nack packet, #%u %u", seqnum, num); - - /* num is inclusive, i.e. it can be 0, which means exactly 1 seqnum */ - for (j = 0; j <= num; j++) { - event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, - gst_structure_new ("GstRTPRetransmissionRequest", - "seqnum", G_TYPE_UINT, (guint) seqnum + j, - "ssrc", G_TYPE_UINT, (guint) ssrc, NULL)); - gst_pad_push_event (send_rtp_sink, event); + if (subtype == 0) { + GstEvent *event; + GstPad *send_rtp_sink; + GstMapInfo map; + gint i; + + send_rtp_sink = gst_element_get_static_pad (rtpsession, "send_rtp_sink"); + if (send_rtp_sink) { + gst_buffer_map (data, &map, GST_MAP_READ); + + for (i = 0; i < map.size; i += sizeof (guint32)) { + guint32 dword = GST_READ_UINT32_BE (map.data + i); + guint16 seqnum = dword >> 16; + guint16 num = dword & 0x0000FFFF; + guint16 j; + + GST_DEBUG ("got RIST nack packet, #%u %u", seqnum, num); + + /* num is inclusive, i.e. it can be 0, which means exactly 1 seqnum */ + for (j = 0; j <= num; j++) { + event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, + gst_structure_new ("GstRTPRetransmissionRequest", + "seqnum", G_TYPE_UINT, (guint) seqnum + j, + "ssrc", G_TYPE_UINT, (guint) ssrc, NULL)); + gst_pad_push_event (send_rtp_sink, event); + } } - } - gst_buffer_unmap (data, &map); - gst_object_unref (send_rtp_sink); + gst_buffer_unmap (data, &map); + gst_object_unref (send_rtp_sink); + } } } } |