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

And mention this in docs.

https://bugzilla.gnome.org/show_bug.cgi?id=689326
This commit is contained in:
Tim-Philipp Müller 2012-12-02 12:54:17 +00:00
parent fbff6c6fb1
commit 0b172593fa
3 changed files with 23 additions and 0 deletions

View file

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

View file

@ -656,6 +656,12 @@ gst_multi_handle_sink_add_full (GstMultiHandleSink * sink,
GstMultiHandleSinkClass *mhsinkclass =
GST_MULTI_HANDLE_SINK_GET_CLASS (mhsink);
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));
return;
}
mhsinkclass->handle_debug (handle, debug);
GST_DEBUG_OBJECT (sink, "%s adding client, sync_method %d, "
"min_format %d, min_value %" G_GUINT64_FORMAT

View file

@ -141,6 +141,19 @@ GST_START_TEST (test_add_client)
GST_END_TEST;
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);
}
GST_END_TEST;
#define fail_unless_read(msg,fd,size,ref) \
G_STMT_START { \
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);