dtls: remove reliance on a default GMainContext/Loop

By removing the indirection to the main loop completely when receiving
the peer certificate. For reference, the on-decoder-key signal does not
have a redirection.
This commit is contained in:
Matthew Waters 2018-01-16 20:53:15 +11:00
parent c365ab7e66
commit 94a7bf9ede

View file

@ -433,31 +433,10 @@ on_key_received (GstDtlsConnection * connection, gpointer key, guint cipher,
g_signal_emit (self, signals[SIGNAL_ON_KEY_RECEIVED], 0);
}
static gboolean
signal_peer_certificate_received (GWeakRef * ref)
{
GstDtlsDec *self;
self = g_weak_ref_get (ref);
g_weak_ref_clear (ref);
g_free (ref);
ref = NULL;
if (self) {
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PEER_PEM]);
g_object_unref (self);
self = NULL;
}
return FALSE;
}
static gboolean
on_peer_certificate_received (GstDtlsConnection * connection, gchar * pem,
GstDtlsDec * self)
{
GWeakRef *ref;
g_return_val_if_fail (GST_IS_DTLS_DEC (self), TRUE);
GST_DEBUG_OBJECT (self, "Received peer certificate PEM: \n%s", pem);
@ -468,10 +447,7 @@ on_peer_certificate_received (GstDtlsConnection * connection, gchar * pem,
}
self->peer_pem = g_strdup (pem);
ref = g_new (GWeakRef, 1);
g_weak_ref_init (ref, self);
g_idle_add ((GSourceFunc) signal_peer_certificate_received, ref);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PEER_PEM]);
return TRUE;
}