Video_sink sync issue

Hey, guys, i use gstreamer play rtsp video, here is my pipeline:

when i set sync=true, The following warning will be issued in a few minutes (The video is stuck at this point):

when i set sync=false, Every few seconds, the video is fast-forwarded a few seconds.here is log:

It look like a timestamp problem, How should I solve this problem?

Same issue here.
Only with RTSP.

It looks like it gets an audio pkt that has a timestamp that is about 2 minutes old.
Instead of discarding it, it hangs during sync.

But I have the problem that it only happens occasionally.
It probably also depends on the RTSP stream.
I then also often see ‘correct clock skew’

Where does your ‘Video stuck has happend’ output come from?

maby print from system decoder

My pipeline looks a little different

I also run it on iOS and macOS.
Tried with different versions.
e.g. 1.24.12 or head.

urisourcebin (or rtspsrc) → decodebin3 → glimagesink/osxaudiosink

Since we are using different device decoders, we can probably rule out the decoder. The AudioSink is also different and therefore we assume that there is no problem there either. Although setting the async parameters has a positive effect, the problem is further up the pipeline.

It is interesting that I have not yet been able to reproduce the problem with gst-launch on my macOS. Although it should actually be the same pipeline.

I tried to fix it with “ntp-sync” on rtspsrc but that doesn’t seem to have any effect.

Since I suspect that it is a PTS problem with the audio/video RTP streams, maybe the do-timestamp = true could have an influence.
You have applied this to the sink and not the src in your code.
//EDIT object class ‘GstRTSPSrc’ has no property named ‘do-timestamp’

But I am also poking around in the dark.

I think that the problem is that the PTS starts at 0 and after (in this example) 0:00:03.271016347 it will restart at 0.
So a resync is needed. In my case, this leads sometimes to problems.

[VIDEO] PTS: 0:00:03.239016347
[AUDIO] PTS: 0:00:03.271016347
0:00:09.039026959 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3831:gst_base_sink_chain_unlocked:<osxaudiosink0> got times start: 0:00:03.271016347, end: 0:00:03.292349680
0:00:09.039031959 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:2167:gst_base_sink_get_sync_times:<osxaudiosink0> got times start: 0:00:03.271016347, stop: 0:00:03.292349680, do_sync 0
0:00:09.039034792 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3948:gst_base_sink_chain_unlocked:<osxaudiosink0> rendering object 0x11a529290
0:00:09.056078625 14393    0x10f728930 DEBUG               basesink gstbasesink.c:2795:gst_base_sink_do_sync:<sink> clock returned 0, jitter -0:00:00.014225764
0:00:09.056090667 14393    0x10f728930 DEBUG               basesink gstbasesink.c:3167:gst_base_sink_is_too_late:<sink> object was scheduled in time
0:00:09.056093459 14393    0x10f728930 DEBUG               basesink gstbasesink.c:3948:gst_base_sink_chain_unlocked:<sink> rendering object 0x12a632b10
0:00:09.056095875 14393    0x10f728930 DEBUG               basesink gstbasesink.c:1051:gst_base_sink_set_last_buffer_unlocked:<sink> setting last buffer to 0x12a632b10
0:00:09.056304959 14393    0x10f728930 DEBUG              videosink gstvideosink.c:163:gst_video_center_rect: source is 2460x1384 dest is 2560x1384, result is 2460x1384 with x,y 50x0
0:00:09.057119625 14393    0x10f728930 DEBUG               basesink gstbasesink.c:3995:gst_base_sink_chain_unlocked:<sink> object unref after render 0x12a632b10
0:00:09.057856042 14393    0x15b1ceff0 DEBUG                  vtdec vtdec.c:1254:gst_vtdec_session_output_callback:<vtdechw0> BadDataErr when decoding frame 130, errors 1
0:00:09.057864042 14393    0x15b1ceff0 DEBUG                  vtdec vtdec.c:1291:gst_vtdec_session_output_callback:<vtdechw0> Decoded frame is NULL
0:00:09.057889625 14393    0x15b284ab0 WARN            videodecoder gstvideodecoder.c:3144:gst_video_decoder_prepare_finish_frame:<vtdechw0> decreasing timestamp (0:00:00.708913977 < 0:00:03.239016347)
[VIDEO] PTS: 0:00:03.239016347
0:00:09.058847250 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3995:gst_base_sink_chain_unlocked:<osxaudiosink0> object unref after render 0x11a529290
[AUDIO] PTS: 0:00:00.492913977
0:00:09.059018417 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3831:gst_base_sink_chain_unlocked:<osxaudiosink0> got times start: 0:00:00.492913977, end: 0:00:00.514247310
0:00:09.059032334 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:2167:gst_base_sink_get_sync_times:<osxaudiosink0> got times start: 0:00:00.492913977, stop: 0:00:00.514247310, do_sync 0
0:00:09.059041459 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3948:gst_base_sink_chain_unlocked:<osxaudiosink0> rendering object 0x15b00e910
0:00:09.059063792 14393    0x15b22d130 WARN           audiobasesink gstaudiobasesink.c:1797:gst_audio_base_sink_get_alignment:<osxaudiosink0> Unexpected discontinuity in audio timestamps of -0:00:02.799437500, resyncing
0:00:09.059066292 14393    0x10f728930 DEBUG               basesink gstbasesink.c:3831:gst_base_sink_chain_unlocked:<sink> got times start: 0:00:03.099016347, end: 0:00:03.119016347
0:00:09.059096084 14393    0x10f728930 DEBUG               basesink gstbasesink.c:2167:gst_base_sink_get_sync_times:<sink> got times start: 0:00:03.099016347, stop: 0:00:03.119016347, do_sync 1
0:00:09.059081875 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3995:gst_base_sink_chain_unlocked:<osxaudiosink0> object unref after render 0x15b00e910
[AUDIO] PTS: 0:00:00.514247310
0:00:09.059158875 14393    0x10f728930 DEBUG               basesink gstbasesink.c:2167:gst_base_sink_get_sync_times:<sink> got times start: 0:00:03.099016347, stop: 0:00:03.119016347, do_sync 1
0:00:09.059169125 14393    0x10f728930 DEBUG               basesink gstbasesink.c:2776:gst_base_sink_do_sync:<sink> reset rc_time to time 0:00:06.019016347
0:00:09.059188334 14393    0x10f728930 DEBUG               basesink gstbasesink.c:2788:gst_base_sink_do_sync:<sink> possibly waiting for clock to reach 0:00:03.099016347, adjusted 0:00:06.019016347
0:00:09.059173292 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3831:gst_base_sink_chain_unlocked:<osxaudiosink0> got times start: 0:00:00.514247310, end: 0:00:00.535580643
0:00:09.059222209 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:2167:gst_base_sink_get_sync_times:<osxaudiosink0> got times start: 0:00:00.514247310, stop: 0:00:00.535580643, do_sync 0
0:00:09.059224959 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3948:gst_base_sink_chain_unlocked:<osxaudiosink0> rendering object 0x12a60e7b0
0:00:09.059234542 14393    0x15b22d130 DEBUG               basesink gstbasesink.c:3995:gst_base_sink_chain_unlocked:<osxaudiosink0> object unref after render 0x12a60e7b0
[AUDIO] PTS: 0:00:00.535580644

I’m worried about these two items
Unexpected discontinuity in audio timestamps of -0:00:02.799437500, resyncing
reset rc_time to time