mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Allow policy module to pick 'off' profile
This allow 'off' profile to be choosen when no other profile is available which is considered better since it requires less resources than other profiles.
This commit is contained in:
		
							parent
							
								
									7fac520d89
								
							
						
					
					
						commit
						eb108b3539
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
					@ -143,12 +143,9 @@ static pa_card_profile *find_best_profile(pa_card *card) {
 | 
				
			||||||
    void *state;
 | 
					    void *state;
 | 
				
			||||||
    pa_card_profile *profile;
 | 
					    pa_card_profile *profile;
 | 
				
			||||||
    pa_card_profile *result = card->active_profile;
 | 
					    pa_card_profile *result = card->active_profile;
 | 
				
			||||||
    pa_card_profile *off;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pa_assert_se(off = pa_hashmap_get(card->profiles, "off"));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    PA_HASHMAP_FOREACH(profile, card->profiles, state) {
 | 
					    PA_HASHMAP_FOREACH(profile, card->profiles, state) {
 | 
				
			||||||
        if (profile->available == PA_AVAILABLE_NO || profile == off)
 | 
					        if (profile->available == PA_AVAILABLE_NO)
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (result == NULL ||
 | 
					        if (result == NULL ||
 | 
				
			||||||
| 
						 | 
					@ -157,7 +154,7 @@ static pa_card_profile *find_best_profile(pa_card *card) {
 | 
				
			||||||
            result = profile;
 | 
					            result = profile;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return result ? result : off;
 | 
					    return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_hook_result_t profile_available_hook_callback(pa_core *c, pa_card_profile *profile, void *userdata) {
 | 
					static pa_hook_result_t profile_available_hook_callback(pa_core *c, pa_card_profile *profile, void *userdata) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue