-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gstreamer causing 100% cpu #7515
Comments
Yeah, that's a known issue at this point, for what it's worth. You could downgrade |
Thanks @happyleavesaoc Tried version 1.0.0. No joy. |
I tried reverting the gstreamer-player pip package to 1.0 as well as backing out a738767 Unfortunately both still produce 100% CPU. I need to find another way to get TTS to pulseaudio.. (for mixing). |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 |
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍 |
This is actually still an issue exactly as described above. As @happyleavesaoc mentions above, it apparently remains a known issue. Could someone please re-open so we can keep this in-context rather than making a new issue? |
This is still an issue. Are we really supposed to create a new issue, despite the discussion here, just because a bot auto-closed a known issue? |
I see the component is based on gstreamer-player. I don't know Python that much, but there must certainly be better supported player modules for python/gstreamer around (one fork, zero stars)? I am also experiencing this problem. 100% on one core. I'm using Arch Linux btw. |
I have the same issue so had to disable it. Unfortunately it is the only way I have tts working to test some other stuff. FWIW, happyleaves created that gstream-player and also the home assistant component. There don't seem to be any good alternatives so... |
It is still actually with Home Assistant 0.61.1 and RPI3 (with up-to-date Raspbian). |
I've made some attempts to solve this problem, but I didn't come to a good solution, because gstreamer needs a second event loop, incompatible with the home assistant main loop. I encourage someone to either find a better gstreamer-based player to integrate (I could not), or submit a PR to |
the gstreamer-player has a while true loop, with nonblock in it. This causes the 100% CPU. def run(self):
"""Run the process.
Iterate the GLib main loop and process the task queue.
"""
loop = GLib.MainLoop()
context = loop.get_context()
while True:
time.sleep(0.1)
if context.pending():
context.iteration()
self._manager[ATTR_POSITION] = self._position()
try:
method, args = self._task_queue.get(False)
getattr(self, method)(**args)
except queue.Empty:
pass
if self.state != STATE_IDLE:
continue
try:
uri = self._media_queue.get(False)
self.media(uri)
except queue.Empty:
pass |
@zhujisheng that's an interesting fix. Have you checked the CPU usage before and after? Do you notice any difference? Unfortunately I can't test it as I just upgraded to Python3.6, and Gstreamer wouldn't setup.
Anyone run into this problem? CC: @happyleavesaoc |
I tested it in python3.5, it's ok. |
@zhujisheng I never acknowledged since your last response... My apologies! I tested it on my end, and the CPU is no longer utilized at it's peak. Thank you for the simple fix! It went down from an average 100% utilization to an average 2% utilization... What a big difference it makes! |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 |
That fixed it for me too in Python 3.6. We should file a bug in the dependency. Ok I made one. happyleavesaoc/gstreamer-player#4. This can be tagged as problem in dependency. |
Issue in dependency is now closed. This can be closed too. |
@partofthething maybe we should wait until the fix is released and the version of the library is bumped in home assistant? Is that in progress? |
@MartinHjelmare excellent point, yes we should. I'll see if i can get some info on the next release. |
Home Assistant release (
hass --version
):0.44.1
Python release (
python3 --version
):Python 3.5.2
Component/platform:
Gstreamer
Ubuntu 16.04.2 LTS
4.4.0-62-generic
Description of problem:
When enabling gstreamer, cpu load jumps to 100%. I've noticed hass spawned 2 extra processes in addition to its leader process:
I've tested multiple pipelines (and even without pipeline) but this does not seem to cause the issue.
Daemon running on the player/speaker:
supfors@speaker:~$ gst-launch-1.0 udpsrc port=5555 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! alsasink
The streaming of audio (tts.google_say f.e.) works fine.
I do not see this kind of behaviour when testing from command line using gst-launch-1.0:
homeassistant@hass:~$ gst-launch-1.0 audiotestsrc freq=1000 ! mulawenc ! rtppcmupay ! udpsink host=speaker port=5555
Expected:
Near idle cpu-load when using gstreamer.
Problem-relevant
configuration.yaml
entries and steps to reproduce:Traceback (if applicable):
This is all I see in home-assistant.log:
Additional info:
The text was updated successfully, but these errors were encountered: