rtpjitterbuffer: rtp_jitter_buffer_calculate_pts should not reset in all cases (especially on (old) rtx packets)
While debugging some issues I noticed some strange behavior that happened occasionally. After attaching with gdb and continuing executing after a few seconds, I noticed that sometimes playback would resume and then shortly after completely be out-of-sync (permanently). I traced the problem to old rtx packets being processed, which erroneously caused it to trigger a resync to this old rtx packet due to "backward timestamps at server, schedule resync".
I fixed the issue by:
- Add a new argument
gboolean is_rtx
tortp_jitter_buffer_calculate_pts
. - In
rtp_jitter_buffer_calculate_pts
, ifis_rtx
isTRUE
for the "rtp delta too big, reset skew" and "backward timestamps at server, schedule resync" cases, then returnGST_CLOCK_TIME_NONE
and do nothing. I believe the other resync cases need to be triggered regardless. - Add a check for
!GST_CLOCK_TIME_IS_VALID (pts)
to wherertp_jitter_buffer_calculate_pts
is called, and in those cases do agoto finished;
to drop the packet.
This change appears to consistently fix playback after briefly pausing the process with gdb.
Edited by Thomas Bluemel