[vlc-commits] misc: Fix macOS IOKit inhibit plugin

Marvin Scholz git at videolan.org
Fri May 17 19:15:13 CEST 2019


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri May 17 19:13:28 2019 +0200| [6c6d762268c006143c991114f0aa83e385b0138f] | committer: Marvin Scholz

misc: Fix macOS IOKit inhibit plugin

Apparently the wrong version was pushed to the repo, this is the fixed
version that handles VLC_INHIBIT_NONE properly and correctly releases
previous inhibition assertions.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c6d762268c006143c991114f0aa83e385b0138f
---

 modules/misc/inhibit/iokit-inhibit.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/misc/inhibit/iokit-inhibit.c b/modules/misc/inhibit/iokit-inhibit.c
index 28ce1d94c2..a361fe8bcb 100644
--- a/modules/misc/inhibit/iokit-inhibit.c
+++ b/modules/misc/inhibit/iokit-inhibit.c
@@ -53,6 +53,7 @@ static void UpdateInhibit(vlc_inhibit_t *ih, unsigned mask)
             msg_Err(ih, "Failed releasing previous IOPMAssertion, "
                 "not acquiring new one!");
         }
+        sys->inh_assertion_id = kIOPMNullAssertionID;
     }
 
     // Order is important here, if we prevent display sleep, it means
@@ -92,9 +93,12 @@ static void UpdateInhibit(vlc_inhibit_t *ih, unsigned mask)
                                           activity_reason,
                                           &(sys->inh_assertion_id));
 
-    } else {
-        msg_Warn(ih, "Unhandled inhibiton mask (%i)", mask);
+    } else if ((mask & VLC_INHIBIT_NONE) == VLC_INHIBIT_NONE) {
+        msg_Dbg(ih, "Removed previous inhibition");
         return;
+    } else {
+         msg_Warn(ih, "Unhandled inhibiton mask (%i)", mask);
+         return;
     }
 
     if (ret != kIOReturnSuccess) {



More information about the vlc-commits mailing list