[pulseaudio-discuss] COMPILATION: configure: error: git-version-gen failed

2019-10-16 Thread Sathish Narasimman
Hi,

I am facing problem with compiling PulseAudio.

/git-version-gen: Failed to determine git revision
./git-version-gen: Failed to determine git revision
./git-version-gen: Failed to determine git revision
./git-version-gen: Failed to determine git revision
./git-version-gen: Failed to determine git revision
./git-version-gen: Failed to determine git revision
./git-version-gen: Failed to determine git revision
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:106: warning: The 'AM_PROG_MKDIR_P' macro is deprecated,
and its use is discouraged.
configure.ac:106: You should use the Autoconf-provided
'AC_PROG_MKDIR_P' macro instead,
configure.ac:106: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your
Makefile.am files.
configure.ac:82: installing 'build-aux/compile'
configure.ac:29: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
configure: error: git-version-gen failed

Am I missing any dependency package.
Happens only from PA 12

Regards,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Re: [pulseaudio-discuss] Current status of wideband speech?

2019-04-15 Thread Sathish Narasimman
Hi,

You need backend Ofono with bluez to support WBS.
You can see that CODEC is not selected.

HINT: Make sure the HF AG is up and running to Support WBS

Regards,
Sathish N

On Mon, Apr 15, 2019 at 2:18 PM diego.ml  wrote:
>
> Hi Ta-Lun,
>
> sorry for the late reply.
>
>   On ven, 22 feb 2019 17:27:09 +0100 Ta-Lun Yen  wrote 
> 
>  > Diego,
>  >
>  > Thanks for the info. Seems like I am missing something here, since it will 
> error on entering HSP/HFP mode:
>  >
>  > I: [bluetooth] module-bluez5-device.c: Transport 
> /org/bluez/hci0/dev_/fd45 resuming
>  > D: [bluetooth] module-bluez5-device.c: Stream properly set up, we're ready 
> to roll!
>  > E: [bluetooth] module-bluez5-device.c: Invalid codec for encoding: 0
>  > D: [bluetooth] module-bluez5-device.c: IO thread failed
>  > D: [lt-pulseaudio] sink.c: bluez_sink..headset_head_unit: state: 
> INIT -> IDLE
>  > D: [lt-pulseaudio] source.c: 
> bluez_sink..headset_head_unit.monitor: state: INIT -> IDLE
>  > D: [lt-pulseaudio] module-device-restore.c: Could not set format on sink 
> bluez_sink..headset_head_unit
>  > D: [lt-pulseaudio] module-bluetooth-policy.c: Profile headset_head_unit 
> cannot be selected for loopback
>  > D: [lt-pulseaudio] module-suspend-on-idle.c: Sink 
> bluez_sink..headset_head_unit becomes idle, timeout in 5 seconds.
>  >
>
> I haven't experienced that problem.
>
> Let me add the original author to see if he has any comment.
>
> Regards,
> Diego
>
>
>  >
>  >
>  > ‐‐‐ Original Message ‐‐‐
>  > On Wednesday, February 13, 2019 11:11 PM, diego.ml via pulseaudio-discuss 
>  wrote:
>  >
>  > > Hi Ta-Lun,
>  > >
>  > > actually there's an updated patch for Wide Band mSBC codec support:
>  > > https://patchwork.freedesktop.org/patch/245272/
>  > > It should apply cleanly on master if you want to test it / improve it.
>  > >
>  > > If you're working on 12.2, you'll also need to backport this commit (git 
> cherry-pick will do):
>  > > 
> https://github.com/pulseaudio/pulseaudio/commit/fb600395e1e13ef68e36153faf02bda287927ae2
>  > >
>  > > Personally I've backported the patch to 12.2 and it worked fine so far 
> with a Broadcom / Cypress chip (Sterling LWB5 module).
>  > >
>  > > Bests,
>  > > Diego
>  > >
>  > >  On lun, 11 feb 2019 08:28:07 +0100 Ta-Lun Yen e...@evsfy.com wrote 
> 
>  > >
>  > > > Currently, it seems there's no support for mSBC codec in PulseAudio 
> (as for latest master).
>  > >
>  > > > Please correct me if I'm wrong about this.
>  > >
>  > > >
>  > >
>  > > > We have only CVSD support which only does 8000kHz on each direction, 
> thus making everything sounds "vintage", even if device actually supports 
> mSBC codec.
>  > >
>  > > >
>  > >
>  > > > However, I've seen previous threads from 2013 discussing about 
> implementation of mSBC codec, and I wonder if we still have plans to 
> implement them?
>  > >
>  > > >
>
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Re: [pulseaudio-discuss] [PATCH v3] bluetooth: Wide Band Speech implementaion for backend ofono

2018-08-20 Thread Sathish Narasimman
Hi James,

On Mon, Aug 20, 2018 at 8:19 PM James Bottomley <
james.bottom...@hansenpartnership.com> wrote:

> On Mon, 2018-08-20 at 19:19 +0530, Sathish Narasimman wrote:
> > From: Sathish Narasimman 
> >
> > mSBC-encoded streams for HFP. The Wide Band Speech(WBS) encoding and
> > decoding
> > is implemeted with this patch. This patch was refered from original
> > patch of Joao Paula Rechi Vita and was verified with the supported
> > bluetooth controller.
>
> Which headset did you test this with?  When I try it with an LG 900 I
> get a huge amount of chop which shreds the audio quality.  For this
> headset the packet size (MTU) still needs to be set at 48 on both the
> send and receive side otherwise the audio doesn't work at all.
>
I used Jabra EasyGo GNM-OTE4 bluetooth headset.
This patch is refered w.r.t to USB transport.
For USB transport - As per core spec 5, vol 4, Part B Table 2.1(this was
the only reference in core spec for USB transport- please correct me if i
am wrong)
for msbc voice channel it should be 63bytes along with Usb header. So the
host
should send 60 bytes of msbc audio.

>
> What seems to be happening is that the LG insists on running the eSCO
> links at full speed but the encoded packets only take about half the
> bandwidth, so on the headset receiving side, we get about half as many
> mSBC encoded packets with the rest being zero padded.
>
> The problem occurs because on the receive side you count mSBC packets,
> so the reader/writer thread you try to send 1 mSBC encoded packet for
> every 1 mSBC packet you receive.
>
> But in this send loop:
>
> > +/* Send MTU bytes of it, if there is more it will send later
> > */
> > +while (u->msbc_info.ebuffer_start + u->write_link_mtu <= u-
> > >msbc_info.ebuffer_end) {
> > +l = pa_write(u->stream_fd,
> > + u->msbc_info.ebuffer + u-
> > >msbc_info.ebuffer_start,
> > + u->write_link_mtu,
> > + >stream_write_type);
> > +
> > +wrote = true;
> > +if (l <= 0) {
> > +pa_log_debug("Error while writing: l %d, errno %d",
> > l, errno);
> > +break;
> > +}
> > +
> > +u->msbc_info.ebuffer_start += l;
> > +if (u->msbc_info.ebuffer_start >= u-
> > >msbc_info.ebuffer_end)
> > +u->msbc_info.ebuffer_start = u-
> > >msbc_info.ebuffer_end = 0;
> > +}
> > +
> > +pa_memblock_release(u->write_memchunk.memblock);
> > +
> > +if (wrote && l < 0) {
> > +
> > +if (errno == EINTR)
> > +/* Retry right away if we got interrupted */
> > +continue;
> > +
> > +else if (errno == EAGAIN)
> > +/* Hmm, apparently the socket was not writable, give
> > up for now */
> > +break;
> > +
> > +pa_log_error("Failed to write data to SCO socket: %s",
> > pa_cstrerror(errno));
> > +ret = -1;
> > +break;
> > +}
> > +
> > +if ((size_t) l != (size_t)u->write_link_mtu) {
> > +pa_log_error("Wrote memory block to socket only
> > partially! %llu written, wanted to write %llu.",
> > +(unsigned long long) l,
> > +(unsigned long long) u->write_link_mtu);
> > +ret = -1;
> > +break;
> > +}
> > +
> > +u->write_index += (uint64_t) u->write_memchunk.length;
> > +
> > +pa_memblock_unref(u->write_memchunk.memblock);
> > +pa_memchunk_reset(>write_memchunk);
> > +
> > +ret = 1;
> > +break;
> > +}
>
> Because the mtu is 48 and the mSBC encode size is 60, the transmission
> stops after 48 bytes, we now wait for a new mSBC packet to be received,
> so we miss the next eSCO transmission window and the headset fills in
> with zeros causing the packet to be chopped and the next one to be
> discarded as invalid.
>
> I suspect the only way to get mSBC to work for this type of headset is
> to count actual received packets, always to transmit full 60 byte mSBC
> packets in adjacent frames and to pad with zeros if we're not ready.
>
I tried to get the MTU negotiation from the kernel.
Though getsockopt was not implemented to provide the required MTU from the
BT kernel.
I tried to implement that part to get the right MTU from 

[pulseaudio-discuss] [PATCH v3] bluetooth: Wide Band Speech implementaion for backend ofono

2018-08-20 Thread Sathish Narasimman
From: Sathish Narasimman 

mSBC-encoded streams for HFP. The Wide Band Speech(WBS) encoding and decoding
is implemeted with this patch. This patch was refered from original
patch of Joao Paula Rechi Vita and was verified with the supported
bluetooth controller.

Signed-off-by: Sathish Narasimman 
---
---
 src/modules/bluetooth/backend-ofono.c|  20 +-
 src/modules/bluetooth/module-bluez5-device.c | 372 ++-
 2 files changed, 378 insertions(+), 14 deletions(-)

diff --git a/src/modules/bluetooth/backend-ofono.c 
b/src/modules/bluetooth/backend-ofono.c
index 1f0efe9..a836779 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -164,7 +164,7 @@ static int card_acquire(struct hf_audio_card *card) {
   DBUS_TYPE_BYTE, ,
   DBUS_TYPE_INVALID) == true)) {
 dbus_message_unref(r);
-if (codec != HFP_AUDIO_CODEC_CVSD) {
+if (codec != HFP_AUDIO_CODEC_CVSD && codec != HFP_AUDIO_CODEC_MSBC) {
 pa_log_error("Invalid codec: %u", codec);
 /* shutdown to make sure connection is dropped immediately */
 shutdown(fd, SHUT_RDWR);
@@ -250,10 +250,17 @@ static int 
hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
  * value from the Isoc USB endpoint in use by btusb and should be
  * made available to userspace by the Bluetooth kernel subsystem.
  * Meanwhile the empiric value 48 will be used. */
-if (imtu)
-*imtu = 48;
-if (omtu)
-*omtu = 48;
+if (t->codec == HFP_AUDIO_CODEC_MSBC) {
+if (imtu)
+*imtu = 60;
+if (omtu)
+*omtu = 60;
+} else {
+if (imtu)
+*imtu = 48;
+if (omtu)
+*omtu = 48;
+   }
 
 err = socket_accept(card->fd);
 if (err < 0) {
@@ -464,6 +471,7 @@ static void hf_audio_agent_register(pa_bluetooth_backend 
*hf) {
 pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/", 
HF_AUDIO_MANAGER_INTERFACE, "Register"));
 
 codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
+codecs[ncodecs++] = HFP_AUDIO_CODEC_MSBC;
 
 pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH, , 
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, , ncodecs,
   DBUS_TYPE_INVALID));
@@ -611,7 +619,7 @@ static DBusMessage 
*hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
 
 card->connecting = false;
 
-if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
+if (!card || (codec != HFP_AUDIO_CODEC_CVSD && codec != 
HFP_AUDIO_CODEC_MSBC) || card->fd >= 0) {
 pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, 
codec=%d)", path, fd, codec);
 pa_assert_se(r = dbus_message_new_error(m, 
"org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
 shutdown(fd, SHUT_RDWR);
diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index 9dbdca3..a404709 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -57,6 +57,9 @@ PA_MODULE_LOAD_ONCE(false);
 PA_MODULE_USAGE("path="
 "autodetect_mtu=");
 
+#define HFP_AUDIO_CODEC_CVSD0x01
+#define HFP_AUDIO_CODEC_MSBC0x02
+
 #define FIXED_LATENCY_PLAYBACK_A2DP (25 * PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_PLAYBACK_SCO  (25 * PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_RECORD_A2DP   (25 * PA_USEC_PER_MSEC)
@@ -106,6 +109,28 @@ typedef struct sbc_info {
 size_t buffer_size;  /* Size of the buffer */
 } sbc_info_t;
 
+struct msbc_parser {
+int len;
+uint8_t buffer[60];
+};
+
+/* This structure to be moved to libsbc in the future */
+typedef struct msbc_info {
+bool msbc_initialized;   /* Keep track if the encoder is 
initialized */
+sbc_t sbcenc;/* Encoder data */
+uint8_t *ebuffer;/* Codec transfer buffer */
+size_t ebuffer_size; /* Size of the buffer */
+size_t ebuffer_start;/* start of encoding data */
+size_t ebuffer_end;  /* end of encoding data */
+
+struct msbc_parser parser;   /* mSBC parser for concatenating 
frames */
+sbc_t sbcdec;/* Decoder data */
+
+size_t msbc_frame_size;
+size_t decoded_frame_size;
+
+} msbc_info_t;
+
 struct userdata {
 pa_module *module;
 pa_core *core;
@@ -147,6 +172,7 @@ struct userdata {
 pa_memchunk write_memchunk;
 pa_sample_spec sample_spec;
 struct sbc_info sbc_info;
+struct msbc_info msbc_info;
 };
 
 typedef enum pa_bluetooth_form_factor {
@@ -251,6 +277,215 @@ static void connect_ports(struct userdata *u, void 
*new_data, p

Re: [pulseaudio-discuss] [PATCH v2] bluetooth: Wideband speech implementaion

2018-08-20 Thread Sathish Narasimman
On Mon, Aug 20, 2018 at 7:06 PM Ahmed S. Darwish 
wrote:

> On Mon, Aug 20, 2018 at 3:16 PM Sathish Narasimman 
> wrote:
> >
> > hi,
> >
> > Sorry, I am getting confused here. the format I understood was
> > In the commit format, may I follow as below format. Please let me know
> if it is correct. If so, i will submit the v3
>
> Please don't top-post:
>
> http://www.idallen.com/topposting.html
>
> > --
> >
> > bluetooth: wideband speech implementation
> >
>
> Yes, that would be the subject line.
>
> > From: Sathish Narasimman 
> >
> > mSBC-encoded streams for HFP. The wideband speec encoding and decoding
> > is implemeted with this patch. This patch was refered from original
> > patch of Joao Paula Rechi Vita and was verified with the supported
> > bluetooth controller.
> >
> > Signed-off-by: Sathish Narasimman 
>
> Yes, that would be the body, along with three dashes '---' after
> the S-o-b line.
>
> Thanks,
>
> --
> Darwish
> http://darwish.chasingpointers.com


Thanks for the guide. I will submit v3
So, these rules apply only if it is s-o-b?

If so. It would be helpful if the PA link is updated .
https://www.freedesktop.org/wiki/Software/PulseAudio/HowToUseGitSendEmail/

Thanks,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] bluetooth: Wideband speech implementaion

2018-08-20 Thread Sathish Narasimman
hi,

Sorry, I am getting confused here. the format I understood was
In the commit format, may I follow as below format. Please let me know if
it is correct. If so, i will submit the v3
--

bluetooth: wideband speech implementation

From: Sathish Narasimman 

mSBC-encoded streams for HFP. The wideband speec encoding and decoding
is implemeted with this patch. This patch was refered from original
patch of Joao Paula Rechi Vita and was verified with the supported
bluetooth controller.

Signed-off-by: Sathish Narasimman 
 
-

On Mon, Aug 20, 2018 at 6:21 PM Ahmed S. Darwish 
wrote:

> Hi!
>
> On Thu, Aug 16, 2018 at 11:08 AM Sathish Narasimman
>  wrote:
> >
> > mSBC-encoded streams for HFP. The wideband speec encoding and decoding
> > is implemeted with this patch. This patch was refered from original
> > patch of Joao Paula Rechi Vita and was verified with the supported
> > bluetooth controller.
> >
> > Signed-off-by: Sathish Narasimman 
> > ---
>
> Small note; please add below tag as the email body __first line__:
>
> From: Sathish Narasimman 
>
> Then an empty line, then the normal commit log, then the S-o-b.
>
> Otherwise this patch will be credited to your personal gmail account
> rather than Intel, which given the S-o-b seems not to be what is
> intended.
>
> Thanks,
>
> --
> Ahmed S. Darwish
> http://darwish.chasingpointers.com
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] bluetooth: Wideband speech implementaion

2018-08-20 Thread Sathish Narasimman
Hi,

Any comment over this patch?
may I know the blocking?


On Thu, Aug 16, 2018 at 2:37 PM Sathish Narasimman 
wrote:

> mSBC-encoded streams for HFP. The wideband speec encoding and decoding
> is implemeted with this patch. This patch was refered from original
> patch of Joao Paula Rechi Vita and was verified with the supported
> bluetooth controller.
>
> Signed-off-by: Sathish Narasimman 
> ---
>  src/modules/bluetooth/backend-ofono.c|  20 +-
>  src/modules/bluetooth/module-bluez5-device.c | 372
> ++-
>  2 files changed, 378 insertions(+), 14 deletions(-)
>
> diff --git a/src/modules/bluetooth/backend-ofono.c
> b/src/modules/bluetooth/backend-ofono.c
> index 1f0efe9..a836779 100644
> --- a/src/modules/bluetooth/backend-ofono.c
> +++ b/src/modules/bluetooth/backend-ofono.c
> @@ -164,7 +164,7 @@ static int card_acquire(struct hf_audio_card *card) {
>DBUS_TYPE_BYTE, ,
>DBUS_TYPE_INVALID) == true)) {
>  dbus_message_unref(r);
> -if (codec != HFP_AUDIO_CODEC_CVSD) {
> +if (codec != HFP_AUDIO_CODEC_CVSD && codec !=
> HFP_AUDIO_CODEC_MSBC) {
>  pa_log_error("Invalid codec: %u", codec);
>  /* shutdown to make sure connection is dropped immediately */
>  shutdown(fd, SHUT_RDWR);
> @@ -250,10 +250,17 @@ static int
> hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
>   * value from the Isoc USB endpoint in use by btusb and should be
>   * made available to userspace by the Bluetooth kernel subsystem.
>   * Meanwhile the empiric value 48 will be used. */
> -if (imtu)
> -*imtu = 48;
> -if (omtu)
> -*omtu = 48;
> +if (t->codec == HFP_AUDIO_CODEC_MSBC) {
> +if (imtu)
> +*imtu = 60;
> +if (omtu)
> +*omtu = 60;
> +} else {
> +if (imtu)
> +*imtu = 48;
> +if (omtu)
> +*omtu = 48;
> +   }
>
>  err = socket_accept(card->fd);
>  if (err < 0) {
> @@ -464,6 +471,7 @@ static void
> hf_audio_agent_register(pa_bluetooth_backend *hf) {
>  pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/",
> HF_AUDIO_MANAGER_INTERFACE, "Register"));
>
>  codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
> +codecs[ncodecs++] = HFP_AUDIO_CODEC_MSBC;
>
>  pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH,
> , DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, , ncodecs,
>DBUS_TYPE_INVALID));
> @@ -611,7 +619,7 @@ static DBusMessage
> *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
>
>  card->connecting = false;
>
> -if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
> +if (!card || (codec != HFP_AUDIO_CODEC_CVSD && codec !=
> HFP_AUDIO_CODEC_MSBC) || card->fd >= 0) {
>  pa_log_warn("New audio connection invalid arguments (path=%s
> fd=%d, codec=%d)", path, fd, codec);
>  pa_assert_se(r = dbus_message_new_error(m,
> "org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
>  shutdown(fd, SHUT_RDWR);
> diff --git a/src/modules/bluetooth/module-bluez5-device.c
> b/src/modules/bluetooth/module-bluez5-device.c
> index 9dbdca3..a404709 100644
> --- a/src/modules/bluetooth/module-bluez5-device.c
> +++ b/src/modules/bluetooth/module-bluez5-device.c
> @@ -57,6 +57,9 @@ PA_MODULE_LOAD_ONCE(false);
>  PA_MODULE_USAGE("path="
>  "autodetect_mtu=");
>
> +#define HFP_AUDIO_CODEC_CVSD0x01
> +#define HFP_AUDIO_CODEC_MSBC0x02
> +
>  #define FIXED_LATENCY_PLAYBACK_A2DP (25 * PA_USEC_PER_MSEC)
>  #define FIXED_LATENCY_PLAYBACK_SCO  (25 * PA_USEC_PER_MSEC)
>  #define FIXED_LATENCY_RECORD_A2DP   (25 * PA_USEC_PER_MSEC)
> @@ -106,6 +109,28 @@ typedef struct sbc_info {
>  size_t buffer_size;  /* Size of the buffer */
>  } sbc_info_t;
>
> +struct msbc_parser {
> +int len;
> +uint8_t buffer[60];
> +};
> +
> +/* This structure to be moved to libsbc in the future */
> +typedef struct msbc_info {
> +bool msbc_initialized;   /* Keep track if the encoder is
> initialized */
> +sbc_t sbcenc;/* Encoder data */
> +uint8_t *ebuffer;/* Codec transfer buffer */
> +size_t ebuffer_size; /* Size of the buffer */
> +size_t ebuffer_start;/* start of encoding data */
> +size_t ebuffer_end;  /* end of encoding data */
&g

Re: [pulseaudio-discuss] [PATCH] bluetooth: Wideband speech implementaion

2018-08-16 Thread Sathish Narasimman
Hi,

I had submitted the patch version 2 . please help to review the same

On Thu, Aug 16, 2018 at 12:58 AM Georg Chini  wrote:

> On 15.08.2018 09:24, Pali Rohár wrote:
> > On Wednesday 15 August 2018 09:24:04 Sathish Narasimman wrote:
> >> Hi Pali,
> >>
> >> On Wed, Aug 15, 2018 at 1:31 AM, Pali Rohár 
> wrote:
> >>
> >>> On Tuesday 14 August 2018 22:49:27 Luiz Augusto von Dentz wrote:
> >>>> Hi Pali,
> >>>>
> >>>> On Tue, Aug 14, 2018 at 10:28 PM Pali Rohár 
> >>> wrote:
> >>>>> On Tuesday 14 August 2018 19:44:49 Sathish Narasimman wrote:
> >>>>>> mSBC-encoded streams for HFP. The wideband speec encoding and
> >>> decoding
> >>>>>> is implemeted with this patch. This patch was refered from original
> >>>>>> patch of Joao Paula Rechi Vita and was verified with the supported
> >>>>>> bluetooth controller.
> >>>>>>
> >>>>>> Signed-off-by: Sathish Narasimman 
> >>>>>> ---
> >>>>>>   src/modules/bluetooth/backend-ofono.c|  20 +-
> >>>>>>   src/modules/bluetooth/module-bluez5-device.c | 371
> >>> ++-
> >>>>>>   2 files changed, 377 insertions(+), 14 deletions(-)
> >>>>> Hi! This looks great. What about support also for other backends, not
> >>>>> only ofono?
> >>>> Afaik only oFono supports WBS negotiation.
> >>> IIRC codec negotiation is done via AT commands. Therefore native
> backend
> >>> and its AT parser could be extended to support it.
> >>>
> >> AFAIK i was not able to find Handsfree profile in native backend. I see
> >> only the headset profile in which codec negotiation is not available.
> >> please point me the right place where AT commands are implented in PA
> for
> >> HFP profile in native backend. i can try the best.
> > rfcomm_io_callback function in backend-native.c. There is implemented AT
> > parser. For codec selection is needed to issue some AT command,
> > therefore that code is needed to extend...
> >
> Currently there is no HFP support in the native backend. There have
> been patches by James Bottomley to implement HFP, but they have
> never been merged due to remaining issues. See here:
> https://patchwork.freedesktop.org/series/30716/
>
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH v2] bluetooth: Wideband speech implementaion

2018-08-16 Thread Sathish Narasimman
mSBC-encoded streams for HFP. The wideband speec encoding and decoding
is implemeted with this patch. This patch was refered from original
patch of Joao Paula Rechi Vita and was verified with the supported
bluetooth controller.

Signed-off-by: Sathish Narasimman 
---
 src/modules/bluetooth/backend-ofono.c|  20 +-
 src/modules/bluetooth/module-bluez5-device.c | 372 ++-
 2 files changed, 378 insertions(+), 14 deletions(-)

diff --git a/src/modules/bluetooth/backend-ofono.c 
b/src/modules/bluetooth/backend-ofono.c
index 1f0efe9..a836779 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -164,7 +164,7 @@ static int card_acquire(struct hf_audio_card *card) {
   DBUS_TYPE_BYTE, ,
   DBUS_TYPE_INVALID) == true)) {
 dbus_message_unref(r);
-if (codec != HFP_AUDIO_CODEC_CVSD) {
+if (codec != HFP_AUDIO_CODEC_CVSD && codec != HFP_AUDIO_CODEC_MSBC) {
 pa_log_error("Invalid codec: %u", codec);
 /* shutdown to make sure connection is dropped immediately */
 shutdown(fd, SHUT_RDWR);
@@ -250,10 +250,17 @@ static int 
hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
  * value from the Isoc USB endpoint in use by btusb and should be
  * made available to userspace by the Bluetooth kernel subsystem.
  * Meanwhile the empiric value 48 will be used. */
-if (imtu)
-*imtu = 48;
-if (omtu)
-*omtu = 48;
+if (t->codec == HFP_AUDIO_CODEC_MSBC) {
+if (imtu)
+*imtu = 60;
+if (omtu)
+*omtu = 60;
+} else {
+if (imtu)
+*imtu = 48;
+if (omtu)
+*omtu = 48;
+   }
 
 err = socket_accept(card->fd);
 if (err < 0) {
@@ -464,6 +471,7 @@ static void hf_audio_agent_register(pa_bluetooth_backend 
*hf) {
 pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/", 
HF_AUDIO_MANAGER_INTERFACE, "Register"));
 
 codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
+codecs[ncodecs++] = HFP_AUDIO_CODEC_MSBC;
 
 pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH, , 
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, , ncodecs,
   DBUS_TYPE_INVALID));
@@ -611,7 +619,7 @@ static DBusMessage 
*hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
 
 card->connecting = false;
 
-if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
+if (!card || (codec != HFP_AUDIO_CODEC_CVSD && codec != 
HFP_AUDIO_CODEC_MSBC) || card->fd >= 0) {
 pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, 
codec=%d)", path, fd, codec);
 pa_assert_se(r = dbus_message_new_error(m, 
"org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
 shutdown(fd, SHUT_RDWR);
diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index 9dbdca3..a404709 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -57,6 +57,9 @@ PA_MODULE_LOAD_ONCE(false);
 PA_MODULE_USAGE("path="
 "autodetect_mtu=");
 
+#define HFP_AUDIO_CODEC_CVSD0x01
+#define HFP_AUDIO_CODEC_MSBC0x02
+
 #define FIXED_LATENCY_PLAYBACK_A2DP (25 * PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_PLAYBACK_SCO  (25 * PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_RECORD_A2DP   (25 * PA_USEC_PER_MSEC)
@@ -106,6 +109,28 @@ typedef struct sbc_info {
 size_t buffer_size;  /* Size of the buffer */
 } sbc_info_t;
 
+struct msbc_parser {
+int len;
+uint8_t buffer[60];
+};
+
+/* This structure to be moved to libsbc in the future */
+typedef struct msbc_info {
+bool msbc_initialized;   /* Keep track if the encoder is 
initialized */
+sbc_t sbcenc;/* Encoder data */
+uint8_t *ebuffer;/* Codec transfer buffer */
+size_t ebuffer_size; /* Size of the buffer */
+size_t ebuffer_start;/* start of encoding data */
+size_t ebuffer_end;  /* end of encoding data */
+
+struct msbc_parser parser;   /* mSBC parser for concatenating 
frames */
+sbc_t sbcdec;/* Decoder data */
+
+size_t msbc_frame_size;
+size_t decoded_frame_size;
+
+} msbc_info_t;
+
 struct userdata {
 pa_module *module;
 pa_core *core;
@@ -147,6 +172,7 @@ struct userdata {
 pa_memchunk write_memchunk;
 pa_sample_spec sample_spec;
 struct sbc_info sbc_info;
+struct msbc_info msbc_info;
 };
 
 typedef enum pa_bluetooth_form_factor {
@@ -251,6 +277,215 @@ static void connect_ports(struct userdata *u, void 
*new_data, pa_direction_t dir
 }
 
 /* Run from IO t

Re: [pulseaudio-discuss] [PATCH] bluetooth: Wideband speech implementaion

2018-08-14 Thread Sathish Narasimman
Hi Pali,

On Wed, Aug 15, 2018 at 1:31 AM, Pali Rohár  wrote:

> On Tuesday 14 August 2018 22:49:27 Luiz Augusto von Dentz wrote:
> > Hi Pali,
> >
> > On Tue, Aug 14, 2018 at 10:28 PM Pali Rohár 
> wrote:
> > >
> > > On Tuesday 14 August 2018 19:44:49 Sathish Narasimman wrote:
> > > > mSBC-encoded streams for HFP. The wideband speec encoding and
> decoding
> > > > is implemeted with this patch. This patch was refered from original
> > > > patch of Joao Paula Rechi Vita and was verified with the supported
> > > > bluetooth controller.
> > > >
> > > > Signed-off-by: Sathish Narasimman 
> > > > ---
> > > >  src/modules/bluetooth/backend-ofono.c|  20 +-
> > > >  src/modules/bluetooth/module-bluez5-device.c | 371
> ++-
> > > >  2 files changed, 377 insertions(+), 14 deletions(-)
> > >
> > > Hi! This looks great. What about support also for other backends, not
> > > only ofono?
> >
> > Afaik only oFono supports WBS negotiation.
>
> IIRC codec negotiation is done via AT commands. Therefore native backend
> and its AT parser could be extended to support it.
>

AFAIK i was not able to find Handsfree profile in native backend. I see
only the headset profile in which codec negotiation is not available.
please point me the right place where AT commands are implented in PA for
HFP profile in native backend. i can try the best.

>
> --
> Pali Rohár
> pali.ro...@gmail.com
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH] bluetooth: Wideband speech implementaion

2018-08-14 Thread Sathish Narasimman
Hi Luiz,

On Wed, Aug 15, 2018 at 1:21 AM, Luiz Augusto von Dentz <
luiz.de...@gmail.com> wrote:

> Hi Sathish,
> On Tue, Aug 14, 2018 at 5:15 PM Sathish Narasimman 
> wrote:
> >
> > mSBC-encoded streams for HFP. The wideband speec encoding and decoding
> > is implemeted with this patch. This patch was refered from original
> > patch of Joao Paula Rechi Vita and was verified with the supported
> > bluetooth controller.
> >
> > Signed-off-by: Sathish Narasimman 
> > ---
> >  src/modules/bluetooth/backend-ofono.c|  20 +-
> >  src/modules/bluetooth/module-bluez5-device.c | 371
> ++-
> >  2 files changed, 377 insertions(+), 14 deletions(-)
> >
> > diff --git a/src/modules/bluetooth/backend-ofono.c
> b/src/modules/bluetooth/backend-ofono.c
> > index 1f0efe9..a836779 100644
> > --- a/src/modules/bluetooth/backend-ofono.c
> > +++ b/src/modules/bluetooth/backend-ofono.c
> > @@ -164,7 +164,7 @@ static int card_acquire(struct hf_audio_card *card) {
> >DBUS_TYPE_BYTE, ,
> >DBUS_TYPE_INVALID) == true)) {
> >  dbus_message_unref(r);
> > -if (codec != HFP_AUDIO_CODEC_CVSD) {
> > +if (codec != HFP_AUDIO_CODEC_CVSD && codec !=
> HFP_AUDIO_CODEC_MSBC) {
> >  pa_log_error("Invalid codec: %u", codec);
> >  /* shutdown to make sure connection is dropped immediately
> */
> >  shutdown(fd, SHUT_RDWR);
> > @@ -250,10 +250,17 @@ static int 
> > hf_audio_agent_transport_acquire(pa_bluetooth_transport
> *t, bool opti
> >   * value from the Isoc USB endpoint in use by btusb and should be
> >   * made available to userspace by the Bluetooth kernel subsystem.
> >   * Meanwhile the empiric value 48 will be used. */
> > -if (imtu)
> > -*imtu = 48;
> > -if (omtu)
> > -*omtu = 48;
> > +if (t->codec == HFP_AUDIO_CODEC_MSBC) {
> > +if (imtu)
> > +*imtu = 60;
> > +if (omtu)
> > +*omtu = 60;
> > +} else {
> > +if (imtu)
> > +*imtu = 48;
> > +if (omtu)
> > +*omtu = 48;
> > +   }
> >
> >  err = socket_accept(card->fd);
> >  if (err < 0) {
> > @@ -464,6 +471,7 @@ static void hf_audio_agent_register(pa_bluetooth_backend
> *hf) {
> >  pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/",
> HF_AUDIO_MANAGER_INTERFACE, "Register"));
> >
> >  codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
> > +codecs[ncodecs++] = HFP_AUDIO_CODEC_MSBC;
> >
> >  pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH,
> , DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, , ncodecs,
> >DBUS_TYPE_INVALID));
> > @@ -611,7 +619,7 @@ static DBusMessage 
> > *hf_audio_agent_new_connection(DBusConnection
> *c, DBusMessage
> >
> >  card->connecting = false;
> >
> > -if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
> > +if (!card || (codec != HFP_AUDIO_CODEC_CVSD && codec !=
> HFP_AUDIO_CODEC_MSBC) || card->fd >= 0) {
> >  pa_log_warn("New audio connection invalid arguments (path=%s
> fd=%d, codec=%d)", path, fd, codec);
> >  pa_assert_se(r = dbus_message_new_error(m, 
> > "org.ofono.Error.InvalidArguments",
> "Invalid arguments in method call"));
> >  shutdown(fd, SHUT_RDWR);
> > diff --git a/src/modules/bluetooth/module-bluez5-device.c
> b/src/modules/bluetooth/module-bluez5-device.c
> > index 9dbdca3..c9b88bd 100644
> > --- a/src/modules/bluetooth/module-bluez5-device.c
> > +++ b/src/modules/bluetooth/module-bluez5-device.c
> > @@ -57,6 +57,9 @@ PA_MODULE_LOAD_ONCE(false);
> >  PA_MODULE_USAGE("path="
> >  "autodetect_mtu=");
> >
> > +#define HFP_AUDIO_CODEC_CVSD0x01
> > +#define HFP_AUDIO_CODEC_MSBC0x02
> > +
> >  #define FIXED_LATENCY_PLAYBACK_A2DP (25 * PA_USEC_PER_MSEC)
> >  #define FIXED_LATENCY_PLAYBACK_SCO  (25 * PA_USEC_PER_MSEC)
> >  #define FIXED_LATENCY_RECORD_A2DP   (25 * PA_USEC_PER_MSEC)
> > @@ -106,6 +109,27 @@ typedef struct sbc_info {
> >  size_t buffer_size;  /* Size of the buffer */
> >  } sbc_info_t;
> >
> > +struct msbc_parser {
> > +int len;
> > +uint8_t buffer[60];
> > +};
> > +
> &

[pulseaudio-discuss] [PATCH] bluetooth: Wideband speech implementaion

2018-08-14 Thread Sathish Narasimman
mSBC-encoded streams for HFP. The wideband speec encoding and decoding
is implemeted with this patch. This patch was refered from original
patch of Joao Paula Rechi Vita and was verified with the supported
bluetooth controller.

Signed-off-by: Sathish Narasimman 
---
 src/modules/bluetooth/backend-ofono.c|  20 +-
 src/modules/bluetooth/module-bluez5-device.c | 371 ++-
 2 files changed, 377 insertions(+), 14 deletions(-)

diff --git a/src/modules/bluetooth/backend-ofono.c 
b/src/modules/bluetooth/backend-ofono.c
index 1f0efe9..a836779 100644
--- a/src/modules/bluetooth/backend-ofono.c
+++ b/src/modules/bluetooth/backend-ofono.c
@@ -164,7 +164,7 @@ static int card_acquire(struct hf_audio_card *card) {
   DBUS_TYPE_BYTE, ,
   DBUS_TYPE_INVALID) == true)) {
 dbus_message_unref(r);
-if (codec != HFP_AUDIO_CODEC_CVSD) {
+if (codec != HFP_AUDIO_CODEC_CVSD && codec != HFP_AUDIO_CODEC_MSBC) {
 pa_log_error("Invalid codec: %u", codec);
 /* shutdown to make sure connection is dropped immediately */
 shutdown(fd, SHUT_RDWR);
@@ -250,10 +250,17 @@ static int 
hf_audio_agent_transport_acquire(pa_bluetooth_transport *t, bool opti
  * value from the Isoc USB endpoint in use by btusb and should be
  * made available to userspace by the Bluetooth kernel subsystem.
  * Meanwhile the empiric value 48 will be used. */
-if (imtu)
-*imtu = 48;
-if (omtu)
-*omtu = 48;
+if (t->codec == HFP_AUDIO_CODEC_MSBC) {
+if (imtu)
+*imtu = 60;
+if (omtu)
+*omtu = 60;
+} else {
+if (imtu)
+*imtu = 48;
+if (omtu)
+*omtu = 48;
+   }
 
 err = socket_accept(card->fd);
 if (err < 0) {
@@ -464,6 +471,7 @@ static void hf_audio_agent_register(pa_bluetooth_backend 
*hf) {
 pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/", 
HF_AUDIO_MANAGER_INTERFACE, "Register"));
 
 codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
+codecs[ncodecs++] = HFP_AUDIO_CODEC_MSBC;
 
 pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH, , 
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, , ncodecs,
   DBUS_TYPE_INVALID));
@@ -611,7 +619,7 @@ static DBusMessage 
*hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
 
 card->connecting = false;
 
-if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
+if (!card || (codec != HFP_AUDIO_CODEC_CVSD && codec != 
HFP_AUDIO_CODEC_MSBC) || card->fd >= 0) {
 pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, 
codec=%d)", path, fd, codec);
 pa_assert_se(r = dbus_message_new_error(m, 
"org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
 shutdown(fd, SHUT_RDWR);
diff --git a/src/modules/bluetooth/module-bluez5-device.c 
b/src/modules/bluetooth/module-bluez5-device.c
index 9dbdca3..c9b88bd 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -57,6 +57,9 @@ PA_MODULE_LOAD_ONCE(false);
 PA_MODULE_USAGE("path="
 "autodetect_mtu=");
 
+#define HFP_AUDIO_CODEC_CVSD0x01
+#define HFP_AUDIO_CODEC_MSBC0x02
+
 #define FIXED_LATENCY_PLAYBACK_A2DP (25 * PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_PLAYBACK_SCO  (25 * PA_USEC_PER_MSEC)
 #define FIXED_LATENCY_RECORD_A2DP   (25 * PA_USEC_PER_MSEC)
@@ -106,6 +109,27 @@ typedef struct sbc_info {
 size_t buffer_size;  /* Size of the buffer */
 } sbc_info_t;
 
+struct msbc_parser {
+int len;
+uint8_t buffer[60];
+};
+
+typedef struct msbc_info {
+bool msbc_initialized;   /* Keep track if the encoder is 
initialized */
+sbc_t sbcenc;/* Encoder data */
+uint8_t *ebuffer;/* Codec transfer buffer */
+size_t ebuffer_size; /* Size of the buffer */
+size_t ebuffer_start;/* start of encoding data */
+size_t ebuffer_end;  /* end of encoding data */
+
+struct msbc_parser parser;   /* mSBC parser for concatenating 
frames */
+sbc_t sbcdec;/* Decoder data */
+
+size_t msbc_frame_size;
+size_t decoded_frame_size;
+
+} msbc_info_t;
+
 struct userdata {
 pa_module *module;
 pa_core *core;
@@ -147,6 +171,7 @@ struct userdata {
 pa_memchunk write_memchunk;
 pa_sample_spec sample_spec;
 struct sbc_info sbc_info;
+struct msbc_info msbc_info;
 };
 
 typedef enum pa_bluetooth_form_factor {
@@ -251,6 +276,215 @@ static void connect_ports(struct userdata *u, void 
*new_data, pa_direction_t dir
 }
 
 /* Run from IO thread */
+static void msbc_parser_reset(struct msbc_pa

[pulseaudio-discuss] [PATCH] bluetooth: Wideband speech implementaion

2018-08-14 Thread Sathish Narasimman
mSBC-encoded streams for HFP. The wideband speec encoding and decoding
is implemeted with this patch. This patch was refered from original
patch of Joao Paula Rechi Vita and was verified with the supported
bluetooth controller.

Sathish Narasimman (1):
  bluetooth: Wideband speech implementaion

 src/modules/bluetooth/backend-ofono.c|  20 +-
 src/modules/bluetooth/module-bluez5-device.c | 371 ++-
 2 files changed, 377 insertions(+), 14 deletions(-)

-- 
2.7.4

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] bluetooth: HFP | WBS | pollfd->revent POLLOUT not hit

2018-07-06 Thread Sathish Narasimman
Hi Luiz,

Yes, I am doing the polling. I an not changing that part of the code. In
which it is default in which NBS also uses.

Thanks,
Sathish N

On Wed, Jul 4, 2018 at 9:29 PM, Luiz Augusto von Dentz  wrote:

> Hi Sathish,
>
> On Mon, Jul 2, 2018 at 4:25 PM, Sathish Narasimman 
> wrote:
> > Hi,
> >
> > I am trying to make WBS with PulseAudio. I am almost successful in
> > establishing the connection and making a WBS traffic.
> >
> > But out of 10 attempts or sometimes the TX packets are not sent due to
> > POLLOUT is not reflected in the pollfd
> > /* Test if the stream is writable */
> > if (pollfd->revents & POLLOUT)
> > writable = true;
>
> Are you sure you are polling with POLLOUT?
>
> > I would like to know what causes the stream as not writable.
> > What are the connecting modules to resolve this?
> > This happening only with WBS as NBS works good without any problem.
> >
> >
> > Thanks,
> > Sathish N
> >
> > ___
> > pulseaudio-discuss mailing list
> > pulseaudio-discuss@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> >
>
>
>
> --
> Luiz Augusto von Dentz
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] bluetooth: HFP | WBS | pollfd->revent POLLOUT not hit

2018-07-02 Thread Sathish Narasimman
Hi,

I am trying to make WBS with PulseAudio. I am almost successful in
establishing the connection and making a WBS traffic.

But out of 10 attempts or sometimes the TX packets are not sent due to
POLLOUT is not reflected in the pollfd
/* Test if the stream is writable */
if (pollfd->revents & POLLOUT)
writable = true;

I would like to know what causes the stream as not writable.
What are the connecting modules to resolve this?
This happening only with WBS as NBS works good without any problem.


Thanks,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] PulseAudio Crash GDB log

2018-06-12 Thread Sathish Narasimman
Hi,

I am trying to establish SCO connection between 2 latops.

Handsfree profile
Laptop 1 - Hanndsfree AG
Laptop 2 Handsfree only

In Lap 1 I am getting this error when trying to pair and connect.
During connection time the PA crashes.

NOTE: using ofono backend

Thanks,
Sathish N

On Tue, Jun 12, 2018 at 11:55 PM, Georg Chini  wrote:

> On 12.06.2018 19:31, Sathish Narasimman wrote:
>
>> Hi,
>>
>> May I please, know what is wrong in the log
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x71469664 in loopback_process_msg_cb (o=0x87428, code=1, userdata=0x0,
>> offset=0, chunk=0x0) at modules/module-loopback.c:1161
>> 1161current_latency = pa_sink_get_requested_latency(
>> u->sink_input->sink);
>> (gdb) bt
>> #0  0x71469664 in loopback_process_msg_cb (o=0x87428, code=1,
>> userdata=0x0,
>> offset=0, chunk=0x0) at modules/module-loopback.c:1161
>> #1  0x76f0f4cc in pa_asyncmsgq_dispatch (object=0x87428, code=1,
>> userdata=0x0,
>> offset=0, memchunk=0x7efff2ac) at pulsecore/asyncmsgq.c:323
>> #2  0x76f93478 in asyncmsgq_read_cb (api=0x373f4, e=0xf4ea0, fd=14,
>> events=PA_IO_EVENT_INPUT, userdata=0xf43f8) at
>> pulsecore/thread-mq.c:69
>> #3  0x76e0d8ec in dispatch_pollfds (m=0x373b0) at pulse/mainloop.c:655
>> #4  0x76e0eb4c in pa_mainloop_dispatch (m=0x373b0) at pulse/mainloop.c:898
>> #5  0x76e0ed84 in pa_mainloop_iterate (m=0x373b0, block=1,
>> retval=0x7efff4fc)
>> at pulse/mainloop.c:929
>>
>> Under which conditions does that happen? Which version of PA are you
> using?
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] PulseAudio Crash GDB log

2018-06-12 Thread Sathish Narasimman
Hi,

May I please, know what is wrong in the log

Program received signal SIGSEGV, Segmentation fault.
0x71469664 in loopback_process_msg_cb (o=0x87428, code=1, userdata=0x0,
offset=0, chunk=0x0) at modules/module-loopback.c:1161
1161current_latency =
pa_sink_get_requested_latency(u->sink_input->sink);
(gdb) bt
#0  0x71469664 in loopback_process_msg_cb (o=0x87428, code=1, userdata=0x0,
offset=0, chunk=0x0) at modules/module-loopback.c:1161
#1  0x76f0f4cc in pa_asyncmsgq_dispatch (object=0x87428, code=1,
userdata=0x0,
offset=0, memchunk=0x7efff2ac) at pulsecore/asyncmsgq.c:323
#2  0x76f93478 in asyncmsgq_read_cb (api=0x373f4, e=0xf4ea0, fd=14,
events=PA_IO_EVENT_INPUT, userdata=0xf43f8) at pulsecore/thread-mq.c:69
#3  0x76e0d8ec in dispatch_pollfds (m=0x373b0) at pulse/mainloop.c:655
#4  0x76e0eb4c in pa_mainloop_dispatch (m=0x373b0) at pulse/mainloop.c:898
#5  0x76e0ed84 in pa_mainloop_iterate (m=0x373b0, block=1,
retval=0x7efff4fc)
at pulse/mainloop.c:929


Regards,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Timing interval for Bluetooth Wideband speech

2018-04-02 Thread Sathish Narasimman
On Tue, Mar 27, 2018 at 3:32 PM, Luiz Augusto von Dentz <
luiz.de...@gmail.com> wrote:

> Hi Sathish,
>
> On Tue, Mar 27, 2018 at 9:39 AM, Sathish Narasimman
> <nsathis...@gmail.com> wrote:
> > Hi Tanu,
> >
> >
> > On Sat, Mar 17, 2018 at 1:26 AM, Tanu Kaskinen <ta...@iki.fi> wrote:
> >>
> >> On Thu, 2018-03-15 at 14:49 +0530, Sathish Narasimman wrote:
> >> > Hi,
> >> >
> >> > I would like to know the PulseAudio module that is responsible for
> >> > pushing
> >> > the audio for every 1 millisecond.
> >> >
> >> > For NBS the packets are pushed with 48bytes and 1milli sec interval.
> >>
> >> Where does this 1 ms interval come from? The audio that pulseaudio
> >> writes with SCO is mono, 16-bit, 8000 Hz. With that specification 48
> >> bytes means 3 ms packets, not 1 ms.
> >>
> >> > But for WBS the timing between 2 SCO packets needs to be *7.5 Milli
> >> > Sec.*
> >> >
> >> > *May I know how to change the packet interval between the 2 SCO
> >> > packets.*
> >>
> >> The write_block_size variable in src/modules/bluetooth/module-bluez5-
> >> device.c controls how big packets pulseaudio writes. That in turn is
> >> calculated based on write_link_mtu, and that comes from the transport
> >> acquire() callback. The ofono backend always returns 48 bytes. The
> >> native backend returns 48 bytes by default, but it can also be
> >> configured to ask the kernel what the real MTU is.
> >>
> >
> > I am able to set the MTU to 60 bytes in the and able to make the SCO
> > connection.
> > But still, the data rate is maintained as 1 msec.
> >
> > Do we need to introduce any latency in the PA?
> > As per core spec 5 , Vol 4 Part B of USB transaction the HCI packet
> interval
> > need to be 7.5msec.
> > Do we need to maintain the rate in PA?
>
> I suspect something in btusb.c might be the problem:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bl
> uetooth-next.git/tree/drivers/bluetooth/btusb.c#n1272
>
> Either the interval of endpoint is wrong or we shouldn't set the ASAP
> flag since that might ignore the interval completely.
>
>
bInterval is the USB polling interval which should be 1msec.
It is HCI packet interval that needs to be 7.5msec.

Based on the bInterval the polling happens in the USB driver for every 1
msec.
As per present implementation the HCI packet of 63bytes is transfered every
1msec.
Also, I disabled the ASAP flag but it doesn't help to maintain the ALT 6
HCI packet interval of 7.5msec.

It looks like the from PA we need to maintain the time interval for WBS.
Please help in the right direction to proceed futher.


> >>
> >> --
> >> Tanu
> >>
> >> https://liberapay.com/tanuk
> >> https://www.patreon.com/tanuk
> >> ___
> >> pulseaudio-discuss mailing list
> >> pulseaudio-discuss@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> >
> >
> >
> > ___
> > pulseaudio-discuss mailing list
> > pulseaudio-discuss@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
> >
>
>
>
> --
> Luiz Augusto von Dentz
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Timing interval for Bluetooth Wideband speech

2018-03-27 Thread Sathish Narasimman
Hi Tanu,


On Sat, Mar 17, 2018 at 1:26 AM, Tanu Kaskinen <ta...@iki.fi> wrote:

> On Thu, 2018-03-15 at 14:49 +0530, Sathish Narasimman wrote:
> > Hi,
> >
> > I would like to know the PulseAudio module that is responsible for
> pushing
> > the audio for every 1 millisecond.
> >
> > For NBS the packets are pushed with 48bytes and 1milli sec interval.
>
> Where does this 1 ms interval come from? The audio that pulseaudio
> writes with SCO is mono, 16-bit, 8000 Hz. With that specification 48
> bytes means 3 ms packets, not 1 ms.
>
> > But for WBS the timing between 2 SCO packets needs to be *7.5 Milli Sec.*
> >
> > *May I know how to change the packet interval between the 2 SCO packets.*
>
> The write_block_size variable in src/modules/bluetooth/module-bluez5-
> device.c controls how big packets pulseaudio writes. That in turn is
> calculated based on write_link_mtu, and that comes from the transport
> acquire() callback. The ofono backend always returns 48 bytes. The
> native backend returns 48 bytes by default, but it can also be
> configured to ask the kernel what the real MTU is.
>
>
I am able to set the MTU to 60 bytes in the and able to make the SCO
connection.
But still, the data rate is maintained as 1 msec.

Do we need to introduce any latency in the PA?
As per core spec 5 , Vol 4 Part B of USB transaction the HCI
packet interval need to be 7.5msec.
Do we need to maintain the rate in PA?



> --
> Tanu
>
> https://liberapay.com/tanuk
> https://www.patreon.com/tanuk
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Timing interval for Bluetooth Wideband speech

2018-03-15 Thread Sathish Narasimman
Hi,

I would like to know the PulseAudio module that is responsible for pushing
the audio for every 1 millisecond.

For NBS the packets are pushed with 48bytes and 1milli sec interval.


But for WBS the timing between 2 SCO packets needs to be *7.5 Milli Sec.*

*May I know how to change the packet interval between the 2 SCO packets.*

*Thanks,*
*Sathish N*
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Bluetooth card not auto selected after pairing in sound settings

2017-10-13 Thread Sathish Narasimman
Hi,

I would like to know if there is way or settings to make Bluetooth
card auto selected as output device after pairing and connected.

For now, every time I pair. Need to go to sound setting and select
Bluetooth card after pairing.

Thanks,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Switching bluetooth profile internally

2017-08-11 Thread Sathish Narasimman
Hi,

Very thanks for the information. Also, may I know the right VOIP
application in Linux. where Bluetooth works well.


On Fri, Aug 11, 2017 at 3:09 PM, Pali Rohár <pali.ro...@gmail.com> wrote:
> So then just set media.role to phone and module-bluetooth-policy from
> pulseaudio 10.0 would take care for automatic switch between a2dp and
> hsp once your application stop resp. start recording sound.
>
> See about media.role:
> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/Clients/ApplicationProperties/
>
> On Friday 11 August 2017 15:04:08 Sathish Narasimman wrote:
>> Hi,
>>
>> My application is almost similar to what VOIP application.
>> I am trying to create a communication between the laptop and headset.
>> That is Tx and Rx full-duplex communication between the laptop and
>> Bluetooth headset.
>>
>> Also can you please mention the VOIP application that works well with Ubuntu.
>> I tried skype and it is not working with Bluetooth.
>>
>>
>>
>>
>> On Fri, Aug 11, 2017 at 2:49 PM, Pali Rohár <pali.ro...@gmail.com> wrote:
>> > On Friday 11 August 2017 11:02:15 Georg Chini wrote:
>> >> On 11.08.2017 10:09, Sathish Narasimman wrote:
>> >> >Hi,
>> >> >
>> >> >I want to switch the bluetooth profile using a dbus signal.
>> >> >
>> >> >I was successful to send the dbus signal and process it in pulseaudio.
>> >> >
>> >> >But unable to figure out how to use set_profile within PA.
>> >> >
>> >> >Please help to understand the pulseaudio. I need to switch the profile
>> >> >from a2dp to hsp and vice versa.
>> >> >
>> >> >
>> >> >Thanks,
>> >> >Sathish N
>> >> >___
>> >> >pulseaudio-discuss mailing list
>> >> >pulseaudio-discuss@lists.freedesktop.org
>> >> >https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>> >>
>> >> Hi,
>> >>
>> >> I wonder what you are trying to achieve. You can use pactl or pacmd
>> >> to change the card profile manually and module-bluetooth-policy will
>> >> automatically switch profile for you in some situations See here:
>> >> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index36h3
>> >
>> > Also in pulseaudio 10 module-bluetooth-policy would automatically switch
>> > between a2dp and hsp if VOIP application want to record sound from
>> > microphone:
>> >
>> > https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/10.0/#automaticallyswitchbluetoothprofilewhenusingvoipapplications
>> >
>> > And starting with pulseaudio 11 (not released) module-bluetooth-policy
>> > could be configured with parameter auto_switch=2 (not by default) to
>> > automatically switch between a2dp and hsp based on heuristic, see:
>> >
>> > https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=3397127f0045d3c130b59e59b4ce6b3601b239b9
>> >
>> > So why do you want to manually switch between hsp and a2dp mode? Is not
>> > this auto_switch support enough for you?
>> >
>> > --
>> > Pali Rohár
>> > pali.ro...@gmail.com
>> > ___
>> > pulseaudio-discuss mailing list
>> > pulseaudio-discuss@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>> ___
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
> --
> Pali Rohár
> pali.ro...@gmail.com
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Switching bluetooth profile internally

2017-08-11 Thread Sathish Narasimman
Hi,

My application is almost similar to what VOIP application.
I am trying to create a communication between the laptop and headset.
That is Tx and Rx full-duplex communication between the laptop and
Bluetooth headset.

Also can you please mention the VOIP application that works well with Ubuntu.
I tried skype and it is not working with Bluetooth.




On Fri, Aug 11, 2017 at 2:49 PM, Pali Rohár <pali.ro...@gmail.com> wrote:
> On Friday 11 August 2017 11:02:15 Georg Chini wrote:
>> On 11.08.2017 10:09, Sathish Narasimman wrote:
>> >Hi,
>> >
>> >I want to switch the bluetooth profile using a dbus signal.
>> >
>> >I was successful to send the dbus signal and process it in pulseaudio.
>> >
>> >But unable to figure out how to use set_profile within PA.
>> >
>> >Please help to understand the pulseaudio. I need to switch the profile
>> >from a2dp to hsp and vice versa.
>> >
>> >
>> >Thanks,
>> >Sathish N
>> >___
>> >pulseaudio-discuss mailing list
>> >pulseaudio-discuss@lists.freedesktop.org
>> >https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>>
>> Hi,
>>
>> I wonder what you are trying to achieve. You can use pactl or pacmd
>> to change the card profile manually and module-bluetooth-policy will
>> automatically switch profile for you in some situations See here:
>> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index36h3
>
> Also in pulseaudio 10 module-bluetooth-policy would automatically switch
> between a2dp and hsp if VOIP application want to record sound from
> microphone:
>
> https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/10.0/#automaticallyswitchbluetoothprofilewhenusingvoipapplications
>
> And starting with pulseaudio 11 (not released) module-bluetooth-policy
> could be configured with parameter auto_switch=2 (not by default) to
> automatically switch between a2dp and hsp based on heuristic, see:
>
> https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=3397127f0045d3c130b59e59b4ce6b3601b239b9
>
> So why do you want to manually switch between hsp and a2dp mode? Is not
> this auto_switch support enough for you?
>
> --
> Pali Rohár
> pali.ro...@gmail.com
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Switching bluetooth profile internally

2017-08-11 Thread Sathish Narasimman
Hi,

I was able to switch the profile from commands pactl and pacmd.
I am trying to switch profile during runtime.

I was trying to build an application in which it signals the PA to
switch the profile at certain times from a2dp(acl) to hsp(sco).

Thanks,
Sathish N



On Fri, Aug 11, 2017 at 2:32 PM, Georg Chini <ge...@chini.tk> wrote:
> On 11.08.2017 10:09, Sathish Narasimman wrote:
>>
>> Hi,
>>
>> I want to switch the bluetooth profile using a dbus signal.
>>
>> I was successful to send the dbus signal and process it in pulseaudio.
>>
>> But unable to figure out how to use set_profile within PA.
>>
>> Please help to understand the pulseaudio. I need to switch the profile
>> from a2dp to hsp and vice versa.
>>
>>
>> Thanks,
>> Sathish N
>> ___
>> pulseaudio-discuss mailing list
>> pulseaudio-discuss@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>
>
> Hi,
>
> I wonder what you are trying to achieve. You can use pactl or pacmd
> to change the card profile manually and module-bluetooth-policy will
> automatically switch profile for you in some situations See here:
> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index36h3
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Switching bluetooth profile internally

2017-08-11 Thread Sathish Narasimman
Hi,

I want to switch the bluetooth profile using a dbus signal.

I was successful to send the dbus signal and process it in pulseaudio.

But unable to figure out how to use set_profile within PA.

Please help to understand the pulseaudio. I need to switch the profile
from a2dp to hsp and vice versa.


Thanks,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Internal working of pulseaudio init

2017-08-10 Thread Sathish Narasimman
Hi,

Thanks for the reply.
Your reply to the previous question answers my doubt clearly.

Also, I am trying to switch the Bluetooth profile from a2dp to hfp/hsp
from a different application on runtime.

I found that during manual switching of the profile from sound
settings "PA_COMMAND_SET_CARD_PROFILE" is called to set the profile.

May I know how to initiate the profile from different applications,
for example, i want to switch the profile from ofono/bluez.
I want to stop the a2dp streaming and switch to hsp.hfp profile.

Thanks,
Sathish N

On Thu, Aug 3, 2017 at 9:14 AM, Tanu Kaskinen <ta...@iki.fi> wrote:
> On Wed, 2017-08-02 at 15:17 +0530, Sathish Narasimman wrote:
>> Hi,
>>
>> I would like to know how the pa__init functions are initialized.
>> Looking into the code each pa__init are replaced with a unique MACRO.
>>
>> I was trying to find the module-loopback.c pa__init starting. And how
>> to use this module.
>>
>> Please help to know the flow.
>
> I'm not sure what you mean by "trying to find the module-loopback.c
> pa__init starting". Do you mean how pa__init() gets called? The modules
> are dlopened libraries. When a module is loaded, pa_module_load() in
> src/pulsecore/module.c finds the symbol for pa__init and calls the
> function.
>
> As for how to use module-loopback in general, the module documentation
> can be found here:
> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index64h3
>
> --
> Tanu
>
> https://www.patreon.com/tanuk
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] Internal working of pulseaudio init

2017-08-02 Thread Sathish Narasimman
Hi,

I would like to know how the pa__init functions are initialized.
Looking into the code each pa__init are replaced with a unique MACRO.

I was trying to find the module-loopback.c pa__init starting. And how
to use this module.

Please help to know the flow.



Thanks,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] HFP AG using laptop mic as audio to play on Hands-free device

2017-07-13 Thread Sathish Narasimman
Hi all,

I was able to successfully connect using HFP AG profile(git
PulseAudio) with a handsfree device.
If I switch the profile from sound setting to HSP/HFP I can see the
sounds played on the laptop are transferred using SCO channel. Also, i
can record the sound from the handsfree device.

Instead of playing an audio file I want to transfer the audio that I
speak using laptop mic to the hansfree device and vice-versa.

Is there is a way to change the way I want as I mentioned above? If so
please guide me in right direction.


Thanks,
Sathish N
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss