rtpjitterbuffer: Unlock output if the queue is full

This commit is contained in:
Olivier Crête 2019-06-06 16:05:31 -04:00 committed by Nicolas Dufresne
parent 080eba64de
commit 37d22186ff
3 changed files with 18 additions and 7 deletions

View file

@ -3155,10 +3155,11 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
* limit the queue size. But let's not limit it to a number that is
* too small to avoid emptying it needlessly if there is a spurious huge
* sequence number, let's allow at least 10k packets in any case. */
while (rtp_jitter_buffer_get_seqnum_diff (priv->jbuf) >= 32765 &&
rtp_jitter_buffer_num_packets (priv->jbuf) > 10000 &&
priv->srcresult == GST_FLOW_OK)
while (rtp_jitter_buffer_is_full (priv->jbuf) &&
priv->srcresult == GST_FLOW_OK) {
JBUF_SIGNAL_EVENT (priv);
JBUF_WAIT_QUEUE (priv);
}
if (priv->srcresult != GST_FLOW_OK)
goto out_flushing;
@ -3693,7 +3694,8 @@ handle_next_buffer (GstRtpJitterBuffer * jitterbuffer)
"Sequence number GAP detected: expected %d instead of %d (%d missing)",
next_seqnum, seqnum, gap);
/* if we have reached EOS, just keep processing */
if (priv->eos) {
/* Also do the same if we block input because the JB is full */
if (priv->eos || rtp_jitter_buffer_is_full (priv->jbuf)) {
result = pop_and_push_next (jitterbuffer, seqnum);
result = GST_FLOW_OK;
} else {

View file

@ -1259,7 +1259,7 @@ rtp_jitter_buffer_get_ts_diff (RTPJitterBuffer * jbuf)
}
/**
/*
* rtp_jitter_buffer_get_seqnum_diff:
* @jbuf: an #RTPJitterBuffer
*
@ -1268,7 +1268,7 @@ rtp_jitter_buffer_get_ts_diff (RTPJitterBuffer * jbuf)
*
* Returns: The difference expressed in seqnum.
*/
guint16
static guint16
rtp_jitter_buffer_get_seqnum_diff (RTPJitterBuffer * jbuf)
{
guint32 high_seqnum, low_seqnum;
@ -1369,3 +1369,10 @@ rtp_jitter_buffer_can_fast_start (RTPJitterBuffer * jbuf, gint num_packet)
return ret;
}
gboolean
rtp_jitter_buffer_is_full (RTPJitterBuffer * jbuf)
{
return rtp_jitter_buffer_get_seqnum_diff (jbuf) >= 32765 &&
rtp_jitter_buffer_num_packets (jbuf) > 10000;
}

View file

@ -184,7 +184,6 @@ gint rtp_jitter_buffer_get_percent (RTPJitterBuffer * jbuf
guint rtp_jitter_buffer_num_packets (RTPJitterBuffer *jbuf);
guint32 rtp_jitter_buffer_get_ts_diff (RTPJitterBuffer *jbuf);
guint16 rtp_jitter_buffer_get_seqnum_diff (RTPJitterBuffer * jbuf);
void rtp_jitter_buffer_get_sync (RTPJitterBuffer *jbuf, guint64 *rtptime,
guint64 *timestamp, guint32 *clock_rate,
@ -196,4 +195,7 @@ GstClockTime rtp_jitter_buffer_calculate_pts (RTPJitterBuffer * jbuf
gboolean rtp_jitter_buffer_can_fast_start (RTPJitterBuffer * jbuf, gint num_packet);
gboolean rtp_jitter_buffer_is_full (RTPJitterBuffer * jbuf);
#endif /* __RTP_JITTER_BUFFER_H__ */