mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 13:07:54 +00:00
[client] audio/pw: gracefully shutdown when asked to
This commit is contained in:
parent
cca6492069
commit
e408ea51e2
1 changed files with 15 additions and 20 deletions
|
@ -104,30 +104,11 @@ err_context:
|
|||
pw_context_destroy(context);
|
||||
|
||||
err:
|
||||
pw_loop_destroy(pw.loop);
|
||||
pw_deinit();
|
||||
return false;
|
||||
}
|
||||
|
||||
static void pipewire_free(void)
|
||||
{
|
||||
if (pw.thread)
|
||||
{
|
||||
pw_thread_loop_lock(pw.thread);
|
||||
if (pw.stream)
|
||||
{
|
||||
pw_stream_destroy(pw.stream);
|
||||
pw.stream = NULL;
|
||||
}
|
||||
|
||||
pw_thread_loop_signal(pw.thread, true);
|
||||
pw_thread_loop_destroy(pw.thread);
|
||||
pw.loop = NULL;
|
||||
}
|
||||
|
||||
ringbuffer_free(&pw.buffer);
|
||||
pw_deinit();
|
||||
}
|
||||
|
||||
static void pipewire_stop_stream(void)
|
||||
{
|
||||
if (!pw.stream)
|
||||
|
@ -140,6 +121,20 @@ static void pipewire_stop_stream(void)
|
|||
pw_thread_loop_unlock(pw.thread);
|
||||
}
|
||||
|
||||
static void pipewire_free(void)
|
||||
{
|
||||
pipewire_stop_stream();
|
||||
pw_thread_loop_stop(pw.thread);
|
||||
pw_thread_loop_destroy(pw.thread);
|
||||
pw_loop_destroy(pw.loop);
|
||||
|
||||
pw.loop = NULL;
|
||||
pw.thread = NULL;
|
||||
|
||||
ringbuffer_free(&pw.buffer);
|
||||
pw_deinit();
|
||||
}
|
||||
|
||||
static void pipewire_start(int channels, int sampleRate)
|
||||
{
|
||||
const struct spa_pod * params[1];
|
||||
|
|
Loading…
Reference in a new issue