dtlstransport: Notify ICE transport property changes

The application might track the underlying ICE transport, so not notifying
changes might lead to use-after-free issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1688>
This commit is contained in:
Philippe Normand 2022-02-12 10:05:11 +00:00 committed by GStreamer Marge Bot
parent c9e108378a
commit 5a2e1ecb4d

View file

@ -64,12 +64,19 @@ void
gst_webrtc_dtls_transport_set_transport (GstWebRTCDTLSTransport * transport, gst_webrtc_dtls_transport_set_transport (GstWebRTCDTLSTransport * transport,
GstWebRTCICETransport * ice) GstWebRTCICETransport * ice)
{ {
gboolean notify = FALSE;
g_return_if_fail (GST_IS_WEBRTC_DTLS_TRANSPORT (transport)); g_return_if_fail (GST_IS_WEBRTC_DTLS_TRANSPORT (transport));
g_return_if_fail (GST_IS_WEBRTC_ICE_TRANSPORT (ice)); g_return_if_fail (GST_IS_WEBRTC_ICE_TRANSPORT (ice));
GST_OBJECT_LOCK (transport); GST_OBJECT_LOCK (transport);
gst_object_replace ((GstObject **) & transport->transport, GST_OBJECT (ice)); notify =
gst_object_replace ((GstObject **) & transport->transport,
GST_OBJECT (ice));
GST_OBJECT_UNLOCK (transport); GST_OBJECT_UNLOCK (transport);
if (notify)
g_object_notify (G_OBJECT (transport), "transport");
} }
static void static void