mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	alsa-mixer: It's valid to have zero elements in a path
It's valid for a path to have zero elements, e g if it contains a single jack only. Earlier, this would cause an assertion failure in pa_path_condense. Also convert pa_bool_t to bool. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
		
							parent
							
								
									3d65e9c49e
								
							
						
					
					
						commit
						6be21425cd
					
				
					 1 changed files with 13 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -3152,14 +3152,14 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
 | 
			
		|||
        PA_HASHMAP_FOREACH(p2, ps->paths, state2) {
 | 
			
		||||
            pa_alsa_element *ea, *eb;
 | 
			
		||||
            pa_alsa_jack *ja, *jb;
 | 
			
		||||
            pa_bool_t is_subset = TRUE;
 | 
			
		||||
            bool is_subset = true;
 | 
			
		||||
 | 
			
		||||
            if (p == p2)
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
            /* If a has a jack that b does not have, a is not a subset */
 | 
			
		||||
            PA_LLIST_FOREACH(ja, p->jacks) {
 | 
			
		||||
                pa_bool_t exists = FALSE;
 | 
			
		||||
                bool exists = false;
 | 
			
		||||
 | 
			
		||||
                if (!ja->has_control)
 | 
			
		||||
                    continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -3168,35 +3168,34 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
 | 
			
		|||
                    if (jb->has_control && pa_streq(jb->alsa_name, ja->alsa_name) &&
 | 
			
		||||
                       (ja->state_plugged == jb->state_plugged) &&
 | 
			
		||||
                       (ja->state_unplugged == jb->state_unplugged)) {
 | 
			
		||||
                        exists = TRUE;
 | 
			
		||||
                        exists = true;
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (!exists) {
 | 
			
		||||
                    is_subset = FALSE;
 | 
			
		||||
                    is_subset = false;
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            /* Compare the elements of each set... */
 | 
			
		||||
            pa_assert_se(ea = p->elements);
 | 
			
		||||
            pa_assert_se(eb = p2->elements);
 | 
			
		||||
            ea = p->elements;
 | 
			
		||||
            eb = p2->elements;
 | 
			
		||||
 | 
			
		||||
            while (is_subset) {
 | 
			
		||||
                if (pa_streq(ea->alsa_name, eb->alsa_name)) {
 | 
			
		||||
                if (!ea && !eb)
 | 
			
		||||
                    break;
 | 
			
		||||
                else if ((ea && !eb) || (!ea && eb))
 | 
			
		||||
                    is_subset = false;
 | 
			
		||||
                else if (pa_streq(ea->alsa_name, eb->alsa_name)) {
 | 
			
		||||
                    if (element_is_subset(ea, eb, m)) {
 | 
			
		||||
                        ea = ea->next;
 | 
			
		||||
                        eb = eb->next;
 | 
			
		||||
                        if ((ea && !eb) || (!ea && eb))
 | 
			
		||||
                            is_subset = FALSE;
 | 
			
		||||
                        else if (!ea && !eb)
 | 
			
		||||
                            break;
 | 
			
		||||
                    } else
 | 
			
		||||
                        is_subset = FALSE;
 | 
			
		||||
 | 
			
		||||
                        is_subset = false;
 | 
			
		||||
                } else
 | 
			
		||||
                    is_subset = FALSE;
 | 
			
		||||
                    is_subset = false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (is_subset) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue