I've made basic gstreamer player:

import threading
import gst
import gobject

class BasicPlayer(threading.Thread):

    def __init__(self, musiclist):
        self.musiclist = musiclist
        self.song_num = 0

    def construct_pipeline(self):
        self.player = gst.element_factory_make("playbin")
        self.is_playing = False

    def connect_signals(self):
        # In this case, we only capture the messages
        # put on the bus.
        bus = self.player.get_bus()
        bus.connect("message", self.message_handler)

    def play(self):
        self.is_playing = True

    def handle_error(self, message):

    def set_property_file(self):
            "uri", "file://"+"/home/user/work/mp3/"+self.musiclist[

    def stop(self):
        self.is_playing = False

    def message_handler(self, bus, message):
        # Capture the messages on the bus and
        # set the appropriate flag.
        msgType = message.type
        if msgType == gst.MESSAGE_ERROR:
        elif msgType == gst.MESSAGE_EOS:
            if self.song_num < len(self.musiclist)-1:
                self.song_num += 1

class GobInit(threading.Thread):
    def __init__(self):

    def run(self):
        self.loop = gobject.MainLoop()

def main():
    gob = GobInit()
    player = BasicPlayer(['test1.mp3', 'test2.mp3', 'test3.mp3'])
    print('player created')
    print('start play')


It works well on my ubuntu desktop, but when i'm trying to run it on raspberry (i want to hear songs via headphones) i'm getting errors and no any sound:

player created
start play
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
jack server is not running or cannot be started
Cannot connect to server socket err = Connection refused
Cannot connect to server request channel
jack server is not running or cannot be started
<gst.Message GstMessageError, gerror=(GError)NULL, debug=(string)"pulsesink.c\(570\):\ gst_pulseringbuffer_open_device\ \(\):\ /GstPulseSink:audiosink-actual-sink-pulse"; from audiosink-actual-sink-pulse at 0x747d6830>
<gst.Message GstMessageError, gerror=(GError)NULL, debug=(string)"gstautoaudiosink.c\(369\):\ gst_auto_audio_sink_detect\ \(\):\ /GstPlayBin:playbin0/GstBin:abin/GstAutoAudioSink:audiosink:\012Failed\ to\ find\ a\ supported\ audio\ sink"; from audiosink at 0x747d6950>

I've installed pulseaudio on rasp and it's running, followed this tutorial: http://blog.scphillips.com/posts/2013/01/getting-gstreamer-to-work-on-a-raspberry-pi/ and installed gstreamer0.10-pulseaudio, this is output of gconftool-2 -a /system/gstreamer/0.10/default command:

 musicaudiosink_description = Default
 audiosrc = pulsesrc
 audiosrc_description = Default
 chataudiosink_description = Default
 musicaudiosink = pulsesink
 audiosink_description = Default
 visualization = goom
 videosrc = v4l2src
 audiosink = pulsesink
 chataudiosink = autoaudiosink
 videosink = autovideosink

Also this command plays file nicely on my ubuntu desktop and doesnt work on raspberry: gst-launch-0.10 filesrc location=test1.mp3 ! decodebin ! audioconvert ! alsasink on raspberry i'm getting: WARNING: erroneous pipeline: no element "alsasink".


I've installed sudo apt-get install gstreamer0.10-alsa. And now when i'm trying to do this command on raspberry i'm getting no errors and no sound just this:

pi@raspberrypi:~ $ gst-launch-0.10 filesrc location=test1.mp3 ! decodebin ! audioconvert ! alsasink
Setting pipeline to PAUSED ...

Edited2: lol, it works only if i start player twice, don't know why. When I'm starting player first time nothing happens but if i then start second player from other terminal then both players begin to play, wtf?

Edited3: I've tried to use gdb:

pi@raspberrypi:~ $ python basic_player.py 
player created
start play 

So it's hanging without errors(dunno why this time) and no sound, pid is 3709

Then: gdb python 3709

(gdb) info threads
  Id   Target Id         Frame 
  5    Thread 0x75ef6460 (LWP 3710) "python" 0x76df6c80 in poll ()
    at ../sysdeps/unix/syscall-template.S:81
  4    Thread 0x75200460 (LWP 3711) "mpegaudioparse0" syscall ()
    at ../ports/sysdeps/unix/sysv/linux/arm/syscall.S:37
  3    Thread 0x740dc460 (LWP 3712) "threaded-ml" 0x76df6c80 in poll ()
    at ../sysdeps/unix/syscall-template.S:81
  2    Thread 0x6f6fe460 (LWP 3713) "preroll_audio_s" 0x76f438c0 in __pthread_cond_wait
    (cond=0x747c6e20, mutex=0x747c6e00) at pthread_cond_wait.c:178
* 1    Thread 0x76fb1000 (LWP 3709) "python" 0x76f45a40 in do_futex_wait (
    isem=isem@entry=0x1aaed58) at ../nptl/sysdeps/unix/sysv/linux/sem_wait.c:48


(gdb) thread apply all py-list

Thread 5 (Thread 0x75ef6460 (LWP 3710)):
Cannot access memory at address 0x1
Cannot access memory at address 0x1
Unable to locate python frame

Thread 4 (Thread 0x75200460 (LWP 3711)):
Unable to locate python frame

Thread 3 (Thread 0x740dc460 (LWP 3712)):
Unable to locate python frame

Thread 2 (Thread 0x6f6fe460 (LWP 3713)):
Unable to locate python frame

Thread 1 (Thread 0x76fb1000 (LWP 3709)):
 335            waiter.acquire()
 336            self.__waiters.append(waiter)
 337            saved_state = self._release_save()
 338            try:    # restore state no matter what (e.g., KeyboardInterrupt)
 339                if timeout is None:
>340                    waiter.acquire()
 341                    if __debug__:
 342                        self._note("%s.wait(): got it", self)
 343                else:
 344                    # Balancing act:  We can't afford a pure busy loop, so we
 345                    # have to sleep; but if we sleep the whole timeout time,

So, my player is waiting for something for some reason? Maybe Any package is missing?

Edited4: On ubuntu desktop i have pulseaduio 4.0 but on raspbian is pulseaudio 5.0. Maybe I have to install pulseaudio 4.0?

1 Answer 1


All I need to do it do delete pulseaudio. Now gstreamer give all data directly to alsa as i understand and no problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.