mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	card: Log initial profile selection
Add logs to pa_card_choose_initial_profile and pa_card_set_profile to have detailed logging of the profile initialization logic.
This commit is contained in:
		
							parent
							
								
									784853004c
								
							
						
					
					
						commit
						a720938855
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -83,7 +83,7 @@ void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    c->available = available;
 | 
					    c->available = available;
 | 
				
			||||||
    pa_log_debug("Setting card %s profile %s to availability status %s", c->card->name, c->name,
 | 
					    pa_log_debug("Setting card %s profile %s to availability status %s", c->card->name, c->name,
 | 
				
			||||||
                 available == PA_AVAILABLE_YES ? "yes" : available == PA_AVAILABLE_NO ? "no" : "unknown");
 | 
					                 pa_available_to_string(available));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Post subscriptions to the card which owns us */
 | 
					    /* Post subscriptions to the card which owns us */
 | 
				
			||||||
    pa_assert_se(core = c->card->core);
 | 
					    pa_assert_se(core = c->card->core);
 | 
				
			||||||
| 
						 | 
					@ -199,7 +199,9 @@ void pa_card_choose_initial_profile(pa_card *card) {
 | 
				
			||||||
     * or if all profiles are unavailable, pick the profile with the highest
 | 
					     * or if all profiles are unavailable, pick the profile with the highest
 | 
				
			||||||
     * priority regardless of its availability. */
 | 
					     * priority regardless of its availability. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_log_debug("Looking for initial profile for card %s", card->name);
 | 
				
			||||||
    PA_HASHMAP_FOREACH(profile, card->profiles, state) {
 | 
					    PA_HASHMAP_FOREACH(profile, card->profiles, state) {
 | 
				
			||||||
 | 
					        pa_log_debug("%s availability %s", profile->name, pa_available_to_string(profile->available));
 | 
				
			||||||
        if (profile->available == PA_AVAILABLE_NO)
 | 
					        if (profile->available == PA_AVAILABLE_NO)
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -217,6 +219,7 @@ void pa_card_choose_initial_profile(pa_card *card) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    card->active_profile = best;
 | 
					    card->active_profile = best;
 | 
				
			||||||
    card->save_profile = false;
 | 
					    card->save_profile = false;
 | 
				
			||||||
 | 
					    pa_log_info("%s: active_profile: %s", card->name, card->active_profile->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Let policy modules override the default. */
 | 
					    /* Let policy modules override the default. */
 | 
				
			||||||
    pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE], card);
 | 
					    pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE], card);
 | 
				
			||||||
| 
						 | 
					@ -331,6 +334,7 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) {
 | 
				
			||||||
    if (c->linked && (r = c->set_profile(c, profile)) < 0)
 | 
					    if (c->linked && (r = c->set_profile(c, profile)) < 0)
 | 
				
			||||||
        return r;
 | 
					        return r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_log_debug("%s: active_profile: %s -> %s", c->name, c->active_profile->name, profile->name);
 | 
				
			||||||
    c->active_profile = profile;
 | 
					    c->active_profile = profile;
 | 
				
			||||||
    c->save_profile = save;
 | 
					    c->save_profile = save;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -338,7 +342,6 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) {
 | 
				
			||||||
        update_port_preferred_profile(c);
 | 
					        update_port_preferred_profile(c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (c->linked) {
 | 
					    if (c->linked) {
 | 
				
			||||||
        pa_log_info("Changed profile of card %u \"%s\" to %s", c->index, c->name, profile->name);
 | 
					 | 
				
			||||||
        pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], c);
 | 
					        pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], c);
 | 
				
			||||||
        pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
 | 
					        pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue