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.
This commit is contained in:
Jan Schmidt 2018-07-01 10:44:45 +10:00
parent 0fca02bb5e
commit 27b28f3aec

View file

@ -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);