[gstreamer-bugs] [Bug 437652] New: Playbin Element Blocks GUI and MainLoop

GStreamer (bugzilla.gnome.org) bugzilla-daemon at bugzilla.gnome.org
Fri May 11 02:22:43 PDT 2007


If you have any questions why you received this email, please see the text at
the end of this email. Replies to this email are NOT read, please see the text
at the end of this email. You can add comments to this bug at:
  http://bugzilla.gnome.org/show_bug.cgi?id=437652

  GStreamer | gst-plugins | Ver: 0.10.12
           Summary: Playbin Element Blocks GUI and MainLoop
           Product: GStreamer
           Version: 0.10.12
          Platform: Other
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: critical
          Priority: Normal
         Component: gst-plugins
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: mystilleef at gmail.com
         QAContact: gstreamer-bugs at lists.sourceforge.net
     GNOME version: 2.17/2.18
   GNOME milestone: Unspecified


The Playbin element blocks the GUI and MainLoop when changing its state
to PAUSE or PLAY on some URIs. I attached a test code to reproduce the
problem.

The code has a good stream (self.__nice_stream) that works. And a bad 
stream (self.__bad_stream) that exposes the problem. You can change 
these streams in the self.__play_uri() method.

To run the code, type

python test.py

File test.py
========================================================================

class MyPlayBin(object):

        def __init__(self):
                self.__init_attributes()
                self.__arrange_widgets()
                self.__window.connect("delete-event", self.__delete_event_cb)
                self.__play_button.connect("clicked",
self.__clicked_play_button_cb)
                self.__stop_button.connect("clicked",
self.__clicked_stop_button_cb)
                self.__window.show_all()

        def __init_attributes(self):
                self.__bad_stream = "http://66.250.45.118:7204"
                self.__nice_stream =
"http://scfire-ntc0l-2.stream.aol.com:80/stream/1074"
                from gst import element_factory_make
                self.__element = element_factory_make("playbin",
"MainPipeline")
                self.__bus = self.__element.get_bus()
                self.__bus.add_signal_watch()
                self.__bus.connect("message::buffering", self.__buffering_cb)
                from gtk import Window, Label, Button
                from gtk import STOCK_MEDIA_PLAY, STOCK_MEDIA_PAUSE
                self.__label = Label("READY")
                self.__play_button = Button(stock=STOCK_MEDIA_PLAY)
                self.__stop_button = Button(stock=STOCK_MEDIA_PAUSE)
                self.__window = Window()
                return

        def __play_uri(self):
                self.__stop()
                self.__label.set_text("Preparing to play")
                from gst import STATE_PAUSED
                self.__element.set_property("uri", self.__bad_stream)
                self.__element.set_state(STATE_PAUSED)
                return False

        def __stop(self):
                from gst import STATE_NULL, STATE_READY
                self.__element.set_state(STATE_READY)
                self.__element.set_state(STATE_NULL)
                self.__label.set_text("Paused")
                return

        def __buffering_cb(self, bus, data):
                from gst import STATE_PAUSED, STATE_PLAYING
                percentage = data.structure["buffer-percent"]
                if percentage == 100:
                        self.__element.set_state(STATE_PLAYING)
                        self.__label.set_text("Playing")
                else:
                        self.__element.set_state(STATE_PAUSED)
                        message = "%s buffering..." % percentage
                        self.__label.set_text(message)
                return

        def __arrange_widgets(self):
                self.__window.set_title("MyPlayBin")
                self.__window.set_border_width(10)
                from gtk import VBox, HBox
                vbox = VBox(spacing=10)
                hbox = HBox(spacing=20)
                self.__window.add(vbox)
                vbox.pack_start(self.__label, True, True, 0)
                vbox.pack_start(hbox)
                hbox.pack_start(self.__play_button, True, True, 0)
                hbox.pack_start(self.__stop_button, True, True, 0)
                return

        def __clicked_play_button_cb(self, *args):
                self.__play_uri()
                return False

        def __clicked_stop_button_cb(self, *args):
                self.__stop()
                return False

        def __delete_event_cb(self, *args):
                raise SystemExit
                return True

if __name__ == "__main__":
        from gobject import threads_init, MainLoop
        threads_init()
        MyPlayBin()
        MainLoop().run()

========================================================================


-- 
See http://bugzilla.gnome.org/page.cgi?id=email.html for more info about why you received
this email, why you can't respond via email, how to stop receiving
emails (or reduce the number you receive), and how to contact someone
if you are having problems with the system.

You can add comments to this bug at http://bugzilla.gnome.org/show_bug.cgi?id=437652.




More information about the Gstreamer-bugs mailing list