Commit 6d166987 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

Return GST_FLOW_NOT_NEGOTIATED if we get a buffer without caps, and add a...

Return GST_FLOW_NOT_NEGOTIATED if we get a buffer without caps, and add a somewhat useful debug message. Plus test.

Original commit message from CVS:
* gst/icydemux/gsticydemux.c: (gst_icydemux_chain):
* tests/check/elements/icydemux.c:
Return GST_FLOW_NOT_NEGOTIATED if we get a buffer without
caps, and add a somewhat useful debug message. Plus test.
parent f0690e19
2008-02-07 Tim-Philipp Müller <tim at centricular dot net>
* gst/icydemux/gsticydemux.c: (gst_icydemux_chain):
* tests/check/elements/icydemux.c:
Return GST_FLOW_NOT_NEGOTIATED if we get a buffer without
caps, and add a somewhat useful debug message. Plus test.
2008-02-07 Sebastien Moutte <sebastien@moutte.net>
* gst/rtsp/gstrtspsrc.c:
......
......@@ -497,8 +497,9 @@ gst_icydemux_chain (GstPad * pad, GstBuffer * buf)
GstFlowReturn ret = GST_FLOW_OK;
icydemux = GST_ICYDEMUX (GST_PAD_PARENT (pad));
g_return_val_if_fail (GST_IS_ICYDEMUX (icydemux), GST_FLOW_ERROR);
g_return_val_if_fail (icydemux->meta_interval >= 0, GST_FLOW_ERROR);
if (G_UNLIKELY (icydemux->meta_interval < 0))
goto not_negotiated;
if (icydemux->meta_interval == 0) {
ret = gst_icydemux_typefind_or_forward (icydemux, buf);
......@@ -558,6 +559,15 @@ done:
gst_buffer_unref (buf);
return ret;
/* ERRORS */
not_negotiated:
{
GST_WARNING_OBJECT (icydemux, "meta_interval not set, buffer probably had "
"no caps set. Try enabling iradio-mode on the http source element");
gst_buffer_unref (buf);
return GST_FLOW_NOT_NEGOTIATED;
}
}
static GstStateChangeReturn
......
......@@ -117,7 +117,8 @@ cleanup_icydemux (void)
bus = NULL;
gst_check_teardown_src_pad (icydemux);
gst_check_teardown_sink_pad (icydemux);
if (sinkpad)
gst_check_teardown_sink_pad (icydemux);
gst_check_teardown_element (icydemux);
srcpad = NULL;
......@@ -229,6 +230,23 @@ GST_START_TEST (test_first_buf_offset_when_merged_for_typefinding)
GST_END_TEST;
GST_START_TEST (test_not_negotiated)
{
GstBuffer *buf;
create_icydemux ();
buf = gst_buffer_new_and_alloc (0);
GST_BUFFER_OFFSET (buf) = 0;
fail_unless_equals_int (gst_pad_push (srcpad, buf), GST_FLOW_NOT_NEGOTIATED);
buf = NULL;
cleanup_icydemux ();
}
GST_END_TEST;
static Suite *
icydemux_suite (void)
{
......@@ -238,6 +256,7 @@ icydemux_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_demux);
tcase_add_test (tc_chain, test_first_buf_offset_when_merged_for_typefinding);
tcase_add_test (tc_chain, test_not_negotiated);
return s;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment