pulse-server: make method to pause/resume stream

Make a method to pause and resume a stream and keep track of the paused
state of the stream. Use this function instead of setting the stream
inactive/active so that we get nice logging for each state change.
This commit is contained in:
Wim Taymans 2022-11-20 15:07:44 +01:00
parent 4c3f56fca1
commit fc159be9c6
3 changed files with 21 additions and 4 deletions

View file

@ -207,6 +207,20 @@ uint32_t stream_pop_missing(struct stream *stream)
return missing;
}
void stream_set_paused(struct stream *stream, bool paused, const char *reason)
{
if (stream->is_paused == paused)
return;
if (reason && stream->client)
pw_log_info("%p: [%s] %s because of %s",
stream, stream->client->name,
paused ? "paused" : "resumed", reason);
stream->is_paused = paused;
pw_stream_set_active(stream->stream, !paused);
}
int stream_send_underflow(struct stream *stream, int64_t offset)
{
struct client *client = stream->client;