Buffer PTS issues with RTSP server

Hi all,

I have a pipeline which is in charge of capturing images from a camera. Those images are sent to an appsink.
In addition, I am running an RTSP server which takes its images from an appsrc.

The appsink of the pipeline is feeding the appsrc of the RTSP pipeline.
The issue is this… It appesrs that because the buffers already have a PTS with the clock of the original pipeline, when a client connect to the RTSP server, it receives images with latency.
How much latency? Well if the pipeline was running for 5 seconds, and then the client connects, he will only start receiving frames after 5 seconds (and those frames will have a delay of 5 seconds from the pipeline).

One way to “solve” this is to remove the PTS of the buffers when feeding the appsrc. But then I am losing important data.
So what’s the right way to solve this?

I tried to use the gst_clock_set_master function to sync the two clocks together but I’m keep getting gst_clock_set_master: assertion 'master != clock' failed. After a few testings I understood that the clocks are actually the same.
So now I need to figure out a way to sync their running_time property…