mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
rtpsession: add locking for clear-pt-map
...or it will segfault from time to time...
This commit is contained in:
parent
08060dd97b
commit
f997859913
2 changed files with 46 additions and 0 deletions
|
@ -1314,7 +1314,9 @@ return_true (gpointer key, gpointer value, gpointer user_data)
|
||||||
static void
|
static void
|
||||||
gst_rtp_session_clear_pt_map (GstRtpSession * rtpsession)
|
gst_rtp_session_clear_pt_map (GstRtpSession * rtpsession)
|
||||||
{
|
{
|
||||||
|
GST_RTP_SESSION_LOCK (rtpsession);
|
||||||
g_hash_table_foreach_remove (rtpsession->priv->ptmap, return_true, NULL);
|
g_hash_table_foreach_remove (rtpsession->priv->ptmap, return_true, NULL);
|
||||||
|
GST_RTP_SESSION_UNLOCK (rtpsession);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called when the session manager has an RTP packet ready to be pushed */
|
/* called when the session manager has an RTP packet ready to be pushed */
|
||||||
|
|
|
@ -92,6 +92,8 @@ typedef struct
|
||||||
GObject *internal_session;
|
GObject *internal_session;
|
||||||
GstTestClock *testclock;
|
GstTestClock *testclock;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
|
gboolean running;
|
||||||
} SessionHarness;
|
} SessionHarness;
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
|
@ -2212,6 +2214,46 @@ GST_START_TEST (test_request_late_nack)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
static gpointer
|
||||||
|
_push_caps_events (gpointer user_data)
|
||||||
|
{
|
||||||
|
SessionHarness *h = user_data;
|
||||||
|
gint payload = 0;
|
||||||
|
while (h->running) {
|
||||||
|
|
||||||
|
GstCaps *caps = gst_caps_new_simple ("application/x-rtp",
|
||||||
|
"payload", G_TYPE_INT, payload,
|
||||||
|
NULL);
|
||||||
|
gst_harness_set_src_caps (h->recv_rtp_h, caps);
|
||||||
|
g_thread_yield ();
|
||||||
|
payload++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_START_TEST (test_clear_pt_map_stress)
|
||||||
|
{
|
||||||
|
SessionHarness *h = session_harness_new ();
|
||||||
|
GThread *thread;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
h->running = TRUE;
|
||||||
|
thread = g_thread_new (NULL, _push_caps_events, h);
|
||||||
|
|
||||||
|
for (i = 0; i < 1000; i++) {
|
||||||
|
g_signal_emit_by_name (h->session, "clear-pt-map");
|
||||||
|
g_thread_yield ();
|
||||||
|
}
|
||||||
|
|
||||||
|
h->running = FALSE;
|
||||||
|
g_thread_join (thread);
|
||||||
|
|
||||||
|
session_harness_free (h);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
rtpsession_suite (void)
|
rtpsession_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -2247,6 +2289,8 @@ rtpsession_suite (void)
|
||||||
tcase_add_test (tc_chain, test_on_sending_nacks);
|
tcase_add_test (tc_chain, test_on_sending_nacks);
|
||||||
tcase_add_test (tc_chain, test_disable_probation);
|
tcase_add_test (tc_chain, test_disable_probation);
|
||||||
tcase_add_test (tc_chain, test_request_late_nack);
|
tcase_add_test (tc_chain, test_request_late_nack);
|
||||||
|
tcase_add_test (tc_chain, test_clear_pt_map_stress);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue