mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	device-manager: Only store and save details for non-monitor sources
This commit is contained in:
		
							parent
							
								
									42b30e1aa2
								
							
						
					
					
						commit
						aa5d56ba75
					
				
					 1 changed files with 13 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -168,8 +168,8 @@ static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) {
 | 
			
		|||
 | 
			
		||||
static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) {
 | 
			
		||||
    struct userdata *u = userdata;
 | 
			
		||||
    struct entry entry, *old;
 | 
			
		||||
    char *name;
 | 
			
		||||
    struct entry entry, *old = NULL;
 | 
			
		||||
    char *name = NULL;
 | 
			
		||||
    pa_datum key, data;
 | 
			
		||||
 | 
			
		||||
    pa_assert(c);
 | 
			
		||||
| 
						 | 
				
			
			@ -205,6 +205,9 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
 | 
			
		|||
        if (!(source = pa_idxset_get_by_index(c->sources, idx)))
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        if (source->monitor_of)
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        name = pa_sprintf_malloc("source:%s", source->name);
 | 
			
		||||
 | 
			
		||||
        if ((old = read_entry(u, name)))
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +254,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data *new
 | 
			
		|||
 | 
			
		||||
    if ((e = read_entry(u, name))) {
 | 
			
		||||
        if (strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) {
 | 
			
		||||
            pa_log_info("Restoring description for sink %s.", name);
 | 
			
		||||
            pa_log_info("Restoring description for sink %s.", new_data->name);
 | 
			
		||||
            pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -276,7 +279,8 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data
 | 
			
		|||
    if ((e = read_entry(u, name))) {
 | 
			
		||||
 | 
			
		||||
        if (strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) {
 | 
			
		||||
            pa_log_info("Restoring description for sink %s.", name);
 | 
			
		||||
            /* NB, We cannot detect if we are a monitor here... this could mess things up a bit... */
 | 
			
		||||
            pa_log_info("Restoring description for sink %s.", new_data->name);
 | 
			
		||||
            pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -325,6 +329,11 @@ static void apply_entry(struct userdata *u, const char *name, struct entry *e) {
 | 
			
		|||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (source->monitor_of) {
 | 
			
		||||
                pa_log_warn("Cowardly refusing to set the description for monitor source %s.", source->name);
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            pa_log_info("Setting description for source %s.", source->name);
 | 
			
		||||
            pa_source_set_description(source, e->description);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue