summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <git@arunraghavan.net>2015-06-09 12:07:44 +0530
committerArun Raghavan <git@arunraghavan.net>2015-06-12 12:43:18 +0530
commitceae6b1e61e97c45c726a09ffc74b0ee72a66303 (patch)
tree5717786104f0c2eecb57a636904611cd0fa19ca5
parent81f7589a3fcba771e94d2aec67fb9e04a44e7086 (diff)
always-sink: Ignore filter sinks
We don't want to count filter sinks towards the list of actual sinks, since those also need a real underlying sink to exist.
-rw-r--r--src/modules/module-always-sink.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/modules/module-always-sink.c b/src/modules/module-always-sink.c
index d2edf125d..b5721bf37 100644
--- a/src/modules/module-always-sink.c
+++ b/src/modules/module-always-sink.c
@@ -61,12 +61,15 @@ static void load_null_sink_if_needed(pa_core *c, pa_sink *sink, struct userdata*
pa_assert(c);
pa_assert(u);
- pa_assert(u->null_module == PA_INVALID_INDEX);
+
+ if (u->null_module != PA_INVALID_INDEX)
+ return; /* We've already got a null-sink loaded */
/* Loop through all sinks and check to see if we have *any*
- * sinks. Ignore the sink passed in (if it's not null) */
+ * sinks. Ignore the sink passed in (if it's not null), and
+ * don't count filter sinks. */
PA_IDXSET_FOREACH(target, c->sinks, idx)
- if (!sink || target != sink)
+ if (!sink || ((target != sink) && !pa_sink_is_filter(target)))
break;
if (target)
@@ -111,6 +114,10 @@ static pa_hook_result_t put_hook_callback(pa_core *c, pa_sink *sink, void* userd
if (sink->module && sink->module->index == u->null_module)
return PA_HOOK_OK;
+ /* We don't count filter sinks since they need a real sink */
+ if (pa_sink_is_filter(sink))
+ return PA_HOOK_OK;
+
pa_log_info("A new sink has been discovered. Unloading null-sink.");
pa_module_unload_request_by_index(c, u->null_module, true);