HDMI audio prevents screen saver

Here's another brilliant Apple fuckup: if your system audio output is set to HDMI, and iTunes is playing, your screen saver will never activate, and your screen will never lock, because coreaudiod prevents it:

    pmset -g assertions | grep DisplaySleep

This makes no goddamned sense, of course. NoIdleSleepAssertion makes sense for audio, but NoDisplaySleepAssertion only makes sense if video is actively playing and not paused, not merely audio.

The only way to fix this is to gently apply the Stick of Correction to the binary:

    sudo sh
    perl -pi -e 's/N(oDisplaySleepAssertion)/_$1/g' /usr/sbin/coreaudiod

Then you have to replace the signature with your own or it won't launch:

    codesign -vfs 'Your Name' /usr/sbin/coreaudiod

Then restart it:

    killall coreaudiod

You'll probably have to do that again every time you upgrade the OS. "Hooray."

Update, 2015: The above instructions work on MacOS 10.9. For instructions that work on MacOS 10.11, see this post.


Tags: , , ,

8 Responses:

  1. Otto says:

    Believe it or not, this is probably intentional.

    If you're using HDMI for Video and Audio, then you might have your video hooked up to something like a flat screen TV. And you might be listening to tunes over that TV's speakers.

    If the screensaver is allowed to kick in, then at some point, it may shut off the video signal due to idle powersaving type of mode. In which case, your TV might notice the lack of video and freak right-out, going into a "no video" mode, and also killing the audio. Which is likely not what you want a screensaver to do when playing tunes.

    One might think it would be nice if this were an option, but then again, it's an option most people probably aren't that interested in. The general case of using HDMI Audio is when also using HDMI Video, in which case you don't want either one of them to be disabled when one or the other is actively being used.

    • jwz says:

      One might think it would be nice if this were an option

      Except that it is an option: whether your monitor powers down, or makes pretty pictures, or merely goes dark. It's already in preferences.

      "I have one HDMI cable going from my iMac to my A/V tuner" doesn't sound like that weird a use case to me. "If music is playing, let's silently disable the security of having your screen auto-lock" is fantastically idiotic behavior. But hey, it's lost in the noise compared to "goto fail", right?

    • Joe Shelby says:

      That also ignores the situation of one using an HDMI TV as a 2nd monitor for its own sake (and using the speakers as a bonus part of it) rather than a large-screen TV being used for the home theater situation.

      Granted, I'm still not sure how to get font rendering to not suck when I do it that way in a 1080 mode, but there we are.

    • Glenn says:

      Believe it or not, screensavers are there for a reason--to protect the screen. Plasma TVs can still burn-in. If they want to prevent power-down, then prevent power-down--turning off the whole screensaver is insane.

  2. Dave Paola says:

    Oh, the humanity.

  3. jwb says:

    Things I have learned from this post: invoking /usr/bin/strings on a mac requires acceptance the iOS SDK license agreement. I am wtfing as hard as I can.

    $ strings /usr/sbin/coreaudiod

    Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

    • Tim says:

      Apple has shifted to electronic distribution of the OS and they're trying to cut down the download size. One consequence is that many things which used to be installed by default have been replaced by download-when-you-need-it installs. Printer drivers are what most people notice, but they've also removed all the developer-tool-ish command line tools and replaced them with hardlinks to an installer which can download and install the real thing. (You get to choose between a full copy of XCode, or just the command line tools.)

      That's why it's requesting root, and why you have to agree to a EULA: you are actually invoking an installer.