From a8139b7acf6c710adb926c84dfb945ba2f8e6042 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 3 Dec 2021 17:49:59 +0100 Subject: [PATCH] pulse-server: handle prebuf state better When we have a prebuf value, we start in the prebuf state. We go back to prebuf when we have a prebuf value and an empty ringbuffer. --- src/modules/module-protocol-pulse/pulse-server.c | 3 +++ src/modules/module-protocol-pulse/stream.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 49ed91c67..1776556f6 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -490,6 +490,9 @@ static int reply_create_playback_stream(struct stream *stream, struct pw_manager items[4] = SPA_DICT_ITEM_INIT("pulse.attr.minreq", attr_minreq); pw_stream_update_properties(stream->stream, &SPA_DICT_INIT(items, 5)); + if (stream->attr.prebuf > 0) + stream->in_prebuf = true; + missing = stream_pop_missing(stream); pw_log_info("[%s] reply CREATE_PLAYBACK_STREAM tag:%u missing:%u latency:%s", diff --git a/src/modules/module-protocol-pulse/stream.c b/src/modules/module-protocol-pulse/stream.c index ffe437fe3..9ef8dfa70 100644 --- a/src/modules/module-protocol-pulse/stream.c +++ b/src/modules/module-protocol-pulse/stream.c @@ -117,7 +117,7 @@ static bool stream_prebuf_active(struct stream *stream) if (stream->in_prebuf) return avail < (int32_t) stream->attr.prebuf; else - return stream->attr.prebuf > 0 && avail >= 0; + return stream->attr.prebuf > 0 && avail <= 0; } uint32_t stream_pop_missing(struct stream *stream)