From 3de2c28fc12cade9ac4659f361c3ac894fb33756 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 22 Nov 2018 10:41:29 -0500 Subject: [PATCH] rtpjitterbuffer: Stop waiting after EOS After EOS is received, it is pointless to wait for further events, specially waiting on timers. This patches fixes two cases where we could wait instead of returning GST_FLOW_EOS and trigger a spin of the loop function when EOS is queued, regardless if this EOS is the queue head or not. --- gst/rtpmanager/gstrtpjitterbuffer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c index b1199c58ac..f1d580cf5e 100644 --- a/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/gst/rtpmanager/gstrtpjitterbuffer.c @@ -1825,7 +1825,7 @@ queue_event (GstRtpJitterBuffer * jitterbuffer, GstEvent * event) GST_DEBUG_OBJECT (jitterbuffer, "adding event"); item = alloc_item (event, ITEM_TYPE_EVENT, -1, -1, -1, 0, -1); rtp_jitter_buffer_insert (priv->jbuf, item, &head, NULL); - if (head) + if (head || priv->eos) JBUF_SIGNAL_EVENT (priv); return TRUE; @@ -3625,7 +3625,13 @@ handle_next_buffer (GstRtpJitterBuffer * jitterbuffer) GST_DEBUG_OBJECT (jitterbuffer, "Sequence number GAP detected: expected %d instead of %d (%d missing)", next_seqnum, seqnum, gap); - result = GST_FLOW_WAIT; + /* if we have reached EOS, just keep processing */ + if (priv->eos) { + result = pop_and_push_next (jitterbuffer, seqnum); + result = GST_FLOW_OK; + } else { + result = GST_FLOW_WAIT; + } } }