summaryrefslogtreecommitdiff
path: root/src/audio.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-11-06 23:01:23 +0100
committerAlfred E. Heggestad <aeh@db.org>2015-11-06 23:01:23 +0100
commitfe6edee8d7b76b98c41a3792c143a8656af46b52 (patch)
tree7205934c5bdcc8ba28ecfc75b0c292c4af3634cf /src/audio.c
parentab85d243e33707fe7e9ac8f921ca3b00a77d505e (diff)
audio: flush tx-buffer for all tx-modes
thanks to Thibault Gueslin for reporting the bug and suggestion a nice fix
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/audio.c b/src/audio.c
index 5e4d390..e162884 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -740,6 +740,8 @@ int audio_alloc(struct audio **ap, const struct config *cfg,
static void *tx_thread(void *arg)
{
struct audio *a = arg;
+ struct autx *tx = &a->tx;
+ unsigned i;
/* Enable Real-time mode for this thread, if available */
if (a->cfg.txmode == AUDIO_MODE_THREAD_REALTIME)
@@ -747,7 +749,13 @@ static void *tx_thread(void *arg)
while (a->tx.u.thr.run) {
- poll_aubuf_tx(a);
+ for (i=0; i<16; i++) {
+
+ if (aubuf_cur_size(tx->aubuf) < tx->psize)
+ break;
+
+ poll_aubuf_tx(a);
+ }
sys_msleep(5);
}
@@ -760,10 +768,18 @@ static void *tx_thread(void *arg)
static void timeout_tx(void *arg)
{
struct audio *a = arg;
+ struct autx *tx = &a->tx;
+ unsigned i;
tmr_start(&a->tx.u.tmr, 5, timeout_tx, a);
- poll_aubuf_tx(a);
+ for (i=0; i<16; i++) {
+
+ if (aubuf_cur_size(tx->aubuf) < tx->psize)
+ break;
+
+ poll_aubuf_tx(a);
+ }
}