[pulseaudio-discuss] Sample format spec with Linear 16bit 16kHz

Shinnosuke Suzuki suzukisn at gmail.com
Thu Feb 8 11:06:10 UTC 2018


I am developing a phone app using pulseaudio 6.0 with asynchronous API
using Bluetooth Headset.

I create a record stream with pa_stream_new() with this parameter.
 static pa_sample_spec samplespec = {
     .format = PA_SAMPLE_S16LE, /* Linear 16bit */
     .rate = 16000, /* 16000Hz */
     .channels = 1 /* mono */
And I set a callback function by pa_stream_set_read_callback().
After the stream created, I could get a voice data by 96byte per 10ms in
this callback.I checked a log with clock_gettime() in this callback.

I think I get voice packet by 320Byte per 10ms.
16000Hz * 1 * 16bit = 256kbps = 32KBps
This means that I can get 320Byte per 10ms.
So I need to get 320Byte per 10ms.

I set sample format above, but I got different voice packet from callback.
I would like to get a voice with Linear 16bit 16kHz mono.
Is there additional configuration to this codec?

For confirmation, when I use a bluetooth headset, Is this correct the
pulseaudio convert codec from SBC to Linear as follows?
My app <- Linear 16bit 16kHz <- Pulseaudio  <- SBC codec <- Bluetooth

And addition to that, After stream connected, CPU load for pulseaudio
rose up 50%-60%.CPU load for MyAPP rose up 20%-30%.
In order to reduce CPU load, I conigure as follows:
 high-priority = no
 realtime-scheduling = no

Best Regards,
Shinnosuke Suzuki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180208/f5f67e27/attachment.html>

More information about the pulseaudio-discuss mailing list