log errors only if SNDIO_DEBUG=1

This commit is contained in:
Alexandre Ratchov 2013-12-10 20:23:11 +01:00
parent b22be8340a
commit 496c443bca
2 changed files with 10 additions and 10 deletions

View File

@ -491,7 +491,7 @@ _sio_onmove_cb(struct sio_hdl *hdl, int delta)
{ {
#ifdef DEBUG #ifdef DEBUG
hdl->cpos += delta; hdl->cpos += delta;
if (_sndio_debug >= 2) if (_sndio_debug >= 3)
_sio_printpos(hdl); _sio_printpos(hdl);
#endif #endif
if (hdl->move_cb) if (hdl->move_cb)

View File

@ -552,7 +552,7 @@ sio_sun_setpar(struct sio_hdl *sh, struct sio_par *par)
aui.record.encoding = enc; aui.record.encoding = enc;
aui.record.channels = par->rchan; aui.record.channels = par->rchan;
} }
DPRINTF("sio_sun_setpar: %i: trying pars = %u/%u/%u\n", DPRINTFN(2, "sio_sun_setpar: %i: trying pars = %u/%u/%u\n",
i, rate, prec, enc); i, rate, prec, enc);
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0 && errno != EINVAL) { if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0 && errno != EINVAL) {
DPERROR("sio_sun_setpar: setinfo(pars)"); DPERROR("sio_sun_setpar: setinfo(pars)");
@ -640,7 +640,7 @@ sio_sun_setpar(struct sio_hdl *sh, struct sio_par *par)
obpf = (hdl->sio.mode & SIO_PLAY) ? obpf = (hdl->sio.mode & SIO_PLAY) ?
aui.play.channels * aui.play.bps : 1; aui.play.channels * aui.play.bps : 1;
DPRINTF("sio_sun_setpar: bpf = (%u, %u)\n", ibpf, obpf); DPRINTFN(2, "sio_sun_setpar: bpf = (%u, %u)\n", ibpf, obpf);
/* /*
* try to set parameters until the device accepts * try to set parameters until the device accepts
@ -666,14 +666,14 @@ sio_sun_setpar(struct sio_hdl *sh, struct sio_par *par)
} }
infr = aui.record.block_size / ibpf; infr = aui.record.block_size / ibpf;
onfr = aui.play.block_size / obpf; onfr = aui.play.block_size / obpf;
DPRINTF("sio_sun_setpar: %i: trying round = %u -> (%u, %u)\n", DPRINTFN(2, "sio_sun_setpar: %i: trying round = %u -> (%u, %u)\n",
i, round, infr, onfr); i, round, infr, onfr);
/* /*
* if half-duplex or both block sizes match, we're done * if half-duplex or both block sizes match, we're done
*/ */
if (hdl->sio.mode != (SIO_REC | SIO_PLAY) || infr == onfr) { if (hdl->sio.mode != (SIO_REC | SIO_PLAY) || infr == onfr) {
DPRINTF("sio_sun_setpar: blocksize ok\n"); DPRINTFN(2, "sio_sun_setpar: blocksize ok\n");
return 1; return 1;
} }
@ -686,7 +686,7 @@ sio_sun_setpar(struct sio_hdl *sh, struct sio_par *par)
else else
round = infr < onfr ? onfr : infr; round = infr < onfr ? onfr : infr;
} }
DPRINTF("sio_sun_setpar: couldn't find a working blocksize\n"); DPRINTFN(2, "sio_sun_setpar: couldn't find a working blocksize\n");
hdl->sio.eof = 1; hdl->sio.eof = 1;
return 0; return 0;
#undef NRETRIES #undef NRETRIES
@ -865,7 +865,7 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
if (!(hdl->sio.mode & SIO_REC)) if (!(hdl->sio.mode & SIO_REC))
dierr = doerr; dierr = doerr;
if (doerr > 0) if (doerr > 0)
DPRINTF("play xrun %d\n", doerr); DPRINTFN(2, "play xrun %d\n", doerr);
} }
if (hdl->sio.mode & SIO_REC) { if (hdl->sio.mode & SIO_REC) {
if (ioctl(hdl->fd, AUDIO_RERROR, &xrun) < 0) { if (ioctl(hdl->fd, AUDIO_RERROR, &xrun) < 0) {
@ -878,19 +878,19 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
if (!(hdl->sio.mode & SIO_PLAY)) if (!(hdl->sio.mode & SIO_PLAY))
doerr = dierr; doerr = dierr;
if (dierr > 0) if (dierr > 0)
DPRINTF("rec xrun %d\n", dierr); DPRINTFN(2, "rec xrun %d\n", dierr);
} }
offset = doerr - dierr; offset = doerr - dierr;
if (offset > 0) { if (offset > 0) {
hdl->sio.rdrop += offset * hdl->ibpf; hdl->sio.rdrop += offset * hdl->ibpf;
hdl->idelta -= doerr; hdl->idelta -= doerr;
hdl->odelta -= doerr; hdl->odelta -= doerr;
DPRINTF("will drop %d and pause %d\n", offset, doerr); DPRINTFN(2, "will drop %d and pause %d\n", offset, doerr);
} else if (offset < 0) { } else if (offset < 0) {
hdl->sio.wsil += -offset * hdl->obpf; hdl->sio.wsil += -offset * hdl->obpf;
hdl->idelta -= dierr; hdl->idelta -= dierr;
hdl->odelta -= dierr; hdl->odelta -= dierr;
DPRINTF("will insert %d and pause %d\n", -offset, dierr); DPRINTFN(2, "will insert %d and pause %d\n", -offset, dierr);
} }
delta = (hdl->idelta > hdl->odelta) ? hdl->idelta : hdl->odelta; delta = (hdl->idelta > hdl->odelta) ? hdl->idelta : hdl->odelta;