On 10.04.2018 14:52, Luiz Augusto von Dentz wrote:
Hi George,

On Mon, Apr 9, 2018 at 7:16 PM, Georg Chini <ge...@chini.tk> wrote:
Currently the PA bluetooth code calls source_push() for each HSP source packet.
The default HSP MTU is 48 bytes, this means that source_push() is called every
3ms, which leads to increased CPU load especially on embedded systems.

This patch adds a hsp_source_buffer_msec argument to module-bluez5-discover and
module-bluez5-device. The argument gives the number of milliseconds of audio 
are buffered, before source_push() is called. The value can range from 0 to 
and is rounded down to the next multiple of the MTU size. Therefore a value of 
than 2*MTU time corresponds to the original behavior.
Well SCO is, as the name suggests, synchronous or to be more precise
it isochronous so I wonder if this has been tested? It seems to me
this will start to behave like A2DP which buffer frames for a while
before sending, though A2DP is not really for voice where latency may
cause problems like lip sync issues or talking over someone else on a
call because the audio has a few second delay. I get that using 3ms
when the  default-fragment-size-msec is bigger than that may not make
any difference so we should probably use that instead.

The communication between PA and the head set is not changed by the
patch. It is only between PA and the client. Instead of pushing the data to
the client immediately, with this option PA buffers some blocks before
sending them on.

  src/modules/bluetooth/module-bluetooth-discover.c |  1 +
  src/modules/bluetooth/module-bluez5-device.c      | 68 +++++++++++++++++------
  src/modules/bluetooth/module-bluez5-discover.c    | 14 ++++-
  3 files changed, 64 insertions(+), 19 deletions(-)
I do have patches changing the bluez5 modules to bluetooth, I wonder
what happen to that.

If your patch gets into the tree first, I'll re-base my patch (again).
pulseaudio-discuss mailing list

Reply via email to