static void play_packet(struct ausrc_st *st) { int16_t buf[st->sampc]; /* timed read from audio-buffer */ if (aubuf_get_samp(st->aubuf, st->prm.ptime, buf, st->sampc)) return; /* call read handler */ if (st->rh) st->rh(buf, st->sampc, st->arg); }
/* * @note This function has REAL-TIME properties */ static void poll_aubuf_tx(struct audio *a) { size_t sampc = a->tx.psize / 2; struct autx *tx = &a->tx; int16_t *sampv = tx->sampv; struct le *le; int err = 0; /* timed read from audio-buffer */ if (aubuf_get_samp(tx->ab, tx->ptime, tx->sampv, sampc)) return; /* optional resampler */ if (tx->resamp) { size_t sampc_rs = AUDIO_SAMPSZ; err = auresamp_process(tx->resamp, tx->sampv_rs, &sampc_rs, tx->sampv, sampc); if (err) return; sampv = tx->sampv_rs; sampc = sampc_rs; } /* Process exactly one audio-frame in list order */ for (le = a->filtl.head; le; le = le->next) { struct aufilt_st *st = le->data; if (st->af->ench) err |= st->af->ench(st, sampv, &sampc); } /* Encode and send */ encode_rtp_send(a, tx, sampv, sampc); }