One problem about one property of udpsink in Gstreamer.

Hi,everyone.
Recently,I encountered a problem about one property of udpsink in Gstreamer. This property is “sync”.
The description of this property writes: “Sync on the clock” in the official documents.But I cannot understand it very clearly.The default value of “sync” is true. And I also found that another property “async” also has the same default value.
I want to konw what’s the role does “sync” property takes and if I set this property a “false” value, what’s the effects will be coming.Can you help me solve this problem? Thank you so much!

Here’s a simple explanation of sync=false from Gstreamer-devel

Gstreamer sets a timestamp for when a frame should be played, if sync=true it will block the pipeline and only play the frame after that time. This is useful for playing from a video file, or other non-live source. If you play a video file with sync=false it would play back as fast as it can be read and processed. Note that for a live source this doesn’t matter, because you are only getting frames in at the capture rate of the camera anyway.

Use sync=true if:

  • There is a human watching the output, e.g. movie playback

Use sync=false if:

  • You are using a live source
  • The pipeline is being post-processed, e.g. neural net

As to your other question, async=false tells the pipeline not to wait for a state change before continuing. Seems mostly useful for debugging.

2 Likes

Thank you so much,Atrer!
Now I almost understand it under your patient help except one question:what’s the timestamp and what’s the function of this timestamp. I look up some information on the Internet and I haven’t understand it very much.
I would appreciate it very much if you can give me a detailed introduction about this.Than you all the same.

A timestamp is just a number that is used to represent a point in time. They are commonly used to keep track of durations.

Let’s say you want to play back a video at 30 FPS.

When you hit play gstreamer will read your system clock and save it as the initial timestamp. Lets call that value t0.

30 FPS is a period of about 33 milliseconds so gstreamer will set the play time of each frame to be 33 milliseconds later than the previous frame.

t0, t0+33ms, t0+66ms, etc.

Your sink then knows that it should hold on to the frame until the system clock shows a value greater than or equal to the play timestamp.

1 Like

Here’s an example of how that system is used outside of gstreamer:

In our example you hitting play would be the “epoch” with time counting up from there.

Oh,Atrer.I understand it now.Thank you very much and hope you have a good day!