proxysink/src timing/lag/stutter issue.

daniel at poradnik-webmastera.com daniel at poradnik-webmastera.com
Thu May 24 16:11:42 UTC 2018


W dniu 2018-05-24 16:56, Chris Duncan napisaƂ(a):
> I may be implementing proxysink/src incorrectly but i am having
> issues. It seems as though proxysrc is either queuing up buffers or
> there is a timestamping issue. Any help would be greatly appreciated.
> 
> #!/usr/bin/python3
> import gi
> gi.require_version('Gst', '1.0')
> gi.require_version('GstRtspServer', '1.0')
> from gi.repository import Gst, GstRtspServer, GObject
> 
> class RTSP_Factory(GstRtspServer.RTSPMediaFactory):
>     def __init__(self, pipeline, clock):
>         self.clock=clock
>         self.pipeline = pipeline
>         GstRtspServer.RTSPMediaFactory.__init__(self)
> 
>     def do_create_element(self, url):
>         self.pipeline.set_start_time(Gst.CLOCK_TIME_NONE)
>         return self.pipeline
> 
>     def do_configure(self, media):
>         media.set_shared(True)
> 
> Gst.init()
> GObject.threads_init()
> loop = GObject.MainLoop()
> Gst.debug_set_active(True)
> Gst.debug_set_default_threshold(4)
> 
> mainpipeline = Gst.parse_launch("nvcamerasrc "
>                                 "! video/x-raw(memory:NVMM),
> width=(int)2592, height=(int)1458, format=(string)I420,
> framerate=(fraction)30/1 "
>                                 "! omxh264enc bitrate=4000000
> profile=2 control-rate=2 insert-sps-pps=true insert-aud=true
> insert-vui=true iframeinterval=20 "
>                                 "! video/x-h264,
> stream-format=byte-stream, profile=(string)main "
>                                 "! tee ! proxysink name=psink")
> 
> rtsppipeline = Gst.parse_launch("proxysrc name=psrc is-live=true !
> queue name=rq max-size-buffers=3 ! h264parse ! rtph264pay name=pay0
> pt=96 config-interval=1")
> 
> sysclock = Gst.SystemClock.obtain()
> 
> psink = mainpipeline.get_by_name("psink")
> psrc = rtsppipeline.get_by_name("psrc")
> 
> psrc.set_property("proxysink", psink)
> 
> mainpipeline.use_clock(sysclock)
> rtsppipeline.use_clock(sysclock)
> mainpipeline.set_base_time(0)
> rtsppipeline.set_base_time(0)
> #mainpipeline.set_start_time(Gst.CLOCK_TIME_NONE)
> rtsppipeline.set_start_time(Gst.CLOCK_TIME_NONE)
> 
> server = GstRtspServer.RTSPServer()
> mounts = server.get_mount_points()
> factory = RTSP_Factory(rtsppipeline, sysclock)
> 
> mounts.add_factory("/test", factory)
> server.attach(None)
> 
> mainpipeline.set_state(Gst.State.PLAYING)
> loop.run()
> 
> Regards,
> Chris
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

I asked similar question yesterday. Fortunately today after doing some 
tests I have found why it does not work and how to fix it. When pipeline 
goes to PLAYING state, it updates its base time to current time. To fix 
this, you have to get base time from one pipeline and set it as base 
time for second one. I do this just after setting state of 2nd one to 
PLAYING.

You also should remove lines which change start time, this produces some 
strange results.

Regards,
Daniel


More information about the gstreamer-devel mailing list