[gst-devel] Jerky audio and video at reconnect to dvbbase bin

Dr. Peter G. Baum peter at dr-baum.net
Thu Apr 29 21:25:53 CEST 2010


Hi,

I want to play video and audio from dvbbasebin with the help of decodebin.
When I construct the pipeline for the first time it works perfectly, but 
when I disconnect decodebin from dvbbasebin and then reconnect, the 
audio is sometimes OK and sometimes jerky, the video is always jerky.

The details follow below.

Many thanks for the help,

Peter


My pipeline looks if I'm connected like this:
dvbbasebin0 (PLAYING):
-> program_16418
    queue7 (PLAYING):
    -> src
       tee4 (PLAYING):
       -> src0
          fakesink5 (PLAYING):
-> program_16407
    queue6 (PLAYING):
    -> src
       tee3 (PLAYING):
       -> src0
          fakesink4 (PLAYING):
-> program_16406
    queue5 (PLAYING):
    -> src
       tee2 (PLAYING):
       -> src0
          fakesink3 (PLAYING):
-> program_16405
    queue4 (PLAYING):
    -> src
       tee1 (PLAYING):
       -> src1
          decodebin0 (PLAYING):
          -> src1
             audioSink (PLAYING):
          -> src0
             videoSink (PLAYING):
       -> src0
          fakesink2 (PLAYING):
-> program_0
    queue3 (PLAYING):
    -> src
       tee0 (PLAYING):
       -> src0
          fakesink1 (PLAYING):


Video and audio sinks are bins:
       # make bin for audio sink
       self._audioSink = gst.Bin( "audioSink" )
       # not quite sure whether queue is necessary
       queue = gst.element_factory_make( "queue" )
       queue.set_property( "max-size-buffers", 0 )
       queue.set_property( "max-size-time", 0 )
       sink = gst.element_factory_make( "pulsesink" )
       self._audioSink.add( queue, sink )
       gst.element_link_many( queue, sink )
       ghostpad = gst.GhostPad( "sink", queue.get_pad( 'sink' ) )
       self._audioSink.add_pad( ghostpad )

       # make bin for video sink
       self._videoSink = gst.Bin( "videoSink" )
       # not quite sure whether queue is necessary
       queue = gst.element_factory_make( "queue" )
       queue.set_property( "max-size-buffers", 0 )
       queue.set_property( "max-size-time", 0 )
       color = gst.element_factory_make( "ffmpegcolorspace" )
       # this takes a lot of CPU, but improves quality tremendously
       deinterlace = gst.element_factory_make( "deinterlace" )
       sink = gst.element_factory_make( "xvimagesink" )
       self._videoSink.add( queue, color, deinterlace, sink )
       gst.element_link_many( queue, color, deinterlace, sink )
       ghostpad = gst.GhostPad( "sink", queue.get_pad( 'sink' ) )
       self._videoSink.add_pad( ghostpad )


To disconnect I do:
             teePad = chanInf.pad
             peer = teePad.get_peer()
             teePad.set_blocked( True )
             teePad.unlink( peer )
             teePad.set_blocked( False )
             tee = teePad.get_parent_element( )
             tee.release_request_pad( teePad )

	 self._decodebin.unlink( self._audioSink )
          self._decodebin.unlink( self._videoSink )
          self._decodebin.set_state( gst.STATE_READY )
          self._audioSink.set_state( gst.STATE_READY )
          self._videoSink.set_state( gst.STATE_READY )


To reconnect I do:
   def __onProgPadAdded( self, id, pad, new ):
       pad.link( self._decodebin.get_pad( 'sink' ) )
       self._decodebin.set_state( gst.STATE_PLAYING )

And:
    def __onMuxPadAdded( self, obj, pad ):
       if pad.can_link( self._audioSink.get_pad( 'sink' ) ):
          print "linking audio"
          pad.link( self._audioSink.get_pad( 'sink' ) )
          self._audioSink.set_state( gst.STATE_PLAYING )
       elif pad.can_link( self._videoSink.get_pad( 'sink' ) ):
          print "linking video"
          pad.link( self._videoSink.get_pad( 'sink' ) )
          self._videoSink.set_state( gst.STATE_PLAYING )





More information about the gstreamer-devel mailing list