summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-01-14 19:54:51 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-01-14 19:54:51 -0800
commit668522d772ee1e940ad7f1799299d359ae3df58c (patch)
tree814dd050db6055a00fca600bd2277cae2040d487 /src
parent2c1ac7e98d07c5c7e86bea933920fd6a7d9a9dd8 (diff)
jack: ensure sound_data_read is always signaled
The other side needs to be waked up should it be blocked in the cond var, and we're not going to send anything. Otherwise it won't notice !running and exit its side. This should take care of the --use-jack hangs on shutdown
Diffstat (limited to 'src')
-rw-r--r--src/rmd_jack.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rmd_jack.c b/src/rmd_jack.c
index a4227fc..4168a35 100644
--- a/src/rmd_jack.c
+++ b/src/rmd_jack.c
@@ -50,8 +50,14 @@ static int rmdJackCapture(jack_nframes_t nframes, void *jdata_t)
{
JackData *jdata = (JackData *)jdata_t;
- if (!jdata->pdata->running || jdata->pdata->paused || !jdata->capture_started)
+ if (!jdata->pdata->running || jdata->pdata->paused || !jdata->capture_started) {
+ /* still produce a signal on sound_data_read just to ensure the other side
+ * wakes up and realizes running/paused etc.
+ */
+ pthread_cond_signal(jdata->sound_data_read);
+
return 0;
+ }
for (int i = 0; i < jdata->nports; i++)
jdata->portbuf[i] = jack_port_get_buffer(jdata->ports[i], nframes);
@@ -122,7 +128,10 @@ static void rmdJackShutdown(void *jdata_t)
{
JackData *jdata = (JackData *)jdata_t;
+ pthread_mutex_unlock(jdata->sound_buffer_mutex);
jdata->pdata->running = FALSE;
+ pthread_cond_signal(jdata->sound_data_read);
+ pthread_mutex_lock(jdata->sound_buffer_mutex);
fprintf (stderr, "JACK shutdown\n");
}
© All Rights Reserved