[pulseaudio-discuss] pa_mix 32Bit write for S16NE format

kuldeep ghan ghankp at gmail.com
Wed Aug 17 03:28:23 PDT 2011


I get same bus error when trying to play two streams using paplay also.
I have verified that Its due to 16 Bit write to 32 bit aligned Memory. My
main concern is,
what am I doing wrong in writing two 16Bit samples to simulate 32Bit write.

Regards,
Kuldeep

On Wed, Aug 17, 2011 at 2:08 PM, kuldeep ghan <ghankp at gmail.com> wrote:

>
>
> On Wed, Aug 17, 2011 at 1:51 PM, Arun Raghavan <
> arun.raghavan at collabora.co.uk> wrote:
>
>> On Wed, 2011-08-17 at 13:34 +0530, kuldeep ghan wrote:
>> > Hi,
>> >
>> >   I am working on a setup which has Linux Kernel running and I have
>> > pulseaudio as Sound server. ASoc Alsa driver snd_pcm_mmap function
>> > returns me
>> >  Virtual Memory mapped to physical memory which is strictly 32 Bit
>> > Aligned.
>>
>> Out of curiosity, what platform is this?
>>
> I am using OMAP4 platform.
>
>>
>> >   When I am trying to Mix two streams with gst-launch, pa_mix function
>> > tries to write 16Bit mixed samples to this physical memory resulting
>> > in Bus error.
>> >
>> >   As a work around I am trying following code which is trying to write
>> > two Mixed 16Bit samples write making it a 32Bit write.
>> > src/pulsecore/sample-util.c
>> >
>> >              //  *((int16_t*) data) = (int16_t) sum;
>> >                 if(j==0) {
>> >                        temp[0]=(int16_t) sum;
>> >                        j=1;
>> >                } else {
>> >                         temp[1]=(int16_t) sum;
>> >                          j=0;
>> >                         sum = ((temp[1] << 16) | (0x0000FFFF &
>> > temp[0]));
>> >
>> >                         data = (uint8_t*) data - sizeof(int16_t);
>> >                        *((int32_t*) data) = (int32_t) sum;
>> >                         data = (uint8_t*) data + sizeof(int16_t);
>> >                }
>> >
>> > With this I am able to mix a gst-launch stream and already loaded
>> > sample from pulseaudio played with play-sample from pacmd.
>> > But not able to mix two streams with gst-launch.
>>
>> What is the error you see when playing 2 streams? Do two instances of
>> paplay work fine together?
>>
> The error I see is
> "Unhandled fault: external abort on non-linefetch (0x1818) at 0x40013000"
>
>
>>
>> BTW, Another potential workaround (if your hardware supports it), is to
>> force the default sample spec to use S32NE samples (you can edit the
>> default value in /etc/pulse/daemon.conf). The downside is obviously that
>> you're transferring 2x the amount of data that you'd have done with
>> S16LE samples and the format conversion cost for just about every
>> client.
>>
>
> I have tried using S32NE as default format but it Causes
> under-runs/over-runs.
> As I am new to ALSA subsystem and PulseAudio I am yet to figure out how to
> get those under-runs/over-runs solved?
>
>
>>
>> Unless there's more hardware out there with this sort of limitation (I
>> don't believe there is), I wouldn't be too keen on adding this sort of
>> workaround upstream.
>>
>> Regards,
>> Arun
>>
>> _______________________________________________
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>>
>
> Thanks,
> Kuldeep
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110817/1d4acff5/attachment.htm>


More information about the pulseaudio-discuss mailing list