diff options
author | Wim Taymans <wtaymans@redhat.com> | 2017-01-11 12:50:13 +0100 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2017-01-13 10:49:12 +0100 |
commit | 3bebe4ff9c6e6aeb1aed0384b99785e64e433921 (patch) | |
tree | 62804a6e91e8d1521ab2ab86d4b7b1c54e420585 | |
parent | 1010700206bc4343607e0a4b64671107e863385b (diff) |
suspend-on-idle: resume on unloadresume-unload-module
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.c | 14 |
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 a284f858e..268f0aec4 100644 --- a/src/modules/module-suspend-on-idle.c +++ b/src/modules/module-suspend-on-idle.c @@ -476,6 +476,8 @@ fail: void pa__done(pa_module*m) { struct userdata *u; + struct device_info *d; + void *state; pa_assert(m); @@ -484,6 +486,18 @@ void pa__done(pa_module*m) { u = m->userdata; + 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); |