mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
gst/rtpmanager/gstrtpbin.c: Fix cleanup crasher.
Original commit message from CVS: * gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_dispose), (gst_rtp_bin_finalize): Fix cleanup crasher. * gst/rtpmanager/rtpjitterbuffer.c: (rtp_jitter_buffer_init), (calculate_skew): * gst/rtpmanager/rtpjitterbuffer.h: Dynamically adjust the skew calculation window so that we calculate it over a period of around 2 seconds.
This commit is contained in:
parent
949f1685ce
commit
fa00695a39
3 changed files with 15 additions and 7 deletions
|
@ -1175,9 +1175,11 @@ gst_rtp_bin_dispose (GObject * object)
|
||||||
rtpbin = GST_RTP_BIN (object);
|
rtpbin = GST_RTP_BIN (object);
|
||||||
|
|
||||||
g_slist_foreach (rtpbin->sessions, (GFunc) free_session, NULL);
|
g_slist_foreach (rtpbin->sessions, (GFunc) free_session, NULL);
|
||||||
g_slist_foreach (rtpbin->clients, (GFunc) free_client, NULL);
|
|
||||||
g_slist_free (rtpbin->sessions);
|
g_slist_free (rtpbin->sessions);
|
||||||
rtpbin->sessions = NULL;
|
rtpbin->sessions = NULL;
|
||||||
|
g_slist_foreach (rtpbin->clients, (GFunc) free_client, NULL);
|
||||||
|
g_slist_free (rtpbin->clients);
|
||||||
|
rtpbin->clients = NULL;
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -1191,7 +1193,6 @@ gst_rtp_bin_finalize (GObject * object)
|
||||||
|
|
||||||
g_mutex_free (rtpbin->priv->bin_lock);
|
g_mutex_free (rtpbin->priv->bin_lock);
|
||||||
gst_object_unref (rtpbin->provided_clock);
|
gst_object_unref (rtpbin->provided_clock);
|
||||||
g_slist_free (rtpbin->sessions);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ rtp_jitter_buffer_init (RTPJitterBuffer * jbuf)
|
||||||
jbuf->window[i] = 0;
|
jbuf->window[i] = 0;
|
||||||
}
|
}
|
||||||
jbuf->window_pos = 0;
|
jbuf->window_pos = 0;
|
||||||
|
jbuf->window_size = 100;
|
||||||
jbuf->window_filling = TRUE;
|
jbuf->window_filling = TRUE;
|
||||||
jbuf->window_min = 0;
|
jbuf->window_min = 0;
|
||||||
jbuf->skew = 0;
|
jbuf->skew = 0;
|
||||||
|
@ -217,21 +218,26 @@ calculate_skew (RTPJitterBuffer * jbuf, guint32 rtptime, GstClockTime time)
|
||||||
|
|
||||||
if (jbuf->window_filling) {
|
if (jbuf->window_filling) {
|
||||||
/* we are filling the window */
|
/* we are filling the window */
|
||||||
GST_DEBUG ("filling %d %" G_GINT64_FORMAT, pos, delta);
|
GST_DEBUG ("filling %d %" G_GINT64_FORMAT ", diff %" G_GUINT64_FORMAT, pos,
|
||||||
|
delta, send_diff);
|
||||||
jbuf->window[pos++] = delta;
|
jbuf->window[pos++] = delta;
|
||||||
/* calc the min delta we observed */
|
/* calc the min delta we observed */
|
||||||
if (pos == 1 || delta < jbuf->window_min)
|
if (pos == 1 || delta < jbuf->window_min)
|
||||||
jbuf->window_min = delta;
|
jbuf->window_min = delta;
|
||||||
|
|
||||||
if (pos >= 100) {
|
if (send_diff >= 2 * GST_SECOND || pos >= 100) {
|
||||||
|
jbuf->window_size = pos;
|
||||||
|
|
||||||
/* window filled, fill window with min */
|
/* window filled, fill window with min */
|
||||||
GST_DEBUG ("min %" G_GINT64_FORMAT, jbuf->window_min);
|
GST_DEBUG ("min %" G_GINT64_FORMAT, jbuf->window_min);
|
||||||
for (i = 0; i < 100; i++)
|
for (i = 0; i < jbuf->window_size; i++)
|
||||||
jbuf->window[i] = jbuf->window_min;
|
jbuf->window[i] = jbuf->window_min;
|
||||||
|
|
||||||
/* the skew is initially the min */
|
/* the skew is initially the min */
|
||||||
jbuf->skew = jbuf->window_min;
|
jbuf->skew = jbuf->window_min;
|
||||||
jbuf->window_filling = FALSE;
|
jbuf->window_filling = FALSE;
|
||||||
|
} else {
|
||||||
|
jbuf->window_size = pos + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* pick old value and store new value. We keep the previous value in order
|
/* pick old value and store new value. We keep the previous value in order
|
||||||
|
@ -247,7 +253,7 @@ calculate_skew (RTPJitterBuffer * jbuf, guint32 rtptime, GstClockTime time)
|
||||||
gint64 min = G_MAXINT64;
|
gint64 min = G_MAXINT64;
|
||||||
|
|
||||||
/* if we removed the old min, we have to find a new min */
|
/* if we removed the old min, we have to find a new min */
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < jbuf->window_size; i++) {
|
||||||
/* we found another value equal to the old min, we can stop searching now */
|
/* we found another value equal to the old min, we can stop searching now */
|
||||||
if (jbuf->window[i] == old) {
|
if (jbuf->window[i] == old) {
|
||||||
min = old;
|
min = old;
|
||||||
|
@ -264,7 +270,7 @@ calculate_skew (RTPJitterBuffer * jbuf, guint32 rtptime, GstClockTime time)
|
||||||
jbuf->window_min, jbuf->skew);
|
jbuf->window_min, jbuf->skew);
|
||||||
}
|
}
|
||||||
/* wrap around in the window */
|
/* wrap around in the window */
|
||||||
if (pos >= 100)
|
if (pos >= jbuf->window_size)
|
||||||
pos = 0;
|
pos = 0;
|
||||||
jbuf->window_pos = pos;
|
jbuf->window_pos = pos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct _RTPJitterBuffer {
|
||||||
guint64 ext_rtptime;
|
guint64 ext_rtptime;
|
||||||
gint64 window[100];
|
gint64 window[100];
|
||||||
guint window_pos;
|
guint window_pos;
|
||||||
|
guint window_size;
|
||||||
gboolean window_filling;
|
gboolean window_filling;
|
||||||
gint64 window_min;
|
gint64 window_min;
|
||||||
gint64 skew;
|
gint64 skew;
|
||||||
|
|
Loading…
Reference in a new issue