rtpssrcdemux: Bad RTP/RTCP packet is not fatal
authorJohn Bassett <john.bassett@pexip.com>
Thu, 12 Jan 2017 16:05:59 +0000 (16:05 +0000)
committerHavard Graff <havard@pexip.com>
Tue, 11 Feb 2020 14:10:12 +0000 (15:10 +0100)
When used for processing bundled media streams within rtpbin the rtpssrcdemux element may
receive bad RTP and RTCP packets, these should not be treated as a fatal error.

gst/rtpmanager/gstrtpssrcdemux.c
tests/check/elements/rtpssrcdemux.c

index 3c3e9e6..c6c15ec 100644 (file)
@@ -695,11 +695,9 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
   /* ERRORS */
 invalid_payload:
   {
-    /* this is fatal and should be filtered earlier */
-    GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
-        ("Dropping invalid RTP payload"));
+    GST_DEBUG_OBJECT (demux, "Dropping invalid RTP packet");
     gst_buffer_unref (buf);
-    return GST_FLOW_ERROR;
+    return GST_FLOW_OK;
   }
 create_failed:
   {
@@ -784,11 +782,9 @@ gst_rtp_ssrc_demux_rtcp_chain (GstPad * pad, GstObject * parent,
   /* ERRORS */
 invalid_rtcp:
   {
-    /* this is fatal and should be filtered earlier */
-    GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
-        ("Dropping invalid RTCP packet"));
+    GST_DEBUG_OBJECT (demux, "Dropping invalid RTCP packet");
     gst_buffer_unref (buf);
-    return GST_FLOW_ERROR;
+    return GST_FLOW_OK;
   }
 unexpected_rtcp:
   {
index dfb8e11..bb9bbc0 100644 (file)
@@ -277,6 +277,45 @@ GST_START_TEST (test_rtpssrcdemux_max_streams)
 
 GST_END_TEST;
 
+GST_START_TEST (test_rtpssrcdemux_invalid_rtp)
+{
+  GstHarness *h = gst_harness_new_with_padnames ("rtpssrcdemux", "sink", NULL);
+  guint8 bad_pkt[] = {
+    0x01, 0x02, 0x03
+  };
+
+  gst_harness_set_src_caps_str (h, "application/x-rtp");
+  gst_harness_play (h);
+
+  fail_unless_equals_int (GST_FLOW_OK,
+      gst_harness_push (h, gst_buffer_new_wrapped_full (0, bad_pkt,
+              sizeof bad_pkt, 0, sizeof bad_pkt, NULL, NULL)));
+
+  gst_harness_teardown (h);
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_rtpssrcdemux_invalid_rtcp)
+{
+  GstHarness *h =
+      gst_harness_new_with_padnames ("rtpssrcdemux", "rtcp_sink", NULL);
+  guint8 bad_pkt[] = {
+    0x01, 0x02, 0x03
+  };
+
+  gst_harness_set_src_caps_str (h, "application/x-rtcp");
+  gst_harness_play (h);
+
+  fail_unless_equals_int (GST_FLOW_OK,
+      gst_harness_push (h, gst_buffer_new_wrapped_full (0, bad_pkt,
+              sizeof bad_pkt, 0, sizeof bad_pkt, NULL, NULL)));
+
+  gst_harness_teardown (h);
+}
+
+GST_END_TEST;
+
 static Suite *
 rtpssrcdemux_suite (void)
 {
@@ -287,6 +326,8 @@ rtpssrcdemux_suite (void)
   tcase_add_test (tc_chain, test_event_forwarding);
   tcase_add_test (tc_chain, test_oob_event_locking);
   tcase_add_test (tc_chain, test_rtpssrcdemux_max_streams);
+  tcase_add_test (tc_chain, test_rtpssrcdemux_invalid_rtp);
+  tcase_add_test (tc_chain, test_rtpssrcdemux_invalid_rtcp);
 
   return s;
 }