From 96d98c7955e99f5229e030bca9306e86deb66ef1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 24 Jan 2021 20:31:42 +0100 Subject: [PATCH] pulse-server: express latency in samples in all cases --- src/modules/module-protocol-pulse/pulse-server.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 09475ccd6..41d9f42ad 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -1091,18 +1091,19 @@ static int reply_create_playback_stream(struct stream *stream) spa_ringbuffer_init(&stream->ring); if (stream->early_requests) { - lat.num = stream->attr.minreq / stream->frame_size; + lat.num = stream->attr.minreq; } else if (stream->adjust_latency) { if (stream->attr.tlength > stream->attr.minreq * 2) - lat.num = (stream->attr.tlength - stream->attr.minreq * 2) / 2 / stream->frame_size; + lat.num = (stream->attr.tlength - stream->attr.minreq * 2) / 2; else lat.num = stream->attr.minreq; } else { if (stream->attr.tlength > stream->attr.minreq * 2) - lat.num = (stream->attr.tlength - stream->attr.minreq * 2) / stream->frame_size; + lat.num = stream->attr.tlength - stream->attr.minreq * 2; else lat.num = stream->attr.minreq; } + lat.num /= stream->frame_size; lat.denom = stream->ss.rate; lat_usec = lat.num * SPA_USEC_PER_SEC / lat.denom;