diff options
Diffstat (limited to 'src/modules/module-device-manager.c')
-rw-r--r-- | src/modules/module-device-manager.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c index f125bdd..2a0a67f 100644 --- a/src/modules/module-device-manager.c +++ b/src/modules/module-device-manager.c @@ -292,8 +292,10 @@ static struct entry* entry_read(struct userdata *u, const char *name) { pa_zero(data); - if (!pa_database_get(u->database, &key, &data)) - goto fail; + if (!pa_database_get(u->database, &key, &data)) { + pa_log_debug("Database contains no data for key: %s", name); + return NULL; + } t = pa_tagstruct_new_fixed(data.data, data.size); e = entry_new(); @@ -647,8 +649,10 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha } static void route_sink_input(struct userdata *u, pa_sink_input *si) { + const char *auto_filtered_prop; const char *role; uint32_t role_index, device_index; + bool auto_filtered = false; pa_sink *sink; pa_assert(u); @@ -661,6 +665,10 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) { if (!si->sink) return; + auto_filtered_prop = pa_proplist_gets(si->proplist, "module-device-manager.auto_filtered"); + if (auto_filtered_prop) + auto_filtered = (pa_parse_boolean(auto_filtered_prop) == 1); + /* It might happen that a stream and a sink are set up at the same time, in which case we want to make sure we don't interfere with that */ @@ -682,6 +690,13 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) { if (!(sink = pa_idxset_get_by_index(u->core->sinks, device_index))) return; + if (auto_filtered) { + /* For streams for which a filter has been loaded by another module, we + * do not try to execute moves within the same filter hierarchy */ + if (pa_sink_get_master(si->sink) == pa_sink_get_master(sink)) + return; + } + if (si->sink != sink) pa_sink_input_move_to(si, sink, false); } @@ -705,8 +720,10 @@ static pa_hook_result_t route_sink_inputs(struct userdata *u, pa_sink *ignore_si } static void route_source_output(struct userdata *u, pa_source_output *so) { + const char *auto_filtered_prop; const char *role; uint32_t role_index, device_index; + bool auto_filtered = false; pa_source *source; pa_assert(u); @@ -722,6 +739,10 @@ static void route_source_output(struct userdata *u, pa_source_output *so) { if (!so->source) return; + auto_filtered_prop = pa_proplist_gets(so->proplist, "module-device-manager.auto_filtered"); + if (auto_filtered_prop) + auto_filtered = (pa_parse_boolean(auto_filtered_prop) == 1); + /* It might happen that a stream and a source are set up at the same time, in which case we want to make sure we don't interfere with that */ @@ -743,6 +764,13 @@ static void route_source_output(struct userdata *u, pa_source_output *so) { if (!(source = pa_idxset_get_by_index(u->core->sources, device_index))) return; + if (auto_filtered) { + /* For streams for which a filter has been loaded by another module, we + * do not try to execute moves within the same filter hierarchy */ + if (pa_source_get_master(so->source) == pa_source_get_master(source)) + return; + } + if (so->source != source) pa_source_output_move_to(so, source, false); } |