From 5629655f741e418363b23a05b1de8bcb587f5fe2 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 17 Jan 2022 22:10:41 +1100 Subject: [PATCH] [client] audio/pw: fix memory leak and gracefully shutdown --- client/audiodevs/PipeWire/pipewire.c | 1 + client/src/audio.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/client/audiodevs/PipeWire/pipewire.c b/client/audiodevs/PipeWire/pipewire.c index 749b85e3..06dae0d1 100644 --- a/client/audiodevs/PipeWire/pipewire.c +++ b/client/audiodevs/PipeWire/pipewire.c @@ -197,6 +197,7 @@ static void pipewire_playbackStopStream(void) pw_stream_destroy(pw.playback.stream); pw.playback.stream = NULL; pw.playback.rateMatch = NULL; + ringbuffer_free(&pw.playback.buffer); pw_thread_loop_unlock(pw.thread); } diff --git a/client/src/audio.c b/client/src/audio.c index 04e3ea0d..2a66c85a 100644 --- a/client/src/audio.c +++ b/client/src/audio.c @@ -72,6 +72,9 @@ void audio_free(void) if (!audio.audioDev) return; + audio_playbackStop(); + audio_recordStop(); + audio.audioDev->free(); audio.audioDev = NULL; }