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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2014-05-06 12:14, Tanu Kaskinen wrote:
> 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.

The intent is to switch when the out buffer is completely empty. Anyway, 
due to the busy loop problem you pointed out I'll change this part for 
next revision.

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux