mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 21:51:09 +00:00
gst/rtpmanager/gstrtpjitterbuffer.c: When synchronizing buffers, take peer latency into account.
Original commit message from CVS: * gst/rtpmanager/gstrtpjitterbuffer.c: (gst_rtp_jitter_buffer_change_state), (gst_rtp_jitter_buffer_loop), (gst_rtp_jitter_buffer_query): When synchronizing buffers, take peer latency into account. Don't try to add our latency to invalid peer max latency values.
This commit is contained in:
parent
10d6ba4d61
commit
6835b966ec
1 changed files with 14 additions and 1 deletions
|
@ -158,6 +158,9 @@ struct _GstRtpJitterBufferPrivate
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
GstClockID clock_id;
|
GstClockID clock_id;
|
||||||
guint32 waiting_seqnum;
|
guint32 waiting_seqnum;
|
||||||
|
/* the latency of the upstream peer, we have to take this into account when
|
||||||
|
* synchronizing the buffers. */
|
||||||
|
GstClockTime peer_latency;
|
||||||
|
|
||||||
/* some accounting */
|
/* some accounting */
|
||||||
guint64 num_late;
|
guint64 num_late;
|
||||||
|
@ -581,6 +584,7 @@ gst_rtp_jitter_buffer_change_state (GstElement * element,
|
||||||
/* reset negotiated values */
|
/* reset negotiated values */
|
||||||
priv->clock_rate = -1;
|
priv->clock_rate = -1;
|
||||||
priv->clock_base = -1;
|
priv->clock_base = -1;
|
||||||
|
priv->peer_latency = 0;
|
||||||
/* block until we go to PLAYING */
|
/* block until we go to PLAYING */
|
||||||
priv->blocked = TRUE;
|
priv->blocked = TRUE;
|
||||||
JBUF_UNLOCK (priv);
|
JBUF_UNLOCK (priv);
|
||||||
|
@ -1011,6 +1015,7 @@ again:
|
||||||
|
|
||||||
/* add latency */
|
/* add latency */
|
||||||
running_time += (priv->latency_ms * GST_MSECOND);
|
running_time += (priv->latency_ms * GST_MSECOND);
|
||||||
|
running_time += priv->peer_latency;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "sync to running_time %" GST_TIME_FORMAT,
|
GST_DEBUG_OBJECT (jitterbuffer, "sync to running_time %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (running_time));
|
GST_TIME_ARGS (running_time));
|
||||||
|
@ -1152,7 +1157,15 @@ gst_rtp_jitter_buffer_query (GstPad * pad, GstQuery * query)
|
||||||
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
|
GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
|
||||||
|
|
||||||
|
/* store this so that we can safely sync on the peer buffers. */
|
||||||
|
JBUF_LOCK (priv);
|
||||||
|
priv->peer_latency = min_latency;
|
||||||
|
JBUF_UNLOCK (priv);
|
||||||
|
|
||||||
min_latency += priv->latency_ms * GST_MSECOND;
|
min_latency += priv->latency_ms * GST_MSECOND;
|
||||||
|
/* max_latency can be -1, meaning there is no upper limit for the
|
||||||
|
* latency. */
|
||||||
|
if (max_latency != -1)
|
||||||
max_latency += priv->latency_ms * GST_MSECOND;
|
max_latency += priv->latency_ms * GST_MSECOND;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "Calculated total latency : min %"
|
GST_DEBUG_OBJECT (jitterbuffer, "Calculated total latency : min %"
|
||||||
|
|
Loading…
Reference in a new issue