[pulseaudio-discuss] [PATCH 0/2] Fix handling of bigger-than-expected writes, and modify pacat to write in bigger chunks

Tanu Kaskinen tanuk at iki.fi
Wed Dec 28 14:09:53 UTC 2016


The first patch reverts the commit that broke the handling of
bigger-than-expected writes. Ahmed Darwish suggested[1] to just allow
pa_memblockq.requested to go into negative values, which fixes the
issue, but I'm not sure that's the only thing that broke, so reverting
the whole commit seems safer.

I'm in particular concerned about this change:

In the original code write_index_changed() did this:

    delta = bq->write_index - old_write_index;
    if (account)
        bq->requested -= delta;
    else
        bq->missing -= delta;

That was changed to this in the broken commit:

    delta = bq->write_index - old_write_index;
    if (account) {
        if (delta > (int64_t)bq->requested)
            bq->requested = 0;
        else if (delta > 0)
            bq->requested -= delta;
    }

With Ahmed's suggestion the code would look like this:

    delta = bq->write_index - old_write_index;
    if (account)
        bq->requested -= delta;

That would be the same as in the original code, but without doing
anything in case "account" is false. That seems like something that
could very well affect the behaviour, while the original intent of the
reverted commit was just to do some refactoring, not to change any
behaviour.

The second patch modifies pacat to write in bigger chunks. The modified
pacat can be used to test the case that broke:
"pacat --verbose --latency-msec=40 /dev/zero" causes the stream to stop
if the the server doesn't have a fix applied.

[1] https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-December/027273.html

Tanu Kaskinen (2):
  Revert "memblockq: remove internal "missing" state variable"
  pacat: write as much as possible in one go

 src/pulsecore/memblockq.c | 51 ++++++++++++++++++++++-------------------------
 src/utils/pacat.c         |  4 ++--
 2 files changed, 26 insertions(+), 29 deletions(-)

-- 
2.10.2



More information about the pulseaudio-discuss mailing list