Hi David,

On Thu, Oct 31, 2013 at 11:22 AM, David Henningsson
<[email protected]> wrote:
> On 10/30/2013 11:58 AM, Luiz Augusto von Dentz wrote:
>> From: Luiz Augusto von Dentz <[email protected]>
>>
>> If the profile available flag is set to PA_AVAILABLE_NO it means the
>> profile shall not be use.
>
> Please add to the comment that this only happens when the card is
> created, and only if the active profile has not been specified earlier.

Sure will add it np.

>
>> ---
>>  src/pulsecore/card.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
>> index e6e0836..ba2222e 100644
>> --- a/src/pulsecore/card.c
>> +++ b/src/pulsecore/card.c
>> @@ -195,9 +195,13 @@ 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;
>> +        }
>
> Maybe also add a safeguard if all profiles are unavailable, e g like below:
>
>         if (!c->active_profile) {
>                c->active_profile = /* The first, or random, profile,
> just something */;
>                 pa_log_warn("No available profiles, selecting
> unavailable profile %s", c->active_profile->name);
>         }

What about assert if there is no profile that can be used? It already
asserts if the profile hash table is empty which is kind similar
situation here when no profile is available so perhaps we should
assert?

-- 
Luiz Augusto von Dentz
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to