[pulseaudio-discuss] Couldn't set Buffer size for Bluetooth Audio

Shinnosuke Suzuki suzukisn at gmail.com
Thu Jan 4 09:00:47 UTC 2018


Hi

I could not understand what the pulseaudio does.

> Date: Sat, 09 Dec 2017 09:07:05 +0200
> From: Tanu Kaskinen <tanuk at iki.fi>
> To: General PulseAudio Discussion
> 	<pulseaudio-discuss at lists.freedesktop.org>
> Subject: Re: [pulseaudio-discuss] Couldn't set Buffer size for
> 	Bluetooth Audio
> Message-ID: <1512803225.3023.37.camel at iki.fi>
> Content-Type: text/plain; charset="UTF-8"
> 
> On Wed, 2017-12-06 at 20:07 +0900, Shinnosuke Suzuki wrote:
>> Hi,
>> 
>> I'm writing a phone application with bluetooth headset using pulseaudio api.
>> I could create record/playback stream using asynchronous api.
>> 
>> I got media packet from stream callback for record.
>> In this function, I got 96 byte media packet by pa_stream_peek() in stream
>> callback.
>> I expected 320 bytes, because sample format is as follows:
>> static pa_sample_spec sample_spec = {
>>    .format = PA_SAMPLE_S16LE,
>>    .rate = 16000,
>>    .channels = 1
>> };
> 
> I don't understand why you think these parameters would mean that you
> get 320 byte packets.

I misunderstood this. There is no rule to pack voice packet by 320 bytes.

> 
>> I have to send media packet from bluetooth headset to DSP in my board
>> by 320 bytes each.
>> 
>> Is there any way to set media packet size with fix value like 320 bytes?
> 
> I don't think there is. You can set the maximum block size with
> pa_buffer_attr.fragsize, but I think that won't help if the source is
> creating smaller blocks.

I understood.

> 
>> Or Do I have to write program packing the media packet with fixed value
>> in the stream callback?
> 
> I'm not sure what you mean. If you must write 320 bytes at a time and
> pulseaudio is giving you only 96 bytes at a time, then you'll have to
> buffer the data and wait until you've received enough.
> 

I’ll implement to have a buffer the data and wait until the program have received enough.

> -- 
> Tanu
> 
> https://www.patreon.com/tanuk
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180104/2d5cf206/attachment-0001.html>


More information about the pulseaudio-discuss mailing list