[gst-devel] Jerky audio and video at reconnect to dvbbase bin
Dr. Peter G. Baum
peter at dr-baum.net
Tue May 11 21:44:50 CEST 2010
Hi Marco,
On 05/09/2010 10:06 AM, Marco Ballesio wrote:
> On Thu, Apr 29, 2010 at 10:25 PM, Dr. Peter G. Baum <peter at dr-baum.net
> <mailto:peter at dr-baum.net>> wrote:
> 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.
>
>
> sorry, it's not clear to me whether you're reusing the same pipeline or not.
Yes, I'm reusing the same pipeline.
> 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):
>
>
> looks like you have many sources connected to a tee, only one branch of
> the latter is connected to a sink which is a fakesink. Either you can
> simplify the pipeline or it's not completely reported here.
The goal is to implement something like a DVB-T server, i.e. many sinks
may connect to the same program or to different programs which are in
the same bouquet. For a first test, I connect one pgrogram to an
audioSink and videoSink and all others to fakesinks.
>
> 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 )
>
>
> What if you do not set the max-size properties?
Whether I set or do not set max-size properties does not change anything.
>
> 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 )
>
Peter
More information about the gstreamer-devel
mailing list