rtprtxreceive: allow passthrough and non-rtp buffers
authorHavard Graff <havard.graff@gmail.com>
Sun, 26 Jun 2016 20:25:46 +0000 (22:25 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 7 Mar 2022 23:43:49 +0000 (23:43 +0000)
To avoid mapping rtp buffers when RTX is not in use, and to not
do a full error on receiving a non-rtp buffer, since you have no control
of what a rouge sender might send you.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1874>

subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c

index 44adbb4..2a4cfc5 100644 (file)
@@ -530,6 +530,9 @@ gst_rtp_rtx_receive_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
   gboolean is_rtx;
   gboolean drop = FALSE;
 
+  if (rtx->rtx_pt_map_structure == NULL)
+    goto no_map;
+
   /* map current rtp packet to parse its header */
   if (!gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp))
     goto invalid_buffer;
@@ -679,10 +682,14 @@ gst_rtp_rtx_receive_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
 
   return ret;
 
+no_map:
+  {
+    GST_DEBUG_OBJECT (pad, "No map set, passthrough");
+    return gst_pad_push (rtx->srcpad, buffer);
+  }
 invalid_buffer:
   {
-    GST_ELEMENT_WARNING (rtx, STREAM, DECODE, (NULL),
-        ("Received invalid RTP payload, dropping"));
+    GST_INFO_OBJECT (pad, "Received invalid RTP payload, dropping");
     gst_buffer_unref (buffer);
     return GST_FLOW_OK;
   }