jack: don't wait for callbacks if the jack server shut down

Otherwise we'll wait forever.

https://bugzilla.gnome.org/show_bug.cgi?id=747275
This commit is contained in:
Thomas Scheuermann 2016-06-30 14:40:40 +02:00 committed by Sebastian Dröge
parent 85b0c3a83d
commit 187d8acd5e

View 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;