diff options
author | Tulio Beloqui <tulio@pexip.com> | 2021-08-06 17:25:02 +0300 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-08-16 12:51:05 +0300 |
commit | 9af6ce974a7f2dc0bee37fcd4763842669aee723 (patch) | |
tree | b13b29a708e72decc062f58a7070a56fbc553d0e /gst | |
parent | 620e9323c553e7800256a936bbefda3bacb14a23 (diff) |
rtpjitterbuffer: fixed stall on gap when using rtx
Co-authored-by: HÃ¥vard Graff <havard@pexip.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1055>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtpmanager/gstrtpjitterbuffer.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index 8f318dabb..db43cc8de 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -2498,7 +2498,8 @@ gst_rtp_jitter_buffer_handle_missing_packets (GstRtpJitterBuffer * jitterbuffer, guint lost_packets; GstClockTime lost_duration; GstClockTimeDiff gap_time; - guint saveable_packets = 0; + guint max_saveable_packets = 0; + GstClockTime max_saveable_duration; GstClockTime saveable_duration; /* gap time represents the total duration of all missing packets */ @@ -2507,17 +2508,20 @@ gst_rtp_jitter_buffer_handle_missing_packets (GstRtpJitterBuffer * jitterbuffer, /* based on the estimated packet duration, we can figure out how many packets we could possibly save */ if (est_pkt_duration) - saveable_packets = offset / est_pkt_duration; + max_saveable_packets = offset / est_pkt_duration; /* and say that the amount of lost packet is the sequence-number gap minus these saveable packets, but at least 1 */ - lost_packets = MAX (1, (gint) gap - (gint) saveable_packets); + lost_packets = MAX (1, (gint) gap - (gint) max_saveable_packets); - /* now we know how many packets we can actually save */ - saveable_packets = gap - lost_packets; + /* now we know how many packets we can possibly save */ + max_saveable_packets = gap - lost_packets; /* we convert that to time */ - saveable_duration = saveable_packets * est_pkt_duration; + max_saveable_duration = max_saveable_packets * est_pkt_duration; + + /* determine the actual amount of time we can save */ + saveable_duration = MIN (max_saveable_duration, gap_time); /* and we now have the duration we need to fill */ lost_duration = GST_CLOCK_DIFF (saveable_duration, gap_time); |