Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorTulio Beloqui <tulio@pexip.com>2021-08-06 17:25:02 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-08-16 12:51:05 +0300
commit9af6ce974a7f2dc0bee37fcd4763842669aee723 (patch)
treeb13b29a708e72decc062f58a7070a56fbc553d0e /gst
parent620e9323c553e7800256a936bbefda3bacb14a23 (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.c16
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);