On 08.02.2018 12:06, Shinnosuke Suzuki wrote:
Hi

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

Can't you use a newer version? We are at 11.1 already and the
bluetooth code has changed significantly.


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 Headset

When you record from the BT headset, the BT headset is set to HSP/HFP.
This means that recording and playback stream are at 8kHz, not 16kHz.
Pulseaudio only supports CVSD codec, not mSBC.


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
 resample-method=trivial

resample-method=trivial might result in bad audio quality.
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to