pulse-server: make sure to count played samples

On underrun we need to keep on counting playing_for so fill this
in underrun and don't add this to missing to avoid double counting.

See #639
This commit is contained in:
Wim Taymans 2021-01-28 18:59:03 +01:00
parent ac3555d6fc
commit b65b291bb2

View file

@ -1462,7 +1462,7 @@ do_process_done(struct spa_loop *loop,
else else
send_stream_started(stream); send_stream_started(stream);
} }
stream->missing += pd->playing_for + pd->underrun_for; stream->missing += pd->playing_for;
stream->missing = SPA_MIN(stream->missing, stream->attr.tlength); stream->missing = SPA_MIN(stream->missing, stream->attr.tlength);
stream->playing_for += pd->playing_for; stream->playing_for += pd->playing_for;
if (stream->underrun_for != (uint64_t)-1) if (stream->underrun_for != (uint64_t)-1)
@ -1559,6 +1559,7 @@ static void stream_process(void *data)
pw_stream_flush(stream->stream, true); pw_stream_flush(stream->stream, true);
} else { } else {
pd.underrun_for = size; pd.underrun_for = size;
pd.playing_for = size;
pd.underrun = true; pd.underrun = true;
} }
pd.read_index += size; pd.read_index += size;