[pulseaudio-discuss] [PATCH 09/11] pstream: Allow reading/writing through srchannel

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Tue May 6 03:14:13 PDT 2014


On Tue, 2014-04-29 at 15:22 +0200, David Henningsson wrote:
> +void pa_pstream_set_srchannel(pa_pstream *p, pa_srchannel *sr) {
> +    pa_assert(p);
> +    pa_assert(PA_REFCNT_VALUE(p) > 0);
> +
> +    if (sr == p->sr)
> +        return;
> +
> +    /* Make sure we flush the queue, so we don't write half a package on one channel and half on the other */
> +    while (!p->dead && (do_write(p) > 0 || p->write.current)) {
> +        pa_log_debug("Flushing commands before %s srchannel...", sr ? "setting up" : "tearing down");
> +    }

Is your intention to write all pending packets or just the current
packet? The log message implies the former, but the logic implies the
latter.

What if the write buffer is full? As far as I can see, this will then
busy-loop, and if the other end doesn't read, this will busy-loop
forever.

-- 
Tanu



More information about the pulseaudio-discuss mailing list