linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Dons Tychsen <donpedro@tdcadsl.dk>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Arun Raghavan <arun.raghavan@collabora.co.uk>,
	linux-bluetooth@vger.kernel.org,
	Johan Hedberg <johan.hedberg@gmail.com>
Subject: Re: Switching between SBC and MPEG audio on headsets
Date: Wed, 16 Mar 2011 23:38:31 +0100	[thread overview]
Message-ID: <1300315111.4500.34.camel@donpedro> (raw)
In-Reply-To: <AANLkTimF0Ux=-uQiWaWH14r3_YAuyp2o=QrmyeLkWWeT@mail.gmail.com>

Hello,

On Tue, 2011-03-15 at 16:29 -0300, Luiz Augusto von Dentz wrote:
> Actually
> I would suggest configuring both endpoint since the beginning so that
> we only need to suspend/resume to switch between them, but I don't
> think many headsets would be able to handle this situation. 

Unfortunately, because of a rather silly flaw in the A2DP specifications
you cannot do this. The reason is simple. You would need a separate
L2CAP channel for each data link. A2DP uses up to three L2CAP channels
all on L2CAP PSM=0x19:

1) First is always signalling channel.
2) Second is always data channel.
3) Third is always Journaling channel (never really used).

So if you already had the first two, and you opened yet another on
PSM=0x19 from the same device, then it could be one of the following:

1) A new signalling channel (multi-profile).
2) A new data channel for already opened profile.
3) A new Journalling channel for already opened profile.

Because of the specification problem mentioned above, the problem is not
really solvable, and the implementation is forced to assume that the new
L2CAP channel is the 3rd channel (Journalling). The correct solution
would of course have been a dynamic PSM for each service, and for each
profile.

So current the only portable way of supporting multiple codecs is:

1) Close existing data channel.
2) Setup config.
3) Re-open data channel.
4) Send "start".

Anything else will most likely not work with the headsets in the wild.

And also a note: Do not *ever* cache the data from the discovery phase.
That would only make the same mistake many have done with SDP queries.
If you are using a multi-link headset, the other connected device might
have changed which codecs are available (or left), and in some cases it
could also change which options and settings are supported.

Thanks,

/pedro

  parent reply	other threads:[~2011-03-16 22:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15 14:27 Switching between SBC and MPEG audio on headsets Arun Raghavan
2011-03-15 14:27 ` [PATCH] Always reset the remote SEP when reconfiguring A2DP Arun Raghavan
2011-03-15 16:30   ` Brian Gix
2011-03-15 17:08     ` Johan Hedberg
2011-03-15 17:11       ` Brian Gix
2011-03-15 16:22 ` Switching between SBC and MPEG audio on headsets Brian Gix
2011-03-15 19:51   ` Arun Raghavan
2011-03-15 20:43     ` Brian Gix
2011-03-16 18:19       ` Arun Raghavan
2011-03-16 20:05         ` [PATCH] Recalculate remote SEP if the codec type changes Arun Raghavan
2011-03-18  9:43           ` Johan Hedberg
2011-03-15 17:01 ` Switching between SBC and MPEG audio on headsets Johan Hedberg
2011-03-15 19:29   ` Luiz Augusto von Dentz
2011-03-15 19:41     ` Brian Gix
2011-03-15 20:21       ` Luiz Augusto von Dentz
2011-03-15 20:50         ` Brian Gix
2011-03-16 22:38     ` Peter Dons Tychsen [this message]
2011-03-16 23:09       ` Brian Gix
2011-03-17  9:35         ` Peter Dons Tychsen
2011-03-17 16:19           ` Brian Gix
2011-03-17 21:33             ` Peter Dons Tychsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300315111.4500.34.camel@donpedro \
    --to=donpedro@tdcadsl.dk \
    --cc=arun.raghavan@collabora.co.uk \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).