diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2021-04-21 16:24:00 -0400 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-06-21 20:53:09 +0000 |
commit | a931e31141df9b7b3acac6fb0e0c2c1f3698a0bf (patch) | |
tree | c90e82795dfb834b2432ffecd7584e74b81eb18f /gst-libs/gst | |
parent | dd2da6f2b4f8d8f5d74b6ed5eafb3961e87451e7 (diff) | |
download | gstreamer-plugins-bad-a931e31141df9b7b3acac6fb0e0c2c1f3698a0bf.tar.gz |
webrtc lib: Make the datachannel struct private
This will prevent any unsafe access.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2241>
Diffstat (limited to 'gst-libs/gst')
-rw-r--r-- | gst-libs/gst/webrtc/datachannel.c | 1 | ||||
-rw-r--r-- | gst-libs/gst/webrtc/datachannel.h | 63 | ||||
-rw-r--r-- | gst-libs/gst/webrtc/webrtc-priv.h | 63 |
3 files changed, 64 insertions, 63 deletions
diff --git a/gst-libs/gst/webrtc/datachannel.c b/gst-libs/gst/webrtc/datachannel.c index ee0be6030..4c0d2f286 100644 --- a/gst-libs/gst/webrtc/datachannel.c +++ b/gst-libs/gst/webrtc/datachannel.c @@ -33,6 +33,7 @@ #endif #include "datachannel.h" +#include "webrtc-priv.h" #define GST_CAT_DEFAULT gst_webrtc_data_channel_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); diff --git a/gst-libs/gst/webrtc/datachannel.h b/gst-libs/gst/webrtc/datachannel.h index 79b536f5b..8146c6598 100644 --- a/gst-libs/gst/webrtc/datachannel.h +++ b/gst-libs/gst/webrtc/datachannel.h @@ -36,69 +36,6 @@ GType gst_webrtc_data_channel_get_type(void); #define GST_IS_WEBRTC_DATA_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_DATA_CHANNEL)) #define GST_WEBRTC_DATA_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_DATA_CHANNEL,GstWebRTCDataChannelClass)) -#define GST_WEBRTC_DATA_CHANNEL_LOCK(channel) g_mutex_lock(&((GstWebRTCDataChannel *)(channel))->lock) -#define GST_WEBRTC_DATA_CHANNEL_UNLOCK(channel) g_mutex_unlock(&((GstWebRTCDataChannel *)(channel))->lock) - -/** - * GstWebRTCDataChannel: - * - * Since: 1.18 - */ -struct _GstWebRTCDataChannel -{ - GObject parent; - - GMutex lock; - - gchar *label; - gboolean ordered; - guint max_packet_lifetime; - guint max_retransmits; - gchar *protocol; - gboolean negotiated; - gint id; - GstWebRTCPriorityType priority; - GstWebRTCDataChannelState ready_state; - guint64 buffered_amount; - guint64 buffered_amount_low_threshold; - - gpointer _padding[GST_PADDING]; -}; - -/** - * GstWebRTCDataChannelClass: - * - * Since: 1.18 - */ -struct _GstWebRTCDataChannelClass -{ - GObjectClass parent_class; - - void (*send_data) (GstWebRTCDataChannel * channel, GBytes *data); - void (*send_string) (GstWebRTCDataChannel * channel, const gchar *str); - void (*close) (GstWebRTCDataChannel * channel); - - gpointer _padding[GST_PADDING]; -}; - -GST_WEBRTC_API -void gst_webrtc_data_channel_on_open (GstWebRTCDataChannel * channel); - -GST_WEBRTC_API -void gst_webrtc_data_channel_on_close (GstWebRTCDataChannel * channel); - -GST_WEBRTC_API -void gst_webrtc_data_channel_on_error (GstWebRTCDataChannel * channel, GError * error); - -GST_WEBRTC_API -void gst_webrtc_data_channel_on_message_data (GstWebRTCDataChannel * channel, GBytes * data); - -GST_WEBRTC_API -void gst_webrtc_data_channel_on_message_string (GstWebRTCDataChannel * channel, const gchar * str); - -GST_WEBRTC_API -void gst_webrtc_data_channel_on_buffered_amount_low (GstWebRTCDataChannel * channel); - GST_WEBRTC_API void gst_webrtc_data_channel_send_data (GstWebRTCDataChannel * channel, GBytes * data); diff --git a/gst-libs/gst/webrtc/webrtc-priv.h b/gst-libs/gst/webrtc/webrtc-priv.h index 3e9bf3816..203f852fa 100644 --- a/gst-libs/gst/webrtc/webrtc-priv.h +++ b/gst-libs/gst/webrtc/webrtc-priv.h @@ -231,6 +231,69 @@ GST_WEBRTC_API void gst_webrtc_dtls_transport_set_transport (GstWebRTCDTLSTransport * transport, GstWebRTCICETransport * ice); +#define GST_WEBRTC_DATA_CHANNEL_LOCK(channel) g_mutex_lock(&((GstWebRTCDataChannel *)(channel))->lock) +#define GST_WEBRTC_DATA_CHANNEL_UNLOCK(channel) g_mutex_unlock(&((GstWebRTCDataChannel *)(channel))->lock) + +/** + * GstWebRTCDataChannel: + * + * Since: 1.18 + */ +struct _GstWebRTCDataChannel +{ + GObject parent; + + GMutex lock; + + gchar *label; + gboolean ordered; + guint max_packet_lifetime; + guint max_retransmits; + gchar *protocol; + gboolean negotiated; + gint id; + GstWebRTCPriorityType priority; + GstWebRTCDataChannelState ready_state; + guint64 buffered_amount; + guint64 buffered_amount_low_threshold; + + gpointer _padding[GST_PADDING]; +}; + +/** + * GstWebRTCDataChannelClass: + * + * Since: 1.18 + */ +struct _GstWebRTCDataChannelClass +{ + GObjectClass parent_class; + + void (*send_data) (GstWebRTCDataChannel * channel, GBytes *data); + void (*send_string) (GstWebRTCDataChannel * channel, const gchar *str); + void (*close) (GstWebRTCDataChannel * channel); + + gpointer _padding[GST_PADDING]; +}; + +GST_WEBRTC_API +void gst_webrtc_data_channel_on_open (GstWebRTCDataChannel * channel); + +GST_WEBRTC_API +void gst_webrtc_data_channel_on_close (GstWebRTCDataChannel * channel); + +GST_WEBRTC_API +void gst_webrtc_data_channel_on_error (GstWebRTCDataChannel * channel, GError * error); + +GST_WEBRTC_API +void gst_webrtc_data_channel_on_message_data (GstWebRTCDataChannel * channel, GBytes * data); + +GST_WEBRTC_API +void gst_webrtc_data_channel_on_message_string (GstWebRTCDataChannel * channel, const gchar * str); + +GST_WEBRTC_API +void gst_webrtc_data_channel_on_buffered_amount_low (GstWebRTCDataChannel * channel); + G_END_DECLS |