[pulseaudio-discuss] Your Pulse Audio "Client sent non-aligned memblock" change

David Henningsson david.henningsson at canonical.com
Mon Nov 10 12:17:30 PST 2014



On 2014-11-10 19:42, Michael Schwendt wrote:
> On Mon, 10 Nov 2014 13:47:47 +0100, David Henningsson wrote:
>
>> In your call to pa_stream_write, you try to send 687 bytes, but with a
>> frame size of 8 (could be e g 32-bit float, stereo), 687 bytes is 85.875
>> frames, i e not an integer number of frames.
>
> That would be unusual and, unfortunately, a reproducer is still lacking
> because of a very poor bug report. I don't see any reason why an odd number
> of bytes would be sent to PA. E.g. I wouldn't expect an audio file decoder to
> return an incomplete frame (here 3 bytes instead of 8).
>
> Also, with the given log messages:
>
>    Nov 10 01:10:49 deer pulseaudio[1780]: [pulseaudio] protocol-native.c: Client
>    sent non-aligned memblock: index 0, length 23, frame size: 8
>    Nov 10 01:10:49 deer pulseaudio[1780]: [pulseaudio] protocol-native.c: Client
>    sent non-aligned memblock: index 23, length 8169, frame size: 8
>
> 8169+23 = 8192 would match the maximum buffer size of what is sent to the
> PA output driver (e.g. as filled by mpg123 input), but pa_stream_write is
> not called with an "index" parameter. So, that one seems to be something
> internal.
>
> Somehow I have the feeling there's another component involved, e.g.
> something inbetween Audacious and Pulse Audio daemon.

I've been trying to look in the pulseaudio client code to see if it 
would for some reason split the package up.

If you did something like:

pa_stream_begin_write(s, &data, ...)
data += 23;
pa_stream_write(s, data, ...)

...that would result in an index parameter of 23. But that seems a bit 
far fetched for a client to do. And still, given a matching libpulse and 
pulseaudio daemon, a length of 23 in the first package should have been 
stopped at the client side anyway.

There is a loop in pa_pstream_send_memblock that can potentially split 
packages, but only does so when the block exceeds a maximum size, which 
is normally 64K minus a few bytes. If your maximum size sent to PA is 8K 
(bytes, not frames), then that is quite far from the 64K limit anyway.

So I'm still not sure how this can happen. Let me know if you find a way 
to reproduce it.

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


More information about the pulseaudio-discuss mailing list