diff options
author | Jan Schmidt <jan@centricular.com> | 2018-07-14 23:02:05 +1000 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2018-07-14 23:18:50 +1000 |
commit | cb750efd6ce0f2c96b2edc3ae8b62deed77acfe3 (patch) | |
tree | 2e71ae4105e44e6de004a941599e73f2c34f882a | |
parent | 3a6777d59932c3ef1de0999c10e8d43ce1e9bce1 (diff) | |
download | gstreamer-plugins-bad-cb750efd6ce0f2c96b2edc3ae8b62deed77acfe3.tar.gz |
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.
-rw-r--r-- | ext/webrtc/transportsendbin.c | 17 | ||||
-rw-r--r-- | gst-libs/gst/webrtc/dtlstransport.c | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/ext/webrtc/transportsendbin.c b/ext/webrtc/transportsendbin.c index 3a9b5c631..021ede686 100644 --- a/ext/webrtc/transportsendbin.c +++ b/ext/webrtc/transportsendbin.c @@ -304,6 +304,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 _on_notify_ice_connection_state (GstWebRTCICETransport * transport, GParamSpec * pspec, TransportSendBin * send) { @@ -356,6 +367,9 @@ transport_send_bin_constructed (GObject * object) /* unblock the encoder once the key is set */ g_signal_connect (transport->dtlssrtpenc, "on-key-set", 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)); /* 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 */ g_signal_connect (transport->dtlssrtpenc, "on-key-set", 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)); /* unblock ice sink once it signals a connection */ diff --git a/gst-libs/gst/webrtc/dtlstransport.c b/gst-libs/gst/webrtc/dtlstransport.c index 9c06253e3..c3b2d519d 100644 --- a/gst-libs/gst/webrtc/dtlstransport.c +++ b/gst-libs/gst/webrtc/dtlstransport.c @@ -84,8 +84,6 @@ gst_webrtc_dtls_transport_set_property (GObject * object, guint prop_id, case PROP_CLIENT: g_object_set_property (G_OBJECT (webrtc->dtlssrtpenc), "is-client", value); - gst_element_set_locked_state (webrtc->dtlssrtpenc, FALSE); - gst_element_sync_state_with_parent (webrtc->dtlssrtpenc); break; case PROP_CERTIFICATE: g_object_set_property (G_OBJECT (webrtc->dtlssrtpdec), "pem", value); |