linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gix <bgix@codeaurora.org>
To: Arun Raghavan <arun.raghavan@collabora.co.uk>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: Switching between SBC and MPEG audio on headsets
Date: Tue, 15 Mar 2011 09:22:15 -0700	[thread overview]
Message-ID: <4D7F9237.2080206@codeaurora.org> (raw)
In-Reply-To: <1300199261-27481-1-git-send-email-arun.raghavan@collabora.co.uk>

Hi Arun,

On 3/15/2011 7:27 AM, Arun Raghavan wrote:
> Hello,
> I've been trying to set up PulseAudio to be able to switch the A2DP sink
> dynamically between SBC and MPEG modes. I've got this working now [1], but I
> did face one problem on the bluez side. When sending a reconfigure request, the
> request always goes to the SEID that was used previously (=>  always to the SBC
> SEID). Trying to reconfigure for MPEG therefore results the headset returning
> an error. I'm not very familiar with how this is supposed to work, but the
> patch following this mail seems to work (I can now switch back and forth
> between SBC and MPEG modes). It basically forces figuring out what remote SEP
> to talk to while reconfiguring.
>
> Is this the right approach?

No this is the incorrect approach.

Both SRC and SNK devices have a variety of endpoints that have 
capabilities describing what that endpoint is capable of, the most 
important of which is the Codec Capability.  Each endpoint is allowed a 
single capability of a particular type, which means that an endpoint 
that supports SBC should not attempt to use a different codec (for MPEG 
in this case). Any device that attempts to wedge both codecs into a 
single endpoint would most definitely be non-compliant.

The SUSPEND/RECONFIGURE/START procedure will not work to switch between 
SBC and MPEG for this reason.  The purpose for that procedure is to 
allow quick changes within the bounds of the current (remote and local) 
endpoint capabilities.  To quickly switch between a 44.1KHz and 48KHz 
sampling for instance.

The correct procedure to switch between SBC and MPEG would be to close 
the existing media channel (but NOT the AVDTP signaling channel) and 
reset up a new endpoint.  If you know you will be doing this, you can 
save time by caching all of the remote devices endpoints the first time 
you do an AVDTP_DISCOVER, so that you have all the remote endpoint info 
you need to make the switch (and even know if the switch will work). You 
also should have all supported local endpoints separated into their own 
endpoints of course.

The to switch, you will need to:

<halt streaming>

AVDTP_CLOSE (on AVDTP signaling channel)

L2CAP_CLOSE (close the media L2CAP channel for SBC)

<<<< You should Rx AVDTP_CLOSE_CFM

AVDTP_SET_CONFIG (on AVDTP signaling channel,
         specify a local and remote endpoint that are compatible)

<<<<< You should Rx SET_CONFIG_CFM

AVDTP_OPEN (on AVDTP signaling channel)

L2CAP_OPEN (open new media L2CAP channel for MPEG)

<<<<< You should Rx AVDTP_OPEN_CFM

AVDTP_START (on AVDTP signaling channel)

<<<<< You should Rx AVDTP_START_CFM

<start streaming>



Regards,


-- 
Brian Gix
bgix@codeaurora.org
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

  parent reply	other threads:[~2011-03-15 16:22 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 ` Brian Gix [this message]
2011-03-15 19:51   ` Switching between SBC and MPEG audio on headsets 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
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=4D7F9237.2080206@codeaurora.org \
    --to=bgix@codeaurora.org \
    --cc=arun.raghavan@collabora.co.uk \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).