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.
This commit is contained in:
John Bassett 2017-01-12 16:05:59 +00:00 committed by Havard Graff
parent 35596e7fac
commit 5800950a2d
2 changed files with 45 additions and 8 deletions

View 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:
{

View 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;
}