Issue with GStreamer, music not playing, strange error message

Hi,

I am trying to set up a Mopidy Raspberry Pi B v2 with HifiBerry DAC and Touchscreen (Adafruit).
So far, I already had almost everything working individually, but nothing at the same time. With support from “9and3r” I got his excellent Mopidy-Touchscreen extension running - so this is now perfect. Before, also my Hifiberry worked like a charm - but now not any longer.

What I had to do amongst other things to get the Touchscreen extension running was to run Mopidy as root. I am not sure whether the calls to GStreamer from Mopidy are also run as root - I could well imagine part of the issue might arise from that.

I constantly get the following error now when I try to start a song (from webclient or touchscreen, same issue):

2014-11-14 19:36:31,751 ERROR [2478:MainThread] mopidy.audio.actor: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure. Debug message: gstplaysink.c(1899): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0

I tried to see whether I can get GStreamer under the console working - both the following commands play a pretty annoying beep through my Hifiberry, so seems working:

gst-launch-0.10 audiotestsrc ! audioresample ! autoaudiosink
gst-launch-0.10 audiotestsrc ! audioresample ! alsasink

Also mplayer plays perfectly from the console, no issues with that.

When I call gst-launch from the console without commands, I get an error though - not sure this might be an issue:

root@musikkiste:~# gst-launch-0.10
ERROR: pipeline could not be constructed: empty pipeline not allowed.

System is a Raspbian 2014-09-09 pure, with the rpi-firmware updated through:

REPO_URI=https://github.com/notro/rpi-firmware rpi-update

I would really appreciate your support - I have no further idea what I could try to get this up and running.
Thanks for pointing me into probable right directions!

lumihei


> Mopidy Deps output:
root@musikkiste:~# mopidy deps
Platform: Linux-3.12.25+-armv6l-with-debian-7.6
Python: CPython 2.7.3 from /usr/lib/python2.7
Mopidy: 0.19.4 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
  tornado>=2.3: 2.3 from /usr/lib/python2.7/dist-packages
Mopidy-Touchscreen: 0.2.1 from /usr/local/lib/python2.7/dist-packages/Mopidy_Touchscreen-0.2.1-py2.7.egg
  setuptools: 0.6c11 from /usr/lib/python2.7/dist-packages
  Mopidy>=0.18: 0.19.4 from /usr/lib/python2.7/dist-packages
    Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
    tornado>=2.3: 2.3 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
  pygame: 1.9.1release from /usr/lib/python2.7/dist-packages
Mopidy-MusicBox-Webclient: 1.0.3 from /usr/local/lib/python2.7/dist-packages
  setuptools: 0.6c11 from /usr/lib/python2.7/dist-packages
  Mopidy>=0.19: 0.19.4 from /usr/lib/python2.7/dist-packages
    Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
    tornado>=2.3: 2.3 from /usr/lib/python2.7/dist-packages
Mopidy-Dirble: 0.1.1 from /usr/local/lib/python2.7/dist-packages
  setuptools: 0.6c11 from /usr/lib/python2.7/dist-packages
  Mopidy>=0.18: 0.19.4 from /usr/lib/python2.7/dist-packages
    Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
    tornado>=2.3: 2.3 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
  pycountry: 0.14.1 from /usr/lib/python2.7/dist-packages
Mopidy-Youtube: 1.0.1 from /usr/local/lib/python2.7/dist-packages
  setuptools: 0.6c11 from /usr/lib/python2.7/dist-packages
  requests>=2.2.1: 2.4.3 from /usr/local/lib/python2.7/dist-packages
  pafy>=0.3.35: 0.3.64 from /usr/local/lib/python2.7/dist-packages
  Mopidy>=0.18: 0.19.4 from /usr/lib/python2.7/dist-packages
    Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
    tornado>=2.3: 2.3 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
Mopidy-Spotify: 1.2.0 from /usr/local/lib/python2.7/dist-packages
  setuptools: 0.6c11 from /usr/lib/python2.7/dist-packages
  Mopidy>=0.18: 0.19.4 from /usr/lib/python2.7/dist-packages
    Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
    tornado>=2.3: 2.3 from /usr/lib/python2.7/dist-packages
  Pykka>=1.1: 1.2.0 from /usr/lib/python2.7/dist-packages
  pyspotify>=1.9,<1.999: 1.11 from /usr/lib/pymodules/python2.7
GStreamer: 0.10.36.0 from /usr/lib/python2.7/dist-packages/gst-0.10/gst
  Detailed information:
    Python wrapper: gst-python 0.10.22.0
    Relevant elements:
      Found:
        uridecodebin
        souphttpsrc
        appsrc
        alsasink
        osssink
        oss4sink
        id3demux
        id3v2mux
        lame
        mad
        mp3parse
        vorbisdec
        vorbisenc
        vorbisparse
        oggdemux
        oggmux
        oggparse
        flacdec
        flacparse
        shout2send
      Not found:
        pulsesink
        flump3dec
1 Like

PS - sounded similar to this issue – but I checked and I am not trying to run multiple instances or sounds at the same time.

PPS.: Issue also sounded a bit like the following, but adding user root to group “music” did not fix my problem.

PPPS.: tried running it again as user “mopidy”, part of group “audio” - still having the same error messages.
Therefore can’t be related to user “root” running mopidy I believe.

Any ideas?
Before I start reinstalling it yet again, it would be great to have some other ideas I could try out - yet mine are gone…

https://docs.mopidy.com/en/develop/troubleshooting/#debugging-gstreamer might help, without those low level GStreaner logs there isn’t much anyone can do but guess.

Hi adamcik,

thanks for your support! I did try to get some further debug logs and copied them here. To be honest I don’t know how to read this log - overwhelms me with information.
I realized some of it is German - not sure if it’s due to locale settings.

BTW - I tried it several times and can reproduce the error, even with a separate fresh Raspbian install by installing or de-installing the extension “Mopidy-Touchscreen”. @9and3r: Might be in correlation with “Mopidy-Musicbox-Webclient” since you seem to use Moped and apparently do not have the issue - or with a newer version of Raspbian - or with the modules I use for HifiBerry (DAC)

Just from reading the log this seems interesting to me - as if I had another resourdce exclusively using the device.

alsa pcm_hw.c:1293:snd_pcm_hw_open:e[00m alsalib error: open '/dev/snd/pcmC0D0p' failed (-16): Das Gerät oder die Ressource ist belegt
0:00:44.863231773 e[332m 3277e[00m   0xe0ac60 e[33;01mWARN   e[00m e[00m                alsa gstalsasink.c:689:gst_alsasink_open:<alsasink0>e[00m error: Audio-Gerät konnte nicht zur Wiedergabe geöffnet werden. Es wird durch eine andere Anwendung verwendet.
0:00:44.863507768 e[332m 3277e[00m   0xe0ac60 e[33;01mWARN   e[00m e[00m                alsa gstalsasink.c:689:gst_alsasink_open:<alsasink0>e[00m error: Device 'default' is busy

Here the complete log until I killed the mopidy process:

Logfile from GStreamer according to the link of @adamcik

Managed to get it translated into English - had initially set the locales into German.

Here the Logfile - portion I believe is relevant:

pygst gstbuffer.override:69:_wrap_gst_buffer_new:^[[00m pyo:0x2e0c050 pyr:1 minio:0xae42b090 minir:1
             alsa pcm_hw.c:1293:snd_pcm_hw_open:^[[00m alsalib error: open '/dev/snd/pcmC0D0p' failed (-16): Device or resource busy
             alsa gstalsasink.c:689:gst_alsasink_open:<alsasink0>^[[00m error: Could not open audio device for playback. Device is being used by another application.
             alsa gstalsasink.c:689:gst_alsasink_open:<alsasink0>^[[00m error: Device 'default' is busy
31;47m    GST_ERROR_SYSTEM gstelement.c:1964:gst_element_message_full:<alsasink0>^[[00m posting message: Could not open audio device for playback. Device is being used by another application.
31;47m    GST_ERROR_SYSTEM gstelement.c:1987:gst_element_message_full:<alsasink0>^[[00m posted error message: Could not open audio device for playback. Device is being used by another application.
31m          GST_STATES gstelement.c:2768:gst_element_change_state:<alsasink0>^[[00m have FAILURE change_state return
            pygst gstbuffer.override:50:_wrap_gst_buffer_new:^[[00m self:0x2db5ec0
            pygst gstbuffer.override:69:_wrap_gst_buffer_new:^[[00m pyo:0x2db5ec0 pyr:1 minio:0xae42b0f8 minir:1
31m          GST_STATES gstelement.c:2335:gst_element_abort_state:<alsasink0>^[[00m aborting state from NULL to READY
31m          GST_STATES gstbin.c:2542:gst_bin_change_state_func:<bin0>^[[00m child 'alsasink0' failed to go to state 2(READY)
31m          GST_STATES gstelement.c:2768:gst_element_change_state:<bin0>^[[00m have FAILURE change_state return
31m          GST_STATES gstelement.c:2460:gst_element_continue_state:<alsasink0>^[[00m completed state change to NULL
31m          GST_STATES gstbin.c:2526:gst_bin_change_state_func:<bin0>^[[00m child 'alsasink0' changed state to 1(NULL) successfully
31m          GST_STATES gstelement.c:2460:gst_element_continue_state:<bin0>^[[00m completed state change to NULL
         playsink gstplaysink.c:1899:gen_audio_chain:<playsink0>^[[00m error: Configured audiosink bin0 is not working.
31;47m    GST_ERROR_SYSTEM gstelement.c:1964:gst_element_message_full:<playsink0>^[[00m posting message: Configured audiosink bin0 is not working.
31;47m    GST_ERROR_SYSTEM gstelement.c:1987:gst_element_message_full:<playsink0>^[[00m posted error message: Configured audiosink bin0 is not working.

Apart from that, I tried to set the alsa sound config file (/etc/asound.conf) to nonblock - mode. That however still does not fix the issue:

pcm.!default  {
        type hw
        card 0
        nonblock TRUE
    }
    ctl.!default {
        type hw
        card 0
        nonblock TRUE....
    }

Closed / solved for now.
Thanks, 9and3r!

Looks like the problem was that SDL/PyGame was also grabbing the audio device, and with the asound config you were using it wasn’t possible for multiple processes to open it at the same time. As shown by the Audio-Gerät konnte nicht zur Wiedergabe geöffnet werden. Es wird durch eine andere Anwendung verwendet.

(Just adding this so anyone else that runs into something similar has a bit more of an explanation)