INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: [23.0.102; Issue; Partially Solved] System hibernates while media is playing  (Read 4394 times)

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651

So I just discovered a problem: I have Xfce Power Manager set to blank the screen after five minutes of inactivity, and hibernate the system after fifteen. The former appears to be successfully prevented while playing back content via MC23, but not the latter. I was just in middle of watching something in full-screen Display View, only for my machine to suddenly hibernate. The Disable display from turning off (useful for HDMI audio) option under Options > Audio is checked.

Is there some other tweak I need to make?

Running Lubuntu 16.0.4 LTS.
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #1 on: March 21, 2018, 10:43:12 pm »

A thought?
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #2 on: March 22, 2018, 04:47:55 pm »

Confirmed that it does this when sleep mode is set to Suspend, as well.

Is this an MC problem, or a Linux configuration problem?
Logged

Awesome Donkey

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 7320
  • The color of Spring...
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #3 on: March 23, 2018, 03:51:17 am »

Kinda sounds like both a system configuration problem to me and also could be a MC problem too. I believe there are workarounds, e.g. using Caffeine while MC is running. The downside, I suppose, is if you have MC running 24/7 and Caffeine enabled all the time, that'd kinda defeat the purpose of having a system to hibernate after 15 minutes. But if you use Caffeine that supports a system tray icon (e.g. the Caffeine-ng fork) you can click the system tray to toggle the enabling/disabling of Caffeine while you're playing back media. If you're using Theater View (or any full screen application), Caffeine *should* be able to detect this if you have it setup and disable the system going to sleep.

Also, by what I mean that it could be a MC problem too, it's possible that the Disable display from turning off (useful for HDMI audio) option doesn't do anything on Linux. Bob would know for sure.
Logged
I don't work for JRiver... I help keep the forums safe from Viagra and other sources of sketchy pharmaceuticals.

Windows 11 2023 Update (23H2) 64-bit + Ubuntu 23.10 Mantic Minotaur 64-bit | Windows 11 2023 Update (23H2) 64-bit (Intel N305 Fanless NUC 16GB RAM/256GB NVMe SSD)
JRiver Media Center 32 (Windows + Linux) | Topping D50s DAC

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #4 on: March 23, 2018, 05:05:52 am »

There appear to be two likely scenarios:

  • MC's HDMI option does work, as it prevents screen time-out, but is not configured to prevent hibernation or suspension, as it should.
  • MC's HDMI option does not work; however, the Xfce Power Manager strangely regards MC's play-back as activity worth preventing screen time-out, but not hibernation or suspension.

Which do you think is more likely?

I'm willing to consider Caffeine-ng as an option, if I understand it to essentially be a supplement to Xfce Power Manager in the sense that it's better at detecting "activity" and keeping the system on when appropriate. If so, I could configure it to run at start-up as I did with MC and RealVNC Server. If not, there isn't much point, since an always-on system could be achieved by simply turning off all Xfce Power Manager features. :P
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10661
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #5 on: March 23, 2018, 05:10:49 am »

You would think that any action that warrants the screen to stay on would also prevent sleep/hibernation, because the screen does turn off when the PC goes into sleep. :P

As far as I know, we do have some power management stuff in the linux version, but I don't know how the situation is between different desktop environments and whatnot.

You could check the MC Reporter feature (Services & Plug-ins -> Reporter -> Power), it would tell you if MC tries to prevent sleep and the system just doesn't obey (or maybe MCs way to do that is not quite there yet), or if MC for some reason doesn't even try.
It should say something like "Playback (disable automatic sleep)".
Logged
~ nevcairiel
~ Author of LAV Filters

Awesome Donkey

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 7320
  • The color of Spring...
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #6 on: March 23, 2018, 05:14:25 am »

As far as I know, we do have some power management stuff in the linux version, but I don't know how the situation is between different desktop environments and whatnot.

I was kinda thinking that too. If MC does indeed do some power management stuff under Linux, I'm guessing it might work with GNOME or something like that? Whichever the default desktop environment for Debian currently is and what's being ran on the development box(es), either GNOME or Xfce. I think Bob uses Xfce, if I recall correctly. Hopefully he might know more what's supported and what's not here.

That's really one of the big problems using Linux vs. Windows or Mac, different desktop environments having different ways of doing things, including power management.

There appear to be two likely scenarios:

  • MC's HDMI option does work, as it prevents screen time-out, but is not configured to prevent hibernation or suspension, as it should.
  • MC's HDMI option does not work; however, the Xfce Power Manager strangely regards MC's play-back as activity worth preventing screen time-out, but not hibernation or suspension.

Which do you think is more likely?

Going on what Hendrik posted above, I'd say scenario number three;

  • MC's HDMI option might work for certain desktop environments (e.g. GNOME), but may won't work with others.

EDIT: Thinking about it more, there also could be another factor at play here... drivers. It's possible the HDMI option might work when using Mesa (AKA the open-source drivers) and might not work if using proprietary drivers, e.g. Nvidia. If you're using a 10 series Polaris-based Nvidia GPU (e.g. a 1050, 1060, etc.) you'd likely have no choice but to use the proprietary drivers due to lack of support in Nouveau (the open-source Nvidia drivers).
Logged
I don't work for JRiver... I help keep the forums safe from Viagra and other sources of sketchy pharmaceuticals.

Windows 11 2023 Update (23H2) 64-bit + Ubuntu 23.10 Mantic Minotaur 64-bit | Windows 11 2023 Update (23H2) 64-bit (Intel N305 Fanless NUC 16GB RAM/256GB NVMe SSD)
JRiver Media Center 32 (Windows + Linux) | Topping D50s DAC

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #7 on: March 23, 2018, 12:24:58 pm »

I'm using a GT 710. What are the strengths and draw-backs of using Nouveau over proprietary?
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #8 on: March 23, 2018, 08:32:22 pm »

What are the strengths and draw-backs of using Nouveau over proprietary?

...Well, found a draw-back: Nouveau drivers don't work for me. No signal after reboot. Plugged a monitor in to the on-board VGA port and switched back to the proprietary drivers.

I'll try the other suggested solutions.

Edit: See attachment. Am I supposed to run the reporter after a hibernation, or...?
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #9 on: March 24, 2018, 01:41:35 am »

Ignore the previous attachment and look at this one instead. This is what Reporter reports during play-back of a video file.

Also, research I've been doing 'round the Internet basically points to MC23 improperly inhibiting Xfce Power Manager. It works well enough to prevent screen time-out, but Suspend and Hibernate are another story. Whether this is because of LXDE, the Nvidia drivers, or what have you, I am not sure.

I looked in to Caffeine, but even with Caffeine Indicator configured to run at start-up, Caffeine itself appears to always run by default in the Deactivated state, which means that I have to manually switch it on every time time the system starts or awakens from hibernation. I have inspected the .py files, but I'm not advanced enough in Python programming to figure out which variable to change in order to correct this. Also, based on the code, I'm not entirely sure that it was actually written to prevent Hibernate; it might only work with Suspend. I guess it wouldn't be the worst concession for me to switch to Suspend if there's no helping it.

I have two questions:
  • Does Caffeine differentiate between a full-screen application and one that is merely in maximised windowed mode? I wouldn't want Suspend to be inhibited just because MC is maximised in Standard View. It doesn't, unfortunately.
  • Does Caffeine even care about any of that while it's on, or will it suppress Suspend regardless of the focused application state? The latter.

Ugh!

Is it impossible to get MC to play nicely with Xfce Power Manager and avoid all of this? I've honestly been at this for hours, trying to get Caffeine configured in a manner that's convenient for this set-up, but I just don't think this app is the answer. I don't normally have a keyboard and mouse connected to the machine in question; it's designed to be remote-controlled. All I really want to happen is for MC to run at start-up, for me to be able to play to it via JRemote or MO 4Media without having to remote in repeatedly or set up some (limited) application to prevent it from suspending mid-play-back, and for the system to go to sleep once play-back is over and it's been sitting idle for fifteen minutes. That sort of thing is an after-thought on Windows; I don't get why it's a veritable rigmarole here.

(Not ranting against MC in particular—I'm just frustrated with Linux right now. It's cool, but goodness!)
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #10 on: March 24, 2018, 04:47:30 pm »

Incidentally, if MC plays nice with some DE's and not others, which ones are you guys positive are the former? I might be willing to at least try Xfce instead.
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10661
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #11 on: March 24, 2018, 05:07:46 pm »

I did some digging and it appears that sleep prevention is not fully implemented for Linux, only screen-on locks are implemented.
Will probably have to wait for Bob to comment on his plans for this.
Logged
~ nevcairiel
~ Author of LAV Filters

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651
Re: [23.0.102; Issue] System hibernates while media is playing
« Reply #12 on: March 25, 2018, 03:43:27 am »

So it's an MC issue, then, and not one with the DE?
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651

I've taken to setting the Xfce Power Manager options so that they just blank the screen after five minutes, turned off automatic suspension/hibernation, and installed xbindkeys to effect a key bind that initiates suspension—easy enough to call via VNC when xbindkeys actually autostarts like it's supposed to (it doesn't always do so for some reason). My TV has its own energy-saving/auto-power-off features, so this is an acceptable configuration.

I really prefer automated solutions, so I still look forward to a remedy on the MC side in handling suspension/hibernation inhibition during play-back. Until then, thank you guys again for your insight! :)
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2550

You could write a small PM script that polls MCWS. If you need help, let me know.
Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651

I'm intrigued. What do you mean?
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2550

I'm intrigued. What do you mean?

/usr/lib/pm-utils/sleep.d/10-jriver-preventsleep.sh
Code: [Select]
#!/usr/bin/env bash

x=0
x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
[ "$x" -eq 0 ] && return 0 || return 1

If pm-utils is not available on your distro you can use xdotool to keep the computer awake:

Code: [Select]
#!/usr/bin/env bash

while true; do
  x=0
  x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
  [ "$x" -eq 0 ] && sleep 5 || {xdotool key shift; sleep 15}
done


Logged

Goatshade

  • Citizen of the Universe
  • *****
  • Posts: 651

Interesting. I'll have to try it when I get home.

Will this also work for hibernation, or would I need to modify the code for it to do so?
Logged

BryanC

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2550

Interesting. I'll have to try it when I get home.

Will this also work for hibernation, or would I need to modify the code for it to do so?

It should work for either. You can also call the first option from systemd if you prefer, as a requirement for sleep.target or hybrid-sleep.target (or whatever your distro ships with).
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13452

/usr/lib/pm-utils/sleep.d/10-jriver-preventsleep.sh
Code: [Select]
#!/usr/bin/env bash

x=0
x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
[ "$x" -eq 0 ] && return 0 || return 1

If pm-utils is not available on your distro you can use xdotool to keep the computer awake:

Code: [Select]
#!/usr/bin/env bash

while true; do
  x=0
  x=$(curl -s -u user:pass --request GET http://localhost:52199/MCWS/v1/Playback/Info | grep -oP '(?<=<Item Name="State">).*?(?=</Item>)')
  [ "$x" -eq 0 ] && sleep 5 || {xdotool key shift; sleep 15}
done
That's an interesting way of handling the issue at the user level.
I'm late to this thread but MC on linux is only doing low level operations to prevent hdmi from blanking using xset on the monitor sleep period and blanking. It doesn't do any dbus operations.
Logged
Pages: [1]   Go Up