[pulseaudio-discuss] Assertion failure pa_frame_aligned(nbytes, &i->sink->sample_spec)

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Fri Mar 20 10:48:13 PDT 2015


On Fri, 2015-03-20 at 08:04 +1100, Brendon Costa wrote:
> Hi all,
> 
> I am developing a pulse audio sink module for a custom networked audio
> device I have.
> 
> This device only supports a very specific format: 3 channel
> PA_SAMPLE_S16NE @ 32000Hz and uses a custom TCP protocol.
> 
> I am using the esound-sink module as a basis to develop my one and
> have setup my pa_sample_spec accordingly. The module starts up,
> pushing silence through to the device fine. 
> 
> However when I try and connect a music player source to it I get the
> following assertion:
> 
> sink-input.c: Assertion 'pa_frame_aligned(nbytes,
> &i->sink->sample_spec)' failed at pulsecore/sink-input.c:1168,
> function pa_sink_input_update_max_request(). Aborting.
> 
> I couldn't make much sense of this assertion. Is someone able to help
> me out with its meaning/cause?

The assertion means that the nbytes parameter of
pa_sink_input_update_max_request() was not a multiple of the size of one
frame. If the sink in question is the sink that you're developing, i.e.
the audio format is 3 channels with 16-bit samples, the size of one
frame is 6 bytes. Check who called the function and why it gave a number
that is not a multiple of 6.

> My original guess is that it is related to this specific sample spec
> not matching the music players source spec (though weird that such an
> error would be an assertion so I am probably wrong).
> 
> Is pulse audio supposed to auto "match" sample specs between sinks and
> sources?

You probably mean "sink inputs" instead of "sources". A music player
application is represented by a "sink input". A "source" would be a
capture device.

But to answer your question: yes, when the audio format of a sink input
doesn't match the format of the sink, the audio is automatically
converted to the right format.

-- 
Tanu




More information about the pulseaudio-discuss mailing list