mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
rtpjitterbuffer: Actually calculate the packet rate for max-dropout and max-misorder calculations.
https://bugzilla.gnome.org/show_bug.cgi?id=751311
This commit is contained in:
parent
e7d4ad7ac7
commit
4dff74358e
2 changed files with 10 additions and 3 deletions
|
@ -1299,6 +1299,8 @@ gst_jitter_buffer_sink_parse_caps (GstRtpJitterBuffer * jitterbuffer,
|
||||||
|
|
||||||
rtp_jitter_buffer_set_clock_rate (priv->jbuf, priv->clock_rate);
|
rtp_jitter_buffer_set_clock_rate (priv->jbuf, priv->clock_rate);
|
||||||
|
|
||||||
|
gst_rtp_packet_rate_ctx_reset (&priv->packet_rate_ctx, priv->clock_rate);
|
||||||
|
|
||||||
/* The clock base is the RTP timestamp corrsponding to the npt-start value. We
|
/* The clock base is the RTP timestamp corrsponding to the npt-start value. We
|
||||||
* can use this to track the amount of time elapsed on the sender. */
|
* can use this to track the amount of time elapsed on the sender. */
|
||||||
if (gst_structure_get_uint (caps_struct, "clock-base", &val))
|
if (gst_structure_get_uint (caps_struct, "clock-base", &val))
|
||||||
|
@ -2632,6 +2634,8 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
|
||||||
|
|
||||||
if (G_UNLIKELY (priv->clock_rate == -1))
|
if (G_UNLIKELY (priv->clock_rate == -1))
|
||||||
goto no_clock_rate;
|
goto no_clock_rate;
|
||||||
|
|
||||||
|
gst_rtp_packet_rate_ctx_reset (&priv->packet_rate_ctx, priv->clock_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't accept more data on EOS */
|
/* don't accept more data on EOS */
|
||||||
|
|
|
@ -27,6 +27,7 @@ gst_rtp_packet_rate_ctx_reset (RTPPacketRateCtx * ctx, guint32 clock_rate)
|
||||||
ctx->clock_rate = clock_rate;
|
ctx->clock_rate = clock_rate;
|
||||||
ctx->probed = FALSE;
|
ctx->probed = FALSE;
|
||||||
ctx->avg_packet_rate = -1;
|
ctx->avg_packet_rate = -1;
|
||||||
|
ctx->last_ts = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint32
|
guint32
|
||||||
|
@ -41,15 +42,16 @@ gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx * ctx, guint16 seqnum,
|
||||||
return ctx->avg_packet_rate;
|
return ctx->avg_packet_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_ts = ctx->last_ts;
|
||||||
|
gst_rtp_buffer_ext_timestamp (&new_ts, ts);
|
||||||
|
|
||||||
if (!ctx->probed) {
|
if (!ctx->probed) {
|
||||||
ctx->last_seqnum = seqnum;
|
ctx->last_seqnum = seqnum;
|
||||||
ctx->last_ts = ts;
|
ctx->last_ts = new_ts;
|
||||||
ctx->probed = TRUE;
|
ctx->probed = TRUE;
|
||||||
return ctx->avg_packet_rate;
|
return ctx->avg_packet_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_ts = ctx->last_ts;
|
|
||||||
gst_rtp_buffer_ext_timestamp (&new_ts, ts);
|
|
||||||
diff_seqnum = gst_rtp_buffer_compare_seqnum (ctx->last_seqnum, seqnum);
|
diff_seqnum = gst_rtp_buffer_compare_seqnum (ctx->last_seqnum, seqnum);
|
||||||
if (diff_seqnum <= 0 || new_ts <= ctx->last_ts) {
|
if (diff_seqnum <= 0 || new_ts <= ctx->last_ts) {
|
||||||
return ctx->avg_packet_rate;
|
return ctx->avg_packet_rate;
|
||||||
|
@ -64,6 +66,7 @@ gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx * ctx, guint16 seqnum,
|
||||||
* but it will go down again slowly.
|
* but it will go down again slowly.
|
||||||
* This is useful for bursty cases, where a lot of packets are close
|
* This is useful for bursty cases, where a lot of packets are close
|
||||||
* to each other and should allow a higher reorder/dropout there.
|
* to each other and should allow a higher reorder/dropout there.
|
||||||
|
* Round up the new average.
|
||||||
*/
|
*/
|
||||||
if (ctx->avg_packet_rate > new_packet_rate) {
|
if (ctx->avg_packet_rate > new_packet_rate) {
|
||||||
ctx->avg_packet_rate = (7 * ctx->avg_packet_rate + new_packet_rate + 7) / 8;
|
ctx->avg_packet_rate = (7 * ctx->avg_packet_rate + new_packet_rate + 7) / 8;
|
||||||
|
|
Loading…
Reference in a new issue