From 14c0ab970a30642ba8fb47d13be0b2e16e3d81be Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Tue, 31 Dec 2013 13:14:01 +0100 Subject: [PATCH] drop blocks and insert silence in the socket tx/rx code path --- sndiod/dev.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sndiod/dev.c b/sndiod/dev.c index af97702..632ce9d 100644 --- a/sndiod/dev.c +++ b/sndiod/dev.c @@ -1971,6 +1971,8 @@ slot_stop(struct slot *s) void slot_write(struct slot *s) { + int drop; + if (s->pstate == SLOT_START && s->mix.buf.used == s->mix.buf.len) { #ifdef DEBUG if (log_level >= 4) { @@ -1981,6 +1983,18 @@ slot_write(struct slot *s) s->pstate = SLOT_READY; slot_ready(s); } + drop = s->mix.drop; + slot_mix_drop(s); + while (drop > s->mix.drop) { +#ifdef DEBUG + if (log_level >= 4) { + slot_log(s); + log_puts(": catching play block\n"); + } +#endif + s->ops->fill(s->arg); + drop--; + } } /* @@ -1989,5 +2003,18 @@ slot_write(struct slot *s) void slot_read(struct slot *s) { - /* nothing yet */ + int sil; + + sil = s->sub.silence; + slot_sub_sil(s); + while (sil > s->sub.silence) { +#ifdef DEBUG + if (log_level >= 4) { + slot_log(s); + log_puts(": catching rec block\n"); + } +#endif + s->ops->flush(s->arg); + sil--; + } }