From a0813c5bd2ee4c9a515866dcb872a117fc5f5d44 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 21 Apr 2021 16:17:23 -0400 Subject: [PATCH] webrtc lib: Make the icetransport struct private This will prevent any unsafe access. Part-of: --- ext/webrtc/nicetransport.h | 2 ++ gst-libs/gst/webrtc/icetransport.c | 2 ++ gst-libs/gst/webrtc/icetransport.h | 40 ------------------------------------- gst-libs/gst/webrtc/webrtc-priv.h | 41 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/ext/webrtc/nicetransport.h b/ext/webrtc/nicetransport.h index 4819649..d31e7b7 100644 --- a/ext/webrtc/nicetransport.h +++ b/ext/webrtc/nicetransport.h @@ -26,6 +26,8 @@ #include #include "gstwebrtcice.h" +#include "gst/webrtc/webrtc-priv.h" + G_BEGIN_DECLS GType gst_webrtc_nice_transport_get_type(void); diff --git a/gst-libs/gst/webrtc/icetransport.c b/gst-libs/gst/webrtc/icetransport.c index 21e2cbe..da5a643 100644 --- a/gst-libs/gst/webrtc/icetransport.c +++ b/gst-libs/gst/webrtc/icetransport.c @@ -33,6 +33,8 @@ #include "icetransport.h" #include "webrtc-enumtypes.h" +#include "webrtc-priv.h" + #define GST_CAT_DEFAULT gst_webrtc_ice_transport_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); diff --git a/gst-libs/gst/webrtc/icetransport.h b/gst-libs/gst/webrtc/icetransport.h index c1e56d4..09f44e5 100644 --- a/gst-libs/gst/webrtc/icetransport.h +++ b/gst-libs/gst/webrtc/icetransport.h @@ -34,46 +34,6 @@ GType gst_webrtc_ice_transport_get_type(void); #define GST_IS_WEBRTC_ICE_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_ICE_TRANSPORT)) #define GST_WEBRTC_ICE_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_ICE_TRANSPORT,GstWebRTCICETransportClass)) -/** - * GstWebRTCICETransport: - */ -struct _GstWebRTCICETransport -{ - GstObject parent; - - GstWebRTCICERole role; - GstWebRTCICEComponent component; - - GstWebRTCICEConnectionState state; - GstWebRTCICEGatheringState gathering_state; - - /* Filled by subclasses */ - GstElement *src; - GstElement *sink; - - gpointer _padding[GST_PADDING]; -}; - -struct _GstWebRTCICETransportClass -{ - GstObjectClass parent_class; - - gboolean (*gather_candidates) (GstWebRTCICETransport * transport); - - gpointer _padding[GST_PADDING]; -}; - -GST_WEBRTC_API -void gst_webrtc_ice_transport_connection_state_change (GstWebRTCICETransport * ice, - GstWebRTCICEConnectionState new_state); -GST_WEBRTC_API -void gst_webrtc_ice_transport_gathering_state_change (GstWebRTCICETransport * ice, - GstWebRTCICEGatheringState new_state); -GST_WEBRTC_API -void gst_webrtc_ice_transport_selected_pair_change (GstWebRTCICETransport * ice); -GST_WEBRTC_API -void gst_webrtc_ice_transport_new_candidate (GstWebRTCICETransport * ice, guint stream_id, GstWebRTCICEComponent component, gchar * attr); - G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCICETransport, gst_object_unref) G_END_DECLS diff --git a/gst-libs/gst/webrtc/webrtc-priv.h b/gst-libs/gst/webrtc/webrtc-priv.h index d1768c4..7a23827 100644 --- a/gst-libs/gst/webrtc/webrtc-priv.h +++ b/gst-libs/gst/webrtc/webrtc-priv.h @@ -159,6 +159,47 @@ GST_WEBRTC_API GstWebRTCRTPReceiver * gst_webrtc_rtp_receiver_new (void); +/** + * GstWebRTCICETransport: + */ +struct _GstWebRTCICETransport +{ + GstObject parent; + + GstWebRTCICERole role; + GstWebRTCICEComponent component; + + GstWebRTCICEConnectionState state; + GstWebRTCICEGatheringState gathering_state; + + /* Filled by subclasses */ + GstElement *src; + GstElement *sink; + + gpointer _padding[GST_PADDING]; +}; + +struct _GstWebRTCICETransportClass +{ + GstObjectClass parent_class; + + gboolean (*gather_candidates) (GstWebRTCICETransport * transport); + + gpointer _padding[GST_PADDING]; +}; + +GST_WEBRTC_API +void gst_webrtc_ice_transport_connection_state_change (GstWebRTCICETransport * ice, + GstWebRTCICEConnectionState new_state); +GST_WEBRTC_API +void gst_webrtc_ice_transport_gathering_state_change (GstWebRTCICETransport * ice, + GstWebRTCICEGatheringState new_state); +GST_WEBRTC_API +void gst_webrtc_ice_transport_selected_pair_change (GstWebRTCICETransport * ice); +GST_WEBRTC_API +void gst_webrtc_ice_transport_new_candidate (GstWebRTCICETransport * ice, guint stream_id, GstWebRTCICEComponent component, gchar * attr); + + G_END_DECLS #endif /* __GST_WEBRTC_PRIV_H__ */ -- 2.7.4