output/PipeWire: after Cancel(), refill buffer before resuming playback

Deactivate the stream in Cancel().  This fixes stuttering after a
manual song change by refilling the whole ring buffer before
reactivating the stream.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1354
This commit is contained in:
Max Kellermann
2022-07-09 00:59:35 +02:00
parent 547a084c7e
commit c8dae95eff
2 changed files with 10 additions and 0 deletions

View File

@@ -901,6 +901,15 @@ PipeWireOutput::Cancel() noexcept
/* clear libpipewire's buffer */
pw_stream_flush(stream, false);
drained = true;
/* pause the PipeWire stream so libpipewire ceases invoking
the "process" callback (we have no data until our Play()
method gets called again); the stream will be resume by
Play() after the ring_buffer has been refilled */
if (active) {
active = false;
pw_stream_set_active(stream, false);
}
}
bool