Skip to content

Commit

Permalink
Prevent repeat calling of method supposed to run once
Browse files Browse the repository at this point in the history
  • Loading branch information
hyades committed Jan 10, 2015
1 parent 89e06ac commit c2550cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@ AC_ARG_ENABLE(speakertrack,
[BUILD_SPEAKERTRACK=no])
AM_CONDITIONAL(SPEAKERTRACK_ENABLED, test "x$BUILD_SPEAKERTRACK" = "xyes")

AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable debugging, default: no]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])

AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
dnl FIXME: Add the Python-API as an option here

dnl === Output ================================================================
Expand Down
32 changes: 15 additions & 17 deletions tools/gstswitchcontroller.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,20 +355,18 @@ gst_switch_controller_add_new_client (GstSwitchAddNewClientParams * params)
GDBusConnection *connection = params->connection;
GstSwitchController *controller = params->controller;
gint role = CLIENT_ROLE_NONE;
{
gint tests[] = { CLIENT_ROLE_UI, CLIENT_ROLE_CAPTURE, };
GVariant *parameters = NULL, *res = NULL;
int n = 0;
for (; n < sizeof (tests); ++n) {
role = CLIENT_ROLE_NONE;
parameters = g_variant_new ("()");
res = gst_switch_controller_call_client (controller,
connection, tests[n], "role", parameters, G_VARIANT_TYPE ("(i)"));
if (res) {
g_variant_get (res, "(i)", &role);
g_variant_unref (res);
break;
}
gint tests[] = { CLIENT_ROLE_UI, CLIENT_ROLE_CAPTURE, };
GVariant *parameters = NULL, *res = NULL;
int n = 0;
for (; n < sizeof (tests); ++n) {
role = CLIENT_ROLE_NONE;
parameters = g_variant_new ("()");
res = gst_switch_controller_call_client (controller,
connection, tests[n], "role", parameters, G_VARIANT_TYPE ("(i)"));
if (res) {
g_variant_get (res, "(i)", &role);
g_variant_unref (res);
break;
}
}

Expand Down Expand Up @@ -434,7 +432,7 @@ gst_switch_controller_on_new_connection (GDBusServer * server,
params->connection = connection;
g_object_ref (connection);

g_timeout_add (500, (GSourceFunc) gst_switch_controller_add_new_client,
g_timeout_add (100000, (GSourceFunc) gst_switch_controller_add_new_client,
params);
return TRUE;
}
Expand Down Expand Up @@ -550,6 +548,7 @@ gst_switch_controller_call_client (GstSwitchController * controller,
GDBusConnection * connection, gint role, const gchar * method_name,
GVariant * parameters, const GVariantType * reply_type)
{

GVariant *value = NULL;
GError *error = NULL;

Expand Down Expand Up @@ -582,7 +581,7 @@ gst_switch_controller_call_client (GstSwitchController * controller,
g_variant_unref (value);
return NULL;
}
g_assert (value != NULL);
// g_assert (value != NULL);

return value;
}
Expand All @@ -599,7 +598,6 @@ gst_switch_controller_call_clients (GstSwitchController * controller,
GDBusConnection *connection;
GVariant *value;
GList *ui, *clients = NULL;

g_variant_ref_sink (parameters);

switch (role) {
Expand Down

0 comments on commit c2550cf

Please sign in to comment.