Skip to content

Commit

Permalink
deactivate PipeWire audio stream on pause
Browse files Browse the repository at this point in the history
or else the stream won't resync correctly after unpausing
  • Loading branch information
mmitch committed Feb 1, 2024
1 parent 1398808 commit d06bfcb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugout_pipewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
};

0 comments on commit d06bfcb

Please sign in to comment.