card: Only set active_profile with available profile

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

 



On Sun, 2013-11-17 at 13:17 +0000, Colin Guthrie wrote:
> 'Twas brillig, and Tanu Kaskinen at 16/11/13 08:51 did gyre and gimble:
> > There's always the "off" profile that will be available, both in alsa
> > and bluetooth.
> 
> Ahh fair point, although the off profile will technically be
> PA_AVAILABLE_UNKNOWN rather than "available" - but it will exist not be
> PA_AVAILABLE_NO which is I guess what you mean!

Well, I expected that "off" would use PA_AVAILABLE_YES, but as you found
out, that doesn't seem to be true for alsa.

> Of course currently ALL card profiles are PA_AVAILABLE_UNKNOWN except
> bluetooth ones as this is the only place in the code which calls
> pa_card_profile_set_available() to change it from the default value of
> PA_AVAILABLE_UNKNOWN. In the bluetooth case, this property is set
> directly via "cp->available = PA_AVAILABLE_YES;", but not in the alsa code.
> 
> This likely makes sense as the bt stuff is the only bit that makes use
> of PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED and that infrastructure.

I think alsa should set the availability of "off" to YES too, for
correctness reasons (we know for sure that the "off" profile is always
available). I think it currently doesn't do that because when the alsa
code was written, there was no profile availability, and because having
the availability as UNKNOWN doesn't cause any practical problems.

> Anyway my general question is still valid - is it better to favour
> "known available (PA_AVAILABLE_YES)" over "unknown available
> (PA_AVAILABLE_UNKOWN)" when deciding the default.

In generic code, I don't think so. In Bluetooth specific code, perhaps.
If a profile availability is unknown, but it has the highest priority,
then the profile should be activated by default. If the activation fails
because the profile turned out to not be available, ideally the next
profile in priority order would be tried.

Note that it's not really defined what "YES" and "UNKNOWN" mean for
profiles anyway, except for Bluetooth profiles. To clients both states
are advertised as "available".

-- 
Tanu



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

  Powered by Linux