[PATCH 1/3] bluetooth: Do not switch to profile unless Playing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-11-25 at 14:24 +0200, Luiz Augusto von Dentz wrote:
> Hi Mikel, Tanu,
> 
> On Thu, Nov 24, 2011 at 5:05 PM, Mikel Astiz <mikel.astiz at bmw-carit.de> wrote:
> > Even if a profile is in connected state (not playing), it does make sense to
> > load the module, because then you have the option to change the profile from
> > PA and effectively open an audio stream. This is useful for example in
> > app-initiated audio connections, for example, streaming from phone to PC:
> > the app switches the profile to a2dp_source, and the device simply starts to
> > stream.
> >
> > The problem with this approach is that switching profiles has important
> > side-effects, and must be considered with care. From my point of view, PA
> > should ideally never switch a profile unless it knows it is safe and non
> > app-specific. For this reason, this patch tries to set the initial profile
> > according to the actual streaming state during discovery, but without
> > opening new streams.
> 
> This depend on who is the initiator, if we are the initiator of the
> connection then it may never enter PLAYING which can cause IOP
> problems if we don't request a stream. Now there are recommendations
> that a phone/source should open the stream not the carkit/sink but IMO
> this should not be taken so literally as Ive seems some devices that
> don't always behave as recommended.
> 
> > The patch does not solve the problem entirely since module-card-restore
> > might still switch to a profile, but I was thinking of another patch to fix
> > this second problem.
> 
> That sounds a better place to fix this, basically if we have a profile
> in Playing state it should have the highest priority which should
> prevent the profile switching.

So, does this sound like correct behavior:

module-bluetooth-discover loads module-bluetooth-device whenever
anything is CONNECTED. module-bluetooth-discover never sets any
particular profile explicitly.

If the "profile" module argument is set, module-bluetooth-device always
activates that profile if it's at least CONNECTED. If the profile is not
CONNECTED, module-bluetooth-device acts as if the "profile" argument was
not set.

If the "profile" module argument is not set, module-bluetooth-device
activates a profile that is PLAYING at the time when the module is
loaded. Is it possible that there are multiple profiles PLAYING? If so,
what should be the priority of each profile relative to each other?

If there are no profiles PLAYING, and pa_card_new_data doesn't have
active_profile set, or the profile is not CONNECTED,
module-bluetooth-device selects the "off" profile. If active_profile is
set (by module-card-restore) and the profile is CONNECTED,
module-bluetooth-device selects that profile.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux