From a6593753a5ab751eb10971201960f3e8aea70bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Wed, 21 Apr 2021 16:00:57 -0400 Subject: [PATCH] webrtc lib: Make the rtpsender struct private This will prevent any unsafe access. Part-of: --- ext/webrtc/gstwebrtcbin.c | 2 ++ gst-libs/gst/webrtc/rtpsender.c | 1 + gst-libs/gst/webrtc/rtpsender.h | 42 ------------------------------- gst-libs/gst/webrtc/webrtc-priv.h | 42 +++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 42 deletions(-) diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index df5bc8e56a..38d556fa71 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -31,6 +31,8 @@ #include "webrtcdatachannel.h" #include "sctptransport.h" +#include "gst/webrtc/webrtc-priv.h" + #include #include diff --git a/gst-libs/gst/webrtc/rtpsender.c b/gst-libs/gst/webrtc/rtpsender.c index 90221dd56c..90f43ccee6 100644 --- a/gst-libs/gst/webrtc/rtpsender.c +++ b/gst-libs/gst/webrtc/rtpsender.c @@ -32,6 +32,7 @@ #include "rtpsender.h" #include "rtptransceiver.h" +#include "webrtc-priv.h" #define GST_CAT_DEFAULT gst_webrtc_rtp_sender_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); diff --git a/gst-libs/gst/webrtc/rtpsender.h b/gst-libs/gst/webrtc/rtpsender.h index 44eee81a5f..b3ca9a0100 100644 --- a/gst-libs/gst/webrtc/rtpsender.h +++ b/gst-libs/gst/webrtc/rtpsender.h @@ -35,48 +35,6 @@ GType gst_webrtc_rtp_sender_get_type(void); #define GST_IS_WEBRTC_RTP_SENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_WEBRTC_RTP_SENDER)) #define GST_WEBRTC_RTP_SENDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_WEBRTC_RTP_SENDER,GstWebRTCRTPSenderClass)) -/** - * GstWebRTCRTPSender: - * @transport: The transport for RTP packets - * @send_encodings: Unused - * @priority: The priority of the stream (Since: 1.20) - * - * An object to track the sending aspect of the stream - * - * Mostly matches the WebRTC RTCRtpSender interface. - * - * Since: 1.16 - */ -/** - * GstWebRTCRTPSender.priority: - * - * The priority of the stream - * - * Since: 1.20 - */ -struct _GstWebRTCRTPSender -{ - GstObject parent; - - /* The MediStreamTrack is represented by the stream and is output into @transport as necessary */ - GstWebRTCDTLSTransport *transport; - - GArray *send_encodings; - GstWebRTCPriorityType priority; - - gpointer _padding[GST_PADDING]; -}; - -struct _GstWebRTCRTPSenderClass -{ - GstObjectClass parent_class; - - gpointer _padding[GST_PADDING]; -}; - -GST_WEBRTC_API -GstWebRTCRTPSender * gst_webrtc_rtp_sender_new (void); - GST_WEBRTC_API void gst_webrtc_rtp_sender_set_priority (GstWebRTCRTPSender *sender, GstWebRTCPriorityType priority); diff --git a/gst-libs/gst/webrtc/webrtc-priv.h b/gst-libs/gst/webrtc/webrtc-priv.h index 6f2d3ea8d0..559fc2d3a9 100644 --- a/gst-libs/gst/webrtc/webrtc-priv.h +++ b/gst-libs/gst/webrtc/webrtc-priv.h @@ -86,6 +86,48 @@ struct _GstWebRTCRTPTransceiverClass gpointer _padding[GST_PADDING]; }; +/** + * GstWebRTCRTPSender: + * @transport: The transport for RTP packets + * @send_encodings: Unused + * @priority: The priority of the stream (Since: 1.20) + * + * An object to track the sending aspect of the stream + * + * Mostly matches the WebRTC RTCRtpSender interface. + * + * Since: 1.16 + */ +/** + * GstWebRTCRTPSender.priority: + * + * The priority of the stream + * + * Since: 1.20 + */ +struct _GstWebRTCRTPSender +{ + GstObject parent; + + /* The MediStreamTrack is represented by the stream and is output into @transport as necessary */ + GstWebRTCDTLSTransport *transport; + + GArray *send_encodings; + GstWebRTCPriorityType priority; + + gpointer _padding[GST_PADDING]; +}; + +struct _GstWebRTCRTPSenderClass +{ + GstObjectClass parent_class; + + gpointer _padding[GST_PADDING]; +}; + +GST_WEBRTC_API +GstWebRTCRTPSender * gst_webrtc_rtp_sender_new (void); + G_END_DECLS #endif /* __GST_WEBRTC_PRIV_H__ */