jack: don't wait for callbacks if the jack server shut down
authorThomas Scheuermann <Thomas.Scheuermann@barco.com>
Thu, 30 Jun 2016 12:40:40 +0000 (14:40 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 8 Jul 2016 13:52:04 +0000 (16:52 +0300)
Otherwise we'll wait forever.

https://bugzilla.gnome.org/show_bug.cgi?id=747275

ext/jack/gstjackaudioclient.c

index 0f06d10..9c50a6a 100644 (file)
@@ -85,6 +85,7 @@ struct _GstJackAudioClient
   GstJackClientType type;
   gboolean active;
   gboolean deactivate;
+  gboolean server_down;
 
   JackShutdownCallback shutdown;
   JackProcessCallback process;
@@ -227,12 +228,16 @@ jack_shutdown_cb (void *arg)
   for (walk = conn->src_clients; walk; walk = g_list_next (walk)) {
     GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
 
+    client->server_down = TRUE;
+    g_cond_signal (&conn->flush_cond);
     if (client->shutdown)
       client->shutdown (client->user_data);
   }
   for (walk = conn->sink_clients; walk; walk = g_list_next (walk)) {
     GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
 
+    client->server_down = TRUE;
+    g_cond_signal (&conn->flush_cond);
     if (client->shutdown)
       client->shutdown (client->user_data);
   }
@@ -520,6 +525,7 @@ gst_jack_audio_client_new (const gchar * id, const gchar * server,
   client->buffer_size = buffer_size;
   client->sample_rate = sample_rate;
   client->user_data = user_data;
+  client->server_down = FALSE;
 
   /* add the client to the connection */
   gst_jack_audio_connection_add_client (conn, client);
@@ -600,7 +606,7 @@ gst_jack_audio_client_set_active (GstJackAudioClient * client, gboolean active)
     client->deactivate = TRUE;
 
     /* need to wait for process_cb run once more */
-    while (client->deactivate)
+    while (client->deactivate && !client->server_down)
       g_cond_wait (&client->conn->flush_cond, &client->conn->lock);
   }
   client->active = active;