summaryrefslogtreecommitdiff
path: root/src/modules/module-suspend-on-idle.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-06-05 19:05:07 +0200
committerLennart Poettering <lennart@poettering.net>2009-06-05 19:05:07 +0200
commit00797b8b6ea7978f862facb7181fb04895caf23c (patch)
treebf483383098ee82f2ac1d051ac82fdf8bbb0cf3f /src/modules/module-suspend-on-idle.c
parent3af5f8cb553e512305c1f3603b57424c36c9c82c (diff)
downloadpulseaudio-00797b8b6ea7978f862facb7181fb04895caf23c.tar.gz
core: add a suspend cause flags field
Diffstat (limited to 'src/modules/module-suspend-on-idle.c')
-rw-r--r--src/modules/module-suspend-on-idle.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index cc69d74c2..c5b789114 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -86,14 +86,14 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval
d->userdata->core->mainloop->time_restart(d->time_event, NULL);
- if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && pa_sink_get_state(d->sink) != PA_SINK_SUSPENDED) {
+ if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) {
pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name);
- pa_sink_suspend(d->sink, TRUE);
+ pa_sink_suspend(d->sink, TRUE, PA_SUSPEND_IDLE);
}
- if (d->source && pa_source_check_suspend(d->source) <= 0 && pa_source_get_state(d->source) != PA_SOURCE_SUSPENDED) {
+ if (d->source && pa_source_check_suspend(d->source) <= 0 && !(d->source->suspend_cause & PA_SUSPEND_IDLE)) {
pa_log_info("Source %s idle for too long, suspending ...", d->source->name);
- pa_source_suspend(d->source, TRUE);
+ pa_source_suspend(d->source, TRUE, PA_SUSPEND_IDLE);
}
}
@@ -127,13 +127,13 @@ static void resume(struct device_info *d) {
d->userdata->core->mainloop->time_restart(d->time_event, NULL);
if (d->sink) {
- pa_sink_suspend(d->sink, FALSE);
+ pa_sink_suspend(d->sink, FALSE, PA_SUSPEND_IDLE);
pa_log_debug("Sink %s becomes busy.", d->sink->name);
}
if (d->source) {
- pa_source_suspend(d->source, FALSE);
+ pa_source_suspend(d->source, FALSE, PA_SUSPEND_IDLE);
pa_log_debug("Source %s becomes busy.", d->source->name);
}