Video sync via GstClock

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Mar 12 07:24:17 PDT 2013


On Tue, 2013-03-12 at 15:11 +0100, Andreas Rödig wrote:

Hi,

> yes i try this before. But it does not work.

What exactly/how does it not work?

> I use it at that way:
> 
> Server (If state changed to GST_STATE_PLAYING):
> netclock =  (GstClock *)gst_pipeline_get_clock((GstPipeline*)pipeline);
> gst_net_time_provider_new(netclock, NULL, 40000);
> 
> 
> 
> Client (If state changed to GST_STATE_PLAYING):
> 
> localClock =  (GstClock)gst_pipeline_get_clock((GstPipeline*)pipeline);
> netclock =  gst_net_client_clock_new("clientclock", "localhost", 40000, 
> gst_clock_get_time(localClock));
> gst_clock_set_master(localClock, netclock);

The usual usage pattern is to have a net time provider (usually based on
a system clock), and then do gst_pipeline_use_clock() with net client
clocks on all pipelines to be synchronised. You will also have to handle
distribution of the base time of the master by some external means.

You might find some useful code in https://github.com/thaytan/aurena

Cheers
 -Tim

> 
> Am 11.03.2013 23:54, schrieb Tim-Philipp Müller:
> > On Mon, 2013-03-11 at 17:03 +0100, Andreas Rödig wrote:
> >
> > Hi,
> >
> >> i want to synchronize to videos.
> >>
> >> I found that i can use GstClock (gst_clock_set_calibration) to jump
> >> forward. So i transport the position from the master to every client
> >> over network.
> >>
> >> Then i set the client with gst_clock_set_calibration to the master
> >> position. That works if master time bigger than client time.
> >> But i can not jump backwards with this function. And sometimes (at far
> >> jumps) my audio plugin crashed.
> >>
> >> Are there something i forgot? Is this the right function to change the
> >> pipeline clock?
> >>
> >> Here are my steps:
> >> - start pipeline (playbin2)
> >> - get clock (gst_pipeline_get_clock)
> >> - get basetime (gst_clock_get_time)
> >> .
> >> .
> >> running
> >> .
> >> .
> >> - incomming master position (0 - n milliseconds)
> >> - set clock (basetime + master position)
> >
> > Have you seen GstNetTimeProvider and GstNetClientClock ?
> >
> > Cheers
> >   -Tim
> >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list