summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2008-02-07 21:17:36 +0000
committerTim-Philipp Müller <tim@centricular.net>2008-02-07 21:17:36 +0000
commit6d166987a0cce4e56faa888c4bbb7929e7866faf (patch)
tree757df6d8cc0da2ddfb2e3052fa77acb3d76afda6
parentf0690e19ea6753d7b360a8bc26350d2ec44a13ba (diff)
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.
-rw-r--r--ChangeLog7
-rw-r--r--gst/icydemux/gsticydemux.c14
-rw-r--r--tests/check/elements/icydemux.c21
3 files changed, 39 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d2b07f1..ebcba0f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/gst/icydemux/gsticydemux.c b/gst/icydemux/gsticydemux.c
index d99b29f9..3dc47d42 100644
--- a/gst/icydemux/gsticydemux.c
+++ b/gst/icydemux/gsticydemux.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
diff --git a/tests/check/elements/icydemux.c b/tests/check/elements/icydemux.c
index 480210fa..12b14fb6 100644
--- a/tests/check/elements/icydemux.c
+++ b/tests/check/elements/icydemux.c
@@ -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;
}