From d06bfcb2e7a89e9112ba618bf50a3fb6387283e9 Mon Sep 17 00:00:00 2001 From: Christian Garbs Date: Thu, 1 Feb 2024 18:43:19 +0100 Subject: [PATCH] deactivate PipeWire audio stream on pause or else the stream won't resync correctly after unpausing --- plugout_pipewire.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugout_pipewire.c b/plugout_pipewire.c index a951675..ba8507d 100644 --- a/plugout_pipewire.c +++ b/plugout_pipewire.c @@ -106,6 +106,15 @@ static long pipewire_open(enum plugout_endian *endian, long rate, long *buffer_b return 0; } +static void pipewire_pause(int pause) +{ + int err; + if (err = pw_stream_set_active(pipewire_data.stream, !pause)) { + fprintf(stderr, _("pw_stream_set_active failed: %s\n"), spa_strerror(err)); + return -1; + } +} + static ssize_t pipewire_write(const void *buf, size_t count) { struct pw_buffer *b; @@ -172,6 +181,7 @@ const struct output_plugin plugout_pipewire = { .name = "pipewire", .description = "PipeWire sound driver", .open = pipewire_open, + .pause = pipewire_pause, .write = pipewire_write, .close = pipewire_close, };