From 5800950a2d049e33589f0f4e2e7b80fb3e442fba Mon Sep 17 00:00:00 2001 From: John Bassett Date: Thu, 12 Jan 2017 16:05:59 +0000 Subject: [PATCH] rtpssrcdemux: Bad RTP/RTCP packet is not fatal 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 | 12 ++++------- tests/check/elements/rtpssrcdemux.c | 41 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/gst/rtpmanager/gstrtpssrcdemux.c b/gst/rtpmanager/gstrtpssrcdemux.c index 3c3e9e6..c6c15ec 100644 --- a/gst/rtpmanager/gstrtpssrcdemux.c +++ b/gst/rtpmanager/gstrtpssrcdemux.c @@ -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: { diff --git a/tests/check/elements/rtpssrcdemux.c b/tests/check/elements/rtpssrcdemux.c index dfb8e11..bb9bbc0 100644 --- a/tests/check/elements/rtpssrcdemux.c +++ b/tests/check/elements/rtpssrcdemux.c @@ -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; } -- 2.7.4