From 27b28f3aec4c6bd9869c505bca5df5e7007a20b7 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 1 Jul 2018 10:44:45 +1000 Subject: [PATCH] webrtc: Explicitly initialise mutex and condition Fixes random crashes when an allocated webrtcbin isn't given fresh 0-filled memory in its allocation. It works mostly because GMutex and GCond are automatically initialised in that case. --- ext/webrtc/gstwebrtcbin.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index 95e6c96..5d00dfd 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -4017,6 +4017,9 @@ gst_webrtc_bin_finalize (GObject * object) gst_structure_free (webrtc->priv->stats); webrtc->priv->stats = NULL; + g_mutex_clear (PC_GET_LOCK (webrtc)); + g_cond_clear (PC_GET_COND (webrtc)); + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -4334,6 +4337,8 @@ static void gst_webrtc_bin_init (GstWebRTCBin * webrtc) { webrtc->priv = gst_webrtc_bin_get_instance_private (webrtc); + g_mutex_init (PC_GET_LOCK (webrtc)); + g_cond_init (PC_GET_COND (webrtc)); _start_thread (webrtc); -- 2.7.4