webrtc: Move dtlssrtpenc state management

Move the errant piece of dtlssrtpenc state change
management from dtlstransport in the Webrtc libs,
into the transportsendbin that does the rest of
the element management so it's all in one place.
This commit is contained in:
Jan Schmidt 2018-07-14 23:02:05 +10:00
parent 3a6777d599
commit cb750efd6c
2 changed files with 17 additions and 2 deletions

View file

@ -303,6 +303,17 @@ _on_dtls_enc_key_set (GstElement * element, TransportSendBin * send)
} }
} }
static void
_on_notify_dtls_client_status (GstElement * dtlssrtpenc,
GParamSpec * pspec, TransportSendBin * send)
{
GST_DEBUG_OBJECT (send,
"DTLS-SRTP encoder configured. Unlocking it and changing state %"
GST_PTR_FORMAT, dtlssrtpenc);
gst_element_set_locked_state (dtlssrtpenc, FALSE);
gst_element_sync_state_with_parent (dtlssrtpenc);
}
static void static void
_on_notify_ice_connection_state (GstWebRTCICETransport * transport, _on_notify_ice_connection_state (GstWebRTCICETransport * transport,
GParamSpec * pspec, TransportSendBin * send) GParamSpec * pspec, TransportSendBin * send)
@ -356,6 +367,9 @@ transport_send_bin_constructed (GObject * object)
/* unblock the encoder once the key is set */ /* unblock the encoder once the key is set */
g_signal_connect (transport->dtlssrtpenc, "on-key-set", g_signal_connect (transport->dtlssrtpenc, "on-key-set",
G_CALLBACK (_on_dtls_enc_key_set), send); G_CALLBACK (_on_dtls_enc_key_set), send);
/* Bring the encoder up to current state only once the is-client prop is set */
g_signal_connect (transport->dtlssrtpenc, "notify::is-client",
G_CALLBACK (_on_notify_dtls_client_status), send);
gst_bin_add (GST_BIN (send), GST_ELEMENT (transport->dtlssrtpenc)); gst_bin_add (GST_BIN (send), GST_ELEMENT (transport->dtlssrtpenc));
/* unblock ice sink once it signals a connection */ /* unblock ice sink once it signals a connection */
@ -386,6 +400,9 @@ transport_send_bin_constructed (GObject * object)
/* unblock the encoder once the key is set */ /* unblock the encoder once the key is set */
g_signal_connect (transport->dtlssrtpenc, "on-key-set", g_signal_connect (transport->dtlssrtpenc, "on-key-set",
G_CALLBACK (_on_dtls_enc_key_set), send); G_CALLBACK (_on_dtls_enc_key_set), send);
/* Bring the encoder up to current state only once the is-client prop is set */
g_signal_connect (transport->dtlssrtpenc, "notify::is-client",
G_CALLBACK (_on_notify_dtls_client_status), send);
gst_bin_add (GST_BIN (send), GST_ELEMENT (transport->dtlssrtpenc)); gst_bin_add (GST_BIN (send), GST_ELEMENT (transport->dtlssrtpenc));
/* unblock ice sink once it signals a connection */ /* unblock ice sink once it signals a connection */

View file

@ -84,8 +84,6 @@ gst_webrtc_dtls_transport_set_property (GObject * object, guint prop_id,
case PROP_CLIENT: case PROP_CLIENT:
g_object_set_property (G_OBJECT (webrtc->dtlssrtpenc), "is-client", g_object_set_property (G_OBJECT (webrtc->dtlssrtpenc), "is-client",
value); value);
gst_element_set_locked_state (webrtc->dtlssrtpenc, FALSE);
gst_element_sync_state_with_parent (webrtc->dtlssrtpenc);
break; break;
case PROP_CERTIFICATE: case PROP_CERTIFICATE:
g_object_set_property (G_OBJECT (webrtc->dtlssrtpdec), "pem", value); g_object_set_property (G_OBJECT (webrtc->dtlssrtpdec), "pem", value);