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.
This commit is contained in:
Tim-Philipp Müller 2008-02-07 21:17:36 +00:00
parent f0690e19ea
commit 6d166987a0
3 changed files with 39 additions and 3 deletions

View file

@ -1,3 +1,10 @@
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:

View file

@ -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

View file

@ -117,6 +117,7 @@ cleanup_icydemux (void)
bus = NULL;
gst_check_teardown_src_pad (icydemux);
if (sinkpad)
gst_check_teardown_sink_pad (icydemux);
gst_check_teardown_element (icydemux);
@ -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;
}