Skip to content

Gstreamer causing 100% cpu #7515

Closed
@supfors

Description

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:

homeassistant@hass:~$  top
PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                            
2655 homeass+  20   0 1292424  60808   6380 R 100.0  2.8  11:46.58 hass
homeassistant@hass:~$ ps aux |grep hass
homeass+   2407  0.3  3.2 1292664 71452 ?       Ssl  20:49   0:01 /opt/hass/bin/python3 /opt/hass/bin/hass --config /opt/hass
homeass+   2492  0.0  2.7 1108704 60700 ?       Sl   20:49   0:00 /opt/hass/bin/python3 /opt/hass/bin/hass --config /opt/hass
homeass+   2500 99.9  2.7 1292412 60756 ?       R    20:49   5:50 /opt/hass/bin/python3 /opt/hass/bin/hass --config /opt/hass

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:

media_player:
  - platform: gstreamer
    pipeline: "mulawenc ! rtppcmupay ! udpsink host=speaker port=5555"

Traceback (if applicable):
This is all I see in home-assistant.log:

homeassistant@hass:~$ cat log |grep gstr
2017-05-09 21:06:02 INFO (MainThread) [homeassistant.loader] Loaded media_player.gstreamer from homeassistant.components.media_player.gstreamer
2017-05-09 21:06:02 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.gstreamer
2017-05-09 21:06:02 INFO (Thread-7) [gsp] starting gstreamer
2017-05-09 21:06:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=media_player.gstreamer, old_state=None, new_state=<state media_player.gstreamer=idle; friendly_name=gstreamer, supported_features=16933 @ 2017-05-09T21:06:02.991053+02:00>>

Additional info:

homeassistant@hass:~$ pip3 show gi |grep Vers
Metadata-Version: 1.0
Version: 1.2
(hass) homeassistant@hass:~$ pip3 list
aiohttp (2.0.7)
appdirs (1.4.3)
async-timeout (1.2.0)
chardet (3.0.2)
homeassistant (0.44.1)
Jinja2 (2.9.6)
MarkupSafe (1.0)
multidict (2.1.4)
packaging (16.8)
pip (9.0.1)
pyparsing (2.2.0)
pytz (2017.2)
PyYAML (3.12)
requests (2.14.0)
setuptools (35.0.2)
six (1.10.0)
typing (3.6.1)
voluptuous (0.10.5)
wheel (0.29.0)
yarl (0.10.2)
homeassistant@hass:~$ dpkg -l |grep gst
ii  gir1.2-gst-plugins-base-1.0          1.8.3-1ubuntu0.2                         amd64        GObject introspection data for the GStreamer Plugins Base library
ii  gir1.2-gstreamer-1.0                 1.8.3-1~ubuntu0.1                        amd64        GObject introspection data for the GStreamer library
ii  gstreamer1.0-alsa:amd64              1.8.3-1ubuntu0.2                         amd64        GStreamer plugin for ALSA
ii  gstreamer1.0-plugins-base:amd64      1.8.3-1ubuntu0.2                         amd64        GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-good:amd64      1.8.3-1ubuntu0.4                         amd64        GStreamer plugins from the "good" set
ii  gstreamer1.0-plugins-ugly:amd64      1.8.3-1ubuntu0.1                         amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.0-plugins-ugly-amr:amd64  1.8.3-1ubuntu0.1                         amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.0-tools                   1.8.3-1~ubuntu0.1                        amd64        Tools for use with GStreamer
ii  gstreamer1.0-x:amd64                 1.8.3-1ubuntu0.2                         amd64        GStreamer plugins for X11 and Pango
ii  libgstreamer-plugins-base1.0-0:amd64 1.8.3-1ubuntu0.2                         amd64        GStreamer libraries from the "base" set
ii  libgstreamer-plugins-good1.0-0:amd64 1.8.3-1ubuntu0.4                         amd64        GStreamer development files for libraries from the "good" set
ii  libgstreamer1.0-0:amd64              1.8.3-1~ubuntu0.1                        amd64        Core GStreamer libraries and elements
ii  python3-gst-1.0

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions