<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi<div class=""><br class=""></div><div class="">I could not understand what the pulseaudio does.</div><div class=""><div class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br class=""></div></div><div><blockquote type="cite" class=""><div class="">Date: Sat, 09 Dec 2017 09:07:05 +0200</div><div class=""><div class="">From: Tanu Kaskinen <<a href="mailto:tanuk@iki.fi" class="">tanuk@iki.fi</a>><br class="">To: General PulseAudio Discussion<br class=""><span class="Apple-tab-span" style="white-space:pre">    </span><<a href="mailto:pulseaudio-discuss@lists.freedesktop.org" class="">pulseaudio-discuss@lists.freedesktop.org</a>><br class="">Subject: Re: [pulseaudio-discuss] Couldn't set Buffer size for<br class=""><span class="Apple-tab-span" style="white-space:pre">     </span>Bluetooth Audio<br class="">Message-ID: <<a href="mailto:1512803225.3023.37.camel@iki.fi" class="">1512803225.3023.37.camel@iki.fi</a>><br class="">Content-Type: text/plain; charset="UTF-8"<br class=""><br class="">On Wed, 2017-12-06 at 20:07 +0900, Shinnosuke Suzuki wrote:<br class=""><blockquote type="cite" class="">Hi,<br class=""><br class="">I'm writing a phone application with bluetooth headset using pulseaudio api.<br class="">I could create record/playback stream using asynchronous api.<br class=""><br class="">I got media packet from stream callback for record.<br class="">In this function, I got 96 byte media packet by pa_stream_peek() in stream<br class="">callback.<br class="">I expected 320 bytes, because sample format is as follows:<br class="">static pa_sample_spec sample_spec = {<br class="">    .format = PA_SAMPLE_S16LE,<br class="">    .rate = 16000,<br class="">    .channels = 1<br class="">};<br class=""></blockquote><br class="">I don't understand why you think these parameters would mean that you<br class="">get 320 byte packets.<br class=""></div></div></blockquote><div><br class=""></div><div>I misunderstood this. There is no rule to pack voice packet by 320 bytes.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">I have to send media packet from bluetooth headset to DSP in my board<br class="">by 320 bytes each.<br class=""><br class="">Is there any way to set media packet size with fix value like 320 bytes?<br class=""></blockquote><br class="">I don't think there is. You can set the maximum block size with<br class="">pa_buffer_attr.fragsize, but I think that won't help if the source is<br class="">creating smaller blocks.<br class=""></div></div></blockquote><div><br class=""></div><div>I understood.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">Or Do I have to write program packing the media packet with fixed value<br class="">in the stream callback?<br class=""></blockquote><br class="">I'm not sure what you mean. If you must write 320 bytes at a time and<br class="">pulseaudio is giving you only 96 bytes at a time, then you'll have to<br class="">buffer the data and wait until you've received enough.<br class=""><br class=""></div></div></blockquote><div><br class=""></div><div>I’ll implement to have a buffer the data and wait until the program have received enough.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">-- <br class="">Tanu<br class=""><br class=""><a href="https://www.patreon.com/tanuk" class="">https://www.patreon.com/tanuk</a><br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>