[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] module-suspend-on-idle: Allow suspending a sink when the monitor source becomes idle

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Mon May 16 18:07:39 UTC 2022



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
bb5823a3 by Igor V. Kovalenko at 2022-05-16T18:05:03+00:00
module-suspend-on-idle: Allow suspending a sink when the monitor source becomes idle

When monitor source becomes idle it may happen that monitored sink has no
uncorked inputs anymore and can now be suspended. To allow this, detect if state
is changed for monitor source and check state of monitored sink instead.

This change allows pulseaudio to suspend devices when pavucontrol volume meters
are disabled and corresponding peaks resampled streams are corked.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/697>

- - - - -


1 changed file:

- src/modules/module-suspend-on-idle.c


Changes:

=====================================
src/modules/module-suspend-on-idle.c
=====================================
@@ -385,8 +385,17 @@ static pa_hook_result_t device_state_changed_hook_cb(pa_core *c, pa_object *o, s
     pa_object_assert_ref(o);
     pa_assert(u);
 
-    if (!(d = pa_hashmap_get(u->device_infos, o)))
-        return PA_HOOK_OK;
+    if (!(d = pa_hashmap_get(u->device_infos, o))) {
+        /* We never suspend monitor sources, therefore they are not in the map.
+         * Still, when monitor source becomes idle it may happen that monitored
+         * sink has no uncorked inputs anymore and can now be suspended.
+         */
+        if (pa_source_isinstance(o) && PA_SOURCE(o)->monitor_of) {
+            pa_log_debug("State of monitor source '%s' has changed, checking state of monitored sink", PA_SOURCE(o)->name);
+            return device_state_changed_hook_cb(c, PA_OBJECT(PA_SOURCE(o)->monitor_of), u);
+        } else
+            return PA_HOOK_OK;
+    }
 
     if (pa_sink_isinstance(o)) {
         pa_sink *s = PA_SINK(o);



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/bb5823a3c9c137a2f2fa45c27e7f7322d6a6eb28

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/bb5823a3c9c137a2f2fa45c27e7f7322d6a6eb28
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20220516/bf66c73d/attachment.htm>


More information about the pulseaudio-commits mailing list