summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2017-01-11 12:50:13 +0100
committerWim Taymans <wtaymans@redhat.com>2017-03-13 12:28:59 +0100
commit8479e69deb546135b2f18cf56b2b111360244f22 (patch)
treee5789ecddf598ff12394235ff3b61a90585036de
parenta49fc4bc56d0db9b5c3ecdc5c7d8c4d0b5baaf17 (diff)
suspend-on-idle: resume on unloadrhel-7.3
We need to resume all sinks we know about when unloading the module or else they will stay suspended forever.
-rw-r--r--src/modules/module-suspend-on-idle.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index 0a27a7066..00c828a1f 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -495,6 +495,8 @@ fail:
void pa__done(pa_module*m) {
struct userdata *u;
+ struct device_info *d;
+ void *state;
pa_assert(m);
@@ -539,6 +541,18 @@ void pa__done(pa_module*m) {
if (u->source_output_state_changed_slot)
pa_hook_slot_free(u->source_output_state_changed_slot);
+ PA_HASHMAP_FOREACH(d, u->device_infos, state) {
+ if (d->sink && pa_sink_get_state(d->sink) == PA_SINK_SUSPENDED) {
+ pa_log_debug("Resuming sink %s on module unload.", d->sink->name);
+ pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE);
+ }
+
+ if (d->source && pa_source_get_state(d->source) == PA_SOURCE_SUSPENDED) {
+ pa_log_debug("Resuming source %s on module unload.", d->source->name);
+ pa_source_suspend(d->source, false, PA_SUSPEND_IDLE);
+ }
+ }
+
pa_hashmap_free(u->device_infos);
pa_xfree(u);