pelya / xserver-xsdl

XSDL - X.Org server ported to Android using SDL.
https://play.google.com/store/apps/details?id=x.org.server
Other
310 stars 55 forks source link

Audio is active even if no audio is playing #121

Open ricktu288 opened 4 years ago

ricktu288 commented 4 years ago

When I connect my phone to a bluetooth headset, the the headset is always in the active (playing) state whenever the XSDL server is running, even if running in background with battery protection on, and without any process actually playing audio.

Is there any option to turn off the audio if no process is playing audio? Or at least turn it off when the app is in background?

zanfix commented 4 years ago

Hi, I noticed that: If I put my tablet to sleep with Xsdl and chroot env running (tablet on, but with screen off...) and connect to it with ssh and inspect the running processes with htop:

So there is a constant ~14/15% CPU usage while not actively using the device.

This will drain the battery very quickly (for me at least). This will make the tablet last 1 day or less in sleep mode I tried activating the battery optimization and, it seems better, not sure... But it will anyway drain 15% of my 9000mAh in 4 hours or so... If Xsdl is not running the tablet will last weeks in sleep mode...

My opinion would be to add an option or something, to disable audio playback in the background (or when in sleep mode?) if not needed/wanted by the user...

JanuszChmiel commented 4 years ago

Very good observation. I have noticed similar behaviour even on Pulseaudio for Termux. But only, when Orca screen reader initialize Speech-dispatcher. In this case, sound channel is permanently initialized and transistors are producing soft noise. To prevent transistors deterioration I always terminate Orca screen reader. But this situation is not interested for sighted users. Sound support is The most painful software task. In most cases, OpenSLES is being used. There is also Simple protocol player availagle on Google Play. It is standalone independent Android app which support Simple protocol which exist as A part of Pulseaudio. More info are available on his block. This approach have big disadvantage. You would had to run Pulseaudio directly on Chroot environment. And because Pulseaudio for Linux is very complex C app which makes many various memory related tasks, it can randomly crash. You will also notice sound quality loss if you will use Simple protocol player or Pulsedroid available on Github. Even when you will disable shared memory support for Pulseaudio, it can randomly crash for some reasons. Finding balance between power management effectivity and sound quality is be The way not easy task even on A standalone Linux distribution.

zanfix commented 4 years ago

there is always some kind of overhead running this kind of setup. would run way better without any layers of software feeding data between them

Anyway the thing does not run so bad