[pulseaudio-discuss] [PATCH] module-suspend-on-idle: resume on RUNNING otherwise restart
Ben Brewer
ben.brewer at codethink.co.uk
Mon Jan 13 08:03:47 PST 2014
If a source/sink changes state to RUNNING then we resume the stream
otherwise we set the module to restart which means it'll suspend
unless it's resumed.
---
src/modules/module-suspend-on-idle.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index 0585e51..e9f5d6c 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -409,7 +409,9 @@ static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, s
pa_sink_state_t state = pa_sink_get_state(s);
if (pa_sink_check_suspend(s) <= 0)
- if (PA_SINK_IS_OPENED(state))
+ if (PA_SINK_IS_RUNNING(state))
+ resume(d);
+ else
restart(d);
} else if (pa_source_isinstance(o)) {
@@ -417,7 +419,9 @@ static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, s
pa_source_state_t state = pa_source_get_state(s);
if (pa_source_check_suspend(s) <= 0)
- if (PA_SOURCE_IS_OPENED(state))
+ if (PA_SOURCE_IS_RUNNING(state))
+ resume(d);
+ else
restart(d);
}
--
1.7.9.5
More information about the pulseaudio-discuss
mailing list