mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	device-manager: Misc fixes to co-exist with other stream management/routing modules.
* Do not read or set the save_sink/save_source flags. This seems to be for module-stream-restore only... * Even if a sink is already set by an earlier module, still move it to the sink we dictate.
This commit is contained in:
		
							parent
							
								
									6e0dde1a7a
								
							
						
					
					
						commit
						996fc1f2e2
					
				
					 1 changed files with 30 additions and 40 deletions
				
			
		| 
						 | 
					@ -510,9 +510,6 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) {
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
    pa_assert(u->do_routing);
 | 
					    pa_assert(u->do_routing);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (si->save_sink)
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Skip this if it is already in the process of being moved anyway */
 | 
					    /* Skip this if it is already in the process of being moved anyway */
 | 
				
			||||||
    if (!si->sink)
 | 
					    if (!si->sink)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
| 
						 | 
					@ -568,9 +565,6 @@ static void route_source_output(struct userdata *u, pa_source_output *so) {
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
    pa_assert(u->do_routing);
 | 
					    pa_assert(u->do_routing);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (so->save_source)
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (so->direct_on_input)
 | 
					    if (so->direct_on_input)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -779,6 +773,9 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_new_data *new_data, struct userdata *u) {
 | 
					static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_new_data *new_data, struct userdata *u) {
 | 
				
			||||||
 | 
					    const char *role;
 | 
				
			||||||
 | 
					    uint32_t role_index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(c);
 | 
					    pa_assert(c);
 | 
				
			||||||
    pa_assert(new_data);
 | 
					    pa_assert(new_data);
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
| 
						 | 
					@ -787,13 +784,10 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
 | 
				
			||||||
        return PA_HOOK_OK;
 | 
					        return PA_HOOK_OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (new_data->sink)
 | 
					    if (new_data->sink)
 | 
				
			||||||
        pa_log_debug("Not restoring device for stream, because already set.");
 | 
					        pa_log_debug("Overriding device for stream, even although it is already set. I am evil that way...");
 | 
				
			||||||
    else {
 | 
					 | 
				
			||||||
        const char *role;
 | 
					 | 
				
			||||||
        uint32_t role_index;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(role = pa_proplist_gets(new_data->proplist, PA_PROP_MEDIA_ROLE)))
 | 
					    if (!(role = pa_proplist_gets(new_data->proplist, PA_PROP_MEDIA_ROLE)))
 | 
				
			||||||
            role_index = get_role_index("");
 | 
					        role_index = get_role_index("none");
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        role_index = get_role_index(role);
 | 
					        role_index = get_role_index(role);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -806,8 +800,6 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) {
 | 
					            if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) {
 | 
				
			||||||
                new_data->sink = sink;
 | 
					                new_data->sink = sink;
 | 
				
			||||||
                    new_data->save_sink = TRUE;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -816,6 +808,9 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_output_new_data *new_data, struct userdata *u) {
 | 
					static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_output_new_data *new_data, struct userdata *u) {
 | 
				
			||||||
 | 
					    const char *role;
 | 
				
			||||||
 | 
					    uint32_t role_index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(c);
 | 
					    pa_assert(c);
 | 
				
			||||||
    pa_assert(new_data);
 | 
					    pa_assert(new_data);
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
| 
						 | 
					@ -827,13 +822,10 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
 | 
				
			||||||
        return PA_HOOK_OK;
 | 
					        return PA_HOOK_OK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (new_data->source)
 | 
					    if (new_data->source)
 | 
				
			||||||
        pa_log_debug("Not restoring device for stream, because already set");
 | 
					        pa_log_debug("Overriding device for stream, even although it is already set. I am evil that way...");
 | 
				
			||||||
    else {
 | 
					 | 
				
			||||||
        const char *role;
 | 
					 | 
				
			||||||
        uint32_t role_index;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!(role = pa_proplist_gets(new_data->proplist, PA_PROP_MEDIA_ROLE)))
 | 
					    if (!(role = pa_proplist_gets(new_data->proplist, PA_PROP_MEDIA_ROLE)))
 | 
				
			||||||
            role_index = get_role_index("");
 | 
					        role_index = get_role_index("none");
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        role_index = get_role_index(role);
 | 
					        role_index = get_role_index(role);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -846,8 +838,6 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ((source = pa_idxset_get_by_index(u->core->sources, device_index))) {
 | 
					            if ((source = pa_idxset_get_by_index(u->core->sources, device_index))) {
 | 
				
			||||||
                new_data->source = source;
 | 
					                new_data->source = source;
 | 
				
			||||||
                    new_data->save_source = TRUE;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue