mirror of https://github.com/ericonr/sndio.git
save fifo pointers for debug purposes
This commit is contained in:
parent
8a85df2977
commit
bde184cd77
|
@ -55,6 +55,12 @@ struct sio_sun_hdl {
|
||||||
int offset; /* frames play is ahead of record */
|
int offset; /* frames play is ahead of record */
|
||||||
int idelta, odelta; /* position reported to client */
|
int idelta, odelta; /* position reported to client */
|
||||||
int mix_fd, mix_index; /* /dev/mixerN stuff */
|
int mix_fd, mix_index; /* /dev/mixerN stuff */
|
||||||
|
#ifdef DEBUG
|
||||||
|
/* save these for core dumps */
|
||||||
|
int isamples, osamples;
|
||||||
|
int ixrun, oxrun;
|
||||||
|
int cpos, rpos, wpos;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sio_sun_close(struct sio_hdl *);
|
static void sio_sun_close(struct sio_hdl *);
|
||||||
|
@ -784,6 +790,9 @@ sio_sun_read(struct sio_hdl *sh, void *buf, size_t len)
|
||||||
hdl->sio.eof = 1;
|
hdl->sio.eof = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->rpos += n;
|
||||||
|
#endif
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,6 +854,10 @@ sio_sun_wsil(struct sio_sun_hdl *hdl)
|
||||||
}
|
}
|
||||||
hdl->offset += (int)n / (int)hdl->obpf;
|
hdl->offset += (int)n / (int)hdl->obpf;
|
||||||
DPRINTF("sio_sun_wsil: inserted %ld/%ld bytes\n", n, todo);
|
DPRINTF("sio_sun_wsil: inserted %ld/%ld bytes\n", n, todo);
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->wpos += n;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -869,6 +882,9 @@ sio_sun_write(struct sio_hdl *sh, const void *buf, size_t len)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->wpos += n;
|
||||||
|
#endif
|
||||||
if (hdl->filling) {
|
if (hdl->filling) {
|
||||||
if (!sio_sun_autostart(hdl))
|
if (!sio_sun_autostart(hdl))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -908,6 +924,9 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
|
||||||
hdl->sio.eof = 1;
|
hdl->sio.eof = 1;
|
||||||
return POLLHUP;
|
return POLLHUP;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->osamples = ao.samples;
|
||||||
|
#endif
|
||||||
delta = (ao.samples - hdl->obytes) / hdl->obpf;
|
delta = (ao.samples - hdl->obytes) / hdl->obpf;
|
||||||
hdl->obytes = ao.samples;
|
hdl->obytes = ao.samples;
|
||||||
hdl->odelta += delta;
|
hdl->odelta += delta;
|
||||||
|
@ -920,6 +939,9 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
|
||||||
hdl->sio.eof = 1;
|
hdl->sio.eof = 1;
|
||||||
return POLLHUP;
|
return POLLHUP;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->isamples = hdl->ibytes;
|
||||||
|
#endif
|
||||||
delta = (ao.samples - hdl->ibytes) / hdl->ibpf;
|
delta = (ao.samples - hdl->ibytes) / hdl->ibpf;
|
||||||
hdl->ibytes = ao.samples;
|
hdl->ibytes = ao.samples;
|
||||||
hdl->idelta += delta;
|
hdl->idelta += delta;
|
||||||
|
@ -932,6 +954,9 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
|
||||||
hdl->sio.eof = 1;
|
hdl->sio.eof = 1;
|
||||||
return POLLHUP;
|
return POLLHUP;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->oxrun = xrun;
|
||||||
|
#endif
|
||||||
doerr = xrun - hdl->oerr;
|
doerr = xrun - hdl->oerr;
|
||||||
hdl->oerr = xrun;
|
hdl->oerr = xrun;
|
||||||
if (!(hdl->sio.mode & SIO_REC))
|
if (!(hdl->sio.mode & SIO_REC))
|
||||||
|
@ -943,6 +968,9 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
|
||||||
hdl->sio.eof = 1;
|
hdl->sio.eof = 1;
|
||||||
return POLLHUP;
|
return POLLHUP;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->ixrun = xrun;
|
||||||
|
#endif
|
||||||
dierr = xrun - hdl->ierr;
|
dierr = xrun - hdl->ierr;
|
||||||
hdl->ierr = xrun;
|
hdl->ierr = xrun;
|
||||||
if (!(hdl->sio.mode & SIO_PLAY))
|
if (!(hdl->sio.mode & SIO_PLAY))
|
||||||
|
@ -955,6 +983,9 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
|
||||||
|
|
||||||
delta = (hdl->idelta > hdl->odelta) ? hdl->idelta : hdl->odelta;
|
delta = (hdl->idelta > hdl->odelta) ? hdl->idelta : hdl->odelta;
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
hdl->cpos += delta;
|
||||||
|
#endif
|
||||||
sio_onmove_cb(&hdl->sio, delta);
|
sio_onmove_cb(&hdl->sio, delta);
|
||||||
hdl->idelta -= delta;
|
hdl->idelta -= delta;
|
||||||
hdl->odelta -= delta;
|
hdl->odelta -= delta;
|
||||||
|
|
Loading…
Reference in New Issue