Network Clocks synchronize very slowly after long delay

Kevin Boos kevinaboos at gmail.com
Tue Sep 2 16:48:19 PDT 2014


Hello all,

I’m using network clocks to synchronize video playback across one server and many clients. The synchronization itself works well, but it takes a very long time before things actually sync up. 

For example, I’ll start the server video, and then connect each client one-by-one. If I connect a client when the server video is towards the beginning (i.e., after only a few seconds), the client video will almost instantly snap to the correct point in its local video playback and then continue to play in a properly synchronized fashion with the server. BUT, if I wait for a bit, maybe 10-60 seconds, and then try to connect a client, that client will take quite a long time before it snaps to the correct point in the video and plays in sync. 

So, the further along the server video is, the longer it takes the client video to catch up. This is such a strange phenomenon, and it negatively affects the viewing experience quite a bit. For example, if the server video is at the 1:30 mark when I connect a client, that client takes around 25 full seconds before it becomes in-sync. I can see in the GStreamer logs that, during this 25-second waiting period, frames are being dropped because “there may be a timestamping problem” or “this computer is too slow.” Again, this problem does not happen if I connect a client at the very beginning of the server video’s playback (or I guess it happens so quickly that it’s unobservable). 

Here’s how I create the network clock in the server:
--------------------
GstClock *local_clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
gst_pipeline_use_clock(GST_PIPELINE(pipeline), local_clock); /
GstNetTimeProvider *local_net_clock = gst_net_time_provider_new(local_clock, getLocalIP(NULL), port); 
basetime = gst_clock_get_time(local_clock); 
--------------------

And then here is the client code: 
--------------------
gst_element_set_start_time(data->pipeline, GST_CLOCK_TIME_NONE);
GstClock *net_clock_in = gst_net_client_clock_new("net_clock_in”, SERVER_IP_ADDR, port, basetime);
gst_pipeline_use_clock( GST_PIPELINE(data->pipeline), net_clock_in);
--------------------

“basetime” is sent from the server to each client when the client is connected. 

Thanks in advance, I really need some assistance in determining why it takes so long for synchronization to occur in the client. 
--
Kevin Boos
Rice University


More information about the gstreamer-devel mailing list