mirror of https://github.com/ericonr/sndio.git
Fix confusion between processed samples by the hardware (as reported
by GET{I,O}OFFS) and samples played as reported by GETINFO(). Fixes incorrect delta propagated after xruns.
This commit is contained in:
parent
0d773f998a
commit
cbecd3ea8d
|
@ -877,16 +877,22 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
|
|||
if (dierr > 0)
|
||||
DPRINTFN(2, "rec xrun %d\n", dierr);
|
||||
}
|
||||
|
||||
/*
|
||||
* GET{I,O}OFFS report positions including xruns,
|
||||
* so we have to substract to get the real position
|
||||
*/
|
||||
hdl->idelta -= dierr;
|
||||
hdl->odelta -= doerr;
|
||||
|
||||
offset = doerr - dierr;
|
||||
if (offset > 0) {
|
||||
hdl->sio.rdrop += offset * hdl->ibpf;
|
||||
hdl->idelta -= doerr;
|
||||
hdl->odelta -= doerr;
|
||||
hdl->idelta -= offset;
|
||||
DPRINTFN(2, "will drop %d and pause %d\n", offset, doerr);
|
||||
} else if (offset < 0) {
|
||||
hdl->sio.wsil += -offset * hdl->obpf;
|
||||
hdl->idelta -= dierr;
|
||||
hdl->odelta -= dierr;
|
||||
hdl->odelta -= offset;
|
||||
DPRINTFN(2, "will insert %d and pause %d\n", -offset, dierr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue