Commit 0b172593 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

tcp: print warning if someone tries to add clients in NULL state

And mention this in docs.
parent fbff6c6f
......@@ -27,6 +27,9 @@
* file descriptors can be added to multifdsink by emitting the #GstMultiFdSink::add signal.
* For each descriptor added, the #GstMultiFdSink::client-added signal will be called.
* The multifdsink element needs to be set into READY, PAUSED or PLAYING state
* before operations such as adding clients are possible.
* As of version 0.10.8, a client can also be added with the #GstMultiFdSink::add-full signal
* that allows for more control over what and how much data a client
* initially receives.
......@@ -656,6 +656,12 @@ gst_multi_handle_sink_add_full (GstMultiHandleSink * sink,
GstMultiHandleSinkClass *mhsinkclass =
if (!sink->running) {
g_warning ("Element %s must be set to READY, PAUSED or PLAYING state "
"before clients can be added", GST_OBJECT_NAME (sink));
mhsinkclass->handle_debug (handle, debug);
GST_DEBUG_OBJECT (sink, "%s adding client, sync_method %d, "
"min_format %d, min_value %" G_GUINT64_FORMAT
......@@ -141,6 +141,19 @@ GST_START_TEST (test_add_client)
GST_START_TEST (test_add_client_in_null_state)
GstElement *sink;
sink = setup_multifdsink ();
ASSERT_WARNING (g_signal_emit_by_name (sink, "add", 99));
cleanup_multifdsink (sink);
#define fail_unless_read(msg,fd,size,ref) \
char data[size + 1]; \
......@@ -800,6 +813,7 @@ multifdsink_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_no_clients);
tcase_add_test (tc_chain, test_add_client);
tcase_add_test (tc_chain, test_add_client_in_null_state);
tcase_add_test (tc_chain, test_streamheader);
tcase_add_test (tc_chain, test_change_streamheader);
tcase_add_test (tc_chain, test_burst_client_bytes);
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