Report better latency when PulseAudio has no timing info

This commit is contained in:
Chris Robinson 2020-03-30 20:06:24 -07:00
parent b9f19c6ca2
commit bf48dcd375

View File

@ -1107,13 +1107,13 @@ ClockLatency PulsePlayback::getClockLatency()
if UNLIKELY(err != 0) if UNLIKELY(err != 0)
{ {
/* FIXME: if err = -PA_ERR_NODATA, it means we were called too soon /* If err = -PA_ERR_NODATA, it means we were called too soon after
* after starting the stream and no timing info has been received from * starting the stream and no timing info has been received from the
* the server yet. Should we wait, possibly stalling the app, or give a * server yet. Give a generic value since nothing better is available.
* dummy value? Either way, it shouldn't be 0. */ */
if(err != -PA_ERR_NODATA) if(err != -PA_ERR_NODATA)
ERR("Failed to get stream latency: 0x%x\n", err); ERR("Failed to get stream latency: 0x%x\n", err);
latency = 0; latency = mDevice->BufferSize - mDevice->UpdateSize;
neg = 0; neg = 0;
} }
else if UNLIKELY(neg) else if UNLIKELY(neg)