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 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. > 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. -- Tanu https://www.patreon.com/tanuk