[pulseaudio-discuss] [PATCH v2] card: Only set active_profile with available profile
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Tue Nov 5 20:34:02 CET 2013
On Sun, 2013-11-03 at 15:05 +0200, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz at intel.com>
>
> When a card is being created and no profile has been assigned
> pa_card_new will attempt to select one from the list but it does that
> without checking the available flag which can lead to select profiles
> not available.
> ---
> v2: Add better description and asserts if no available profile could be found
>
> src/pulsecore/card.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
> index e6e0836..4ae16c2 100644
> --- a/src/pulsecore/card.c
> +++ b/src/pulsecore/card.c
> @@ -195,9 +195,14 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
> c->save_profile = data->save_profile;
>
> if (!c->active_profile) {
> - PA_HASHMAP_FOREACH(profile, c->profiles, state)
> + PA_HASHMAP_FOREACH(profile, c->profiles, state) {
> + if (profile->available == PA_AVAILABLE_NO)
> + continue;
> +
> if (!c->active_profile || profile->priority > c->active_profile->priority)
> c->active_profile = profile;
> + }
> + pa_assert(c->active_profile);
> }
>
> c->userdata = NULL;
Thanks, applied!
--
Tanu
More information about the pulseaudio-discuss
mailing list