public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-users] a2dp not working in stereo and minor patch
@ 2007-09-16 17:45 Brandon Casey
  2007-09-16 20:48 ` Marcel Holtmann
  2007-09-17 23:31 ` [Bluez-users] Urgent: HCI and LMP are missing! Eng. Waleed S. Al-Rashoud
  0 siblings, 2 replies; 5+ messages in thread
From: Brandon Casey @ 2007-09-16 17:45 UTC (permalink / raw)
  To: bluez-users

I have a Sony DRBT21G and I have high quality audio working.
I am using bluez-3.18 libs and utils.

But, I am only getting mono sound. Stereo is not working. Here is an
example running mpg123-alsa...

$ mpg123-alsa -v -a bluetooth test.mp3
Playing MPEG stream 1 of 1: 06 Money.mp3 ...

        Title:   Money
        Artist:  Pink Floyd
        Album:   The Dark Side of the Moon [SACD]
        Year:    2003
        Genre:   Rock
        Comment:

MPEG 1.0, Layer: III, Freq: 44100, mode: Joint-Stereo, modext: 0, BPF : 835
Channels: 2, copyright: No, original: No, CRC: No, emphasis: 0.
Bitrate: 256 kbits/s Extension value: 0
Audio: 1:1 conversion, rate: 44100, encoding: signed 16 bit, channels: 1


This last line seems to indicate that the audio is being converted to
1 channel. The missing stereo separation is particularly noticeable in
this song since the beginning starts out with cash register sounds
alternating from one ear to the other.

Similarly, mplayer prints out these lines for an mpg file:
Forced audio codec: mad
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mad] afm: libmad (libMAD MPEG layer 1-2-3)
==========================================================================
AO: [alsa] 44100Hz 1ch s16le (2 bytes per sample)


my .asoundrc has:
pcm.bluetooth {
    type bluetooth
    device 00:13:A9:C5:20:32
    profile hifi
    mode stereo
#    subbands "8"
#    blocks "16"
#    bitpool "250"
#    allocation snr
#    rate "44100"
}

There was a bug in pcm_bluetooth.c that prevented mode from being
parsed properly, a patch is attached at the end of this email.

Here is some of the hcidump:
> ACL data: handle 1 flags 0x02 dlen 10
    L2CAP(d): cid 0x0040 len 6 [psm 25]
      AVDTP(s): Discover rsp: transaction 0
        ACP SEID 1 - Audio Sink
        ACP SEID 2 - Audio Sink
< ACL data: handle 1 flags 0x02 dlen 7
    L2CAP(d): cid 0x0052 len 3 [psm 25]
      AVDTP(s): Capabilities cmd: transaction 1
        ACP SEID 1
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 20
    L2CAP(d): cid 0x0040 len 16 [psm 25]
      AVDTP(s): Capabilities rsp: transaction 1
        Media Transport
        Media Codec - SBC
          16kHz 32kHz 44.1kHz 48kHz
          Mono DualChannel Stereo JointStereo
          4 8 12 16 Blocks
          4 8 Subbands
          SNR Loudness
          Bitpool Range 2-53
        Content Protection
          02 00
< ACL data: handle 1 flags 0x02 dlen 7
    L2CAP(d): cid 0x0052 len 3 [psm 25]
      AVDTP(s): Capabilities cmd: transaction 2
        ACP SEID 2
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 16
    L2CAP(d): cid 0x0040 len 12 [psm 25]
      AVDTP(s): Capabilities rsp: transaction 2
        Media Transport
        Media Codec - MPEG-1,2 Audio
          3F 07 FF FE
< ACL data: handle 1 flags 0x02 dlen 18
    L2CAP(d): cid 0x0052 len 14 [psm 25]
      AVDTP(s): Set config cmd: transaction 3
        ACP SEID 1 - INT SEID 1
        Media Transport
        Media Codec - SBC
          44.1kHz
          JointStereo
          16 Blocks
          8 Subbands
          Loudness
          Bitpool Range 2-53
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 6
    L2CAP(d): cid 0x0040 len 2 [psm 25]
      AVDTP(s): Set config rsp: transaction 3
< ACL data: handle 1 flags 0x02 dlen 7
    L2CAP(d): cid 0x0052 len 3 [psm 25]
      AVDTP(s): Open cmd: transaction 4
        ACP SEID 1
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 6
    L2CAP(d): cid 0x0040 len 2 [psm 25]
      AVDTP(s): Open rsp: transaction 4
< ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 25 scid 0x0041
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0053 scid 0x0041 result 1 status 2
      Connection pending - Authorization pending
> ACL data: handle 1 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0053 scid 0x0041 result 0 status 0
      Connection successful
< ACL data: handle 1 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x0053 flags 0x00 clen 0
> ACL data: handle 1 flags 0x02 dlen 16
    L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 4
      MTU 895
< ACL data: handle 1 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0053 flags 0x00 result 0 clen 4
      Success
      MTU 895
> HCI Event: Number of Completed Packets (0x13) plen 5
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 14
    L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 1 flags 0x02 dlen 7
    L2CAP(d): cid 0x0052 len 3 [psm 25]
      AVDTP(s): Start cmd: transaction 5
        ACP SEID 1
> HCI Event: Number of Completed Packets (0x13) plen 5
> ACL data: handle 1 flags 0x02 dlen 6
    L2CAP(d): cid 0x0040 len 2 [psm 25]
      AVDTP(s): Start rsp: transaction 5
< ACL data: handle 1 flags 0x02 dlen 7


As you can see, these headphones also support mpeg codec.

I don't know if I am reading that dump correctly, but it looks like
joint-stereo is being selected every time regardless of what mode is
set to in .asoundrc

Any help is appreciated,
-brandon


--- pcm_bluetooth.c_orig        2007-09-15 03:46:30.000000000 -0500
+++ pcm_bluetooth.c     2007-09-15 03:48:06.000000000 -0500
@@ -995,15 +995,15 @@
                                return -EINVAL;
                        }

-                       if (strcmp(pref, "auto") == 0)
+                       if (strcmp(mode, "auto") == 0)
                                cfg->mode = CFG_MODE_AUTO;
-                       else if (strcmp(pref, "mono") == 0)
+                       else if (strcmp(mode, "mono") == 0)
                                cfg->mode = CFG_MODE_MONO;
-                       else if (strcmp(pref, "dual") == 0)
+                       else if (strcmp(mode, "dual") == 0)
                                cfg->mode = CFG_MODE_DUAL_CHANNEL;
-                       else if (strcmp(pref, "stereo") == 0)
+                       else if (strcmp(mode, "stereo") == 0)
                                cfg->mode = CFG_MODE_STEREO;
-                       else if (strcmp(pref, "joint") == 0)
+                       else if (strcmp(mode, "joint") == 0)
                                cfg->mode = CFG_MODE_JOINT_STEREO;
                        continue;
                }
@@ -1014,11 +1014,11 @@
                                return -EINVAL;
                        }

-                       if (strcmp(pref, "auto") == 0)
+                       if (strcmp(allocation, "auto") == 0)
                                sbc->allocation = CFG_ALLOCATION_AUTO;
-                       else if (strcmp(pref, "loudness") == 0)
+                       else if (strcmp(allocation, "loudness") == 0)
                                sbc->allocation = CFG_ALLOCATION_LOUDNESS;
-                       else if (strcmp(pref, "snr") == 0)
+                       else if (strcmp(allocation, "snr") == 0)
                                sbc->allocation = CFG_ALLOCATION_SNR;
                        continue;
                }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-users] a2dp not working in stereo and minor patch
  2007-09-16 17:45 [Bluez-users] a2dp not working in stereo and minor patch Brandon Casey
@ 2007-09-16 20:48 ` Marcel Holtmann
  2007-09-16 21:56   ` Brandon Casey
  2007-09-17 23:31 ` [Bluez-users] Urgent: HCI and LMP are missing! Eng. Waleed S. Al-Rashoud
  1 sibling, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2007-09-16 20:48 UTC (permalink / raw)
  To: BlueZ users

Hi Brandon,

> I have a Sony DRBT21G and I have high quality audio working.
> I am using bluez-3.18 libs and utils.
> 
> But, I am only getting mono sound. Stereo is not working. Here is an
> example running mpg123-alsa...
> 
> $ mpg123-alsa -v -a bluetooth test.mp3
> Playing MPEG stream 1 of 1: 06 Money.mp3 ...
> 
>         Title:   Money
>         Artist:  Pink Floyd
>         Album:   The Dark Side of the Moon [SACD]
>         Year:    2003
>         Genre:   Rock
>         Comment:
> 
> MPEG 1.0, Layer: III, Freq: 44100, mode: Joint-Stereo, modext: 0, BPF : 835
> Channels: 2, copyright: No, original: No, CRC: No, emphasis: 0.
> Bitrate: 256 kbits/s Extension value: 0
> Audio: 1:1 conversion, rate: 44100, encoding: signed 16 bit, channels: 1
> 
> 
> This last line seems to indicate that the audio is being converted to
> 1 channel. The missing stereo separation is particularly noticeable in
> this song since the beginning starts out with cash register sounds
> alternating from one ear to the other.

please check bluez-utils-3.19 since this bug should have been fixed
already.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-users] a2dp not working in stereo and minor patch
  2007-09-16 20:48 ` Marcel Holtmann
@ 2007-09-16 21:56   ` Brandon Casey
  0 siblings, 0 replies; 5+ messages in thread
From: Brandon Casey @ 2007-09-16 21:56 UTC (permalink / raw)
  To: BlueZ users

On 9/16/07, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Brandon,
>
> > I have a Sony DRBT21G and I have high quality audio working.
> > I am using bluez-3.18 libs and utils.
> >
> > But, I am only getting mono sound. Stereo is not working. Here is an
> > example running mpg123-alsa...

> please check bluez-utils-3.19 since this bug should have been fixed
> already.

confirmed, 3.19 fixes it! Wow, it sounds great.

thanks,
-brandon

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bluez-users] Urgent: HCI and LMP are missing!
  2007-09-16 17:45 [Bluez-users] a2dp not working in stereo and minor patch Brandon Casey
  2007-09-16 20:48 ` Marcel Holtmann
@ 2007-09-17 23:31 ` Eng. Waleed S. Al-Rashoud
  2007-09-18  4:59   ` Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Eng. Waleed S. Al-Rashoud @ 2007-09-17 23:31 UTC (permalink / raw)
  To: BlueZ users

Dear all,
I would like to know where can I find the HCI and LMP implementation in 
BlueZ!
I tried to look in the source code for BlueZ, and only higher levels are 
present. I couldn't find any packet headers/playload, LMP messages (like 
Host_Connection_Req) or other low level Bluetooth implementation codes in 
there.
I think it's part of the kernel.. but I couldn't find any .. can u help me 
please..?
Thanks.. 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-users] Urgent: HCI and LMP are missing!
  2007-09-17 23:31 ` [Bluez-users] Urgent: HCI and LMP are missing! Eng. Waleed S. Al-Rashoud
@ 2007-09-18  4:59   ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2007-09-18  4:59 UTC (permalink / raw)
  To: BlueZ users

Hi,

> I would like to know where can I find the HCI and LMP implementation in 
> BlueZ!
> I tried to look in the source code for BlueZ, and only higher levels are 
> present. I couldn't find any packet headers/playload, LMP messages (like 
> Host_Connection_Req) or other low level Bluetooth implementation codes in 
> there.
> I think it's part of the kernel.. but I couldn't find any .. can u help me 
> please..?

the LMP is part of the Bluetooth chip. We don't have to implement that
inside the kernel.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-09-18  4:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-16 17:45 [Bluez-users] a2dp not working in stereo and minor patch Brandon Casey
2007-09-16 20:48 ` Marcel Holtmann
2007-09-16 21:56   ` Brandon Casey
2007-09-17 23:31 ` [Bluez-users] Urgent: HCI and LMP are missing! Eng. Waleed S. Al-Rashoud
2007-09-18  4:59   ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox