[pulseaudio-discuss] [PATCH 00/12] A new ringbuffer based protocol for PulseAudio

Peter Meerwald pmeerw at pmeerw.net
Mon Jun 16 16:01:35 PDT 2014


Hello,

> Third iteration.

paplay --latency-msec XXX audio_s16_2ch_44k1.wav
on beagleboard-xm @ 1 GHz, kernel 3.15

        srbchannel              iochannel
XXX     PA      ALSA    paplay  PA      ALSA    paplay
20      FAIL    FAIL    FAIL    30.0    19.3    7.7 
30      20.9    14.5    3.8     24.5    15.1    6.8
40      15.8    11.1    2.8     17.5    11.4    4.9
60      7.8     5.4     1.4     9.1     5.6     2.6
80      6.0     4.0     1.1     7.0     4.2     1.8
100     4.9     3.2     1.0     6.0     3.4     2.0
150     2.6     1.8     0.6     3.2     1.8     1.2
200     1.7     1.2     0.5     2.0     1.2     0.8

I disabled srbchannel by setting module-native-protocol-unix argument 
srbchannel=no

so there is an improvement, esp. for low latency

the FAIL manifests itself in 
D: [alsa-sink-TWL4030 HiFi twl4030-hifi-0] source.c: Processing rewind...
E: [alsa-sink-TWL4030 HiFi twl4030-hifi-0] memblock.c: Assertion 'pa_atomic_load(&b->n_acquired) == 0'
failed at pulsecore/memblock.c:532, function memblock_free(). Aborting.   

this is quite reproducible, and only occurs with srbchannel=yes
--latency-msec 23 is OK, while --latency-msec 20 crashes within seconds

I have not really looked into it (yet)

some comments below, and cleanup patches following

> Changes since previous version:
> 
>  * it's now srbchannel (Shared RingBuffer) instead of srchannel
>    (srchannel could easily be read as src-hannel)

internal variables and function still named srsomething, should probably 
be renamed srbsomething

e.g. in struct pa_pstream:
pa_srbchannel *sr, *srpending; 
bool is_srpending;

sr_callback(), check_srpending() in pstream.c
 
>  * srbchannel test added on pstream level, also tests the pstream on
>    the iochannel btw.
> 
>  * protocol-native has a new module parameter "srbchannel", which defaults
>    to true. Set it to false to use the iochannel only.
> 
>  * srbchannel setup is now acked by client, and packets are sent in a
>    different order. No srbchannel without both parties agreeing on it.
> 
>  * Pstream: fixed the actual switching to be slightly more robust, and
>    only happening when the output buffer is empty.
> 
>  * fixed pa_iochannel_read_with_ancil to fall back to pa_iochannel_read
>    in case it was called on a non-socket.
> 
> David Henningsson (11):
>   creds: Add struct for ancillary data
>   iochannel/pstream/pdispatch: Add support for receiving file
>     descriptors
>   iochannel/pstream: Support sending file descriptors
>   srbchannel: Add the shared ringbuffer object
>   shm: Allow to open shm in writable mode
>   memblock, pstream: Allow send/receive of remote writable memblocks
>   core: Add a second rw mempool
>   pstream: Allow reading/writing through srbchannel
>   Protocol, client: Add commands to enable srbchannel
>   protocol-native: Enable srbchannel
>   tests: Add pstream/srbchannel test
> 
> Peter Meerwald (1):
>   tests: Adapt memblock-test to changed pa_memimport_get()
> 
>  PROTOCOL                           |  20 +++
>  configure.ac                       |   2 +-
>  src/Makefile.am                    |   9 +-
>  src/modules/module-protocol-stub.c |   6 +-
>  src/modules/module-tunnel.c        |   4 +-
>  src/pulse/context.c                | 112 ++++++++++++-
>  src/pulse/internal.h               |   3 +
>  src/pulsecore/core.c               |  14 +-
>  src/pulsecore/core.h               |   5 +-
>  src/pulsecore/creds.h              |  13 ++
>  src/pulsecore/iochannel.c          |  85 ++++++++--
>  src/pulsecore/iochannel.h          |   3 +-
>  src/pulsecore/memblock.c           |  40 ++++-
>  src/pulsecore/memblock.h           |   6 +-
>  src/pulsecore/native-common.h      |   5 +
>  src/pulsecore/pdispatch.c          |  26 ++-
>  src/pulsecore/pdispatch.h          |   4 +-
>  src/pulsecore/protocol-native.c    |  79 ++++++++-
>  src/pulsecore/protocol-native.h    |   1 +
>  src/pulsecore/pstream-util.c       |  31 +++-
>  src/pulsecore/pstream-util.h       |   1 +
>  src/pulsecore/pstream.c            | 317 ++++++++++++++++++++++++-------------
>  src/pulsecore/pstream.h            |   9 +-
>  src/pulsecore/shm.c                |  12 +-
>  src/pulsecore/shm.h                |   2 +-
>  src/pulsecore/srbchannel.c         | 305 +++++++++++++++++++++++++++++++++++
>  src/pulsecore/srbchannel.h         |  62 ++++++++
>  src/tests/memblock-test.c          |   4 +-
>  src/tests/srbchannel-test.c        | 138 ++++++++++++++++
>  29 files changed, 1163 insertions(+), 155 deletions(-)
>  create mode 100644 src/pulsecore/srbchannel.c
>  create mode 100644 src/pulsecore/srbchannel.h
>  create mode 100644 src/tests/srbchannel-test.c
> 
> 

-- 

Peter Meerwald
+43-664-2444418 (mobile)


More information about the pulseaudio-discuss mailing list