From 8dd4c215da53dd5c5831bed3e662b79fa264c016 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 15 Aug 2022 11:36:25 -0400 Subject: [PATCH] webrtc: Make GstWebRTCIceCandidateStats a Boxed type Part-of: --- .../gst-plugins-bad/gst-libs/gst/webrtc/ice.c | 29 ++++++++++++++++++++-- .../gst-plugins-bad/gst-libs/gst/webrtc/ice.h | 6 +++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c b/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c index a3a4205..d197f19 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.c @@ -281,7 +281,7 @@ gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice, * @stream: The #GstWebRTCICEStream * @local_stats: A pointer to #GstWebRTCICECandidateStats for local candidate * @remote_stats: A pointer to #GstWebRTCICECandidateStats for remote candidate - * + * * Returns: FALSE on failure, otherwise @local_stats @remote_stats will be set * Since: 1.22 */ @@ -300,7 +300,7 @@ gst_webrtc_ice_get_selected_pair (GstWebRTCICE * ice, /** * gst_webrtc_ice_candidate_stats_free: * @stats: The #GstWebRTCICECandidateStats to be free'd - * + * * Helper function to free #GstWebRTCICECandidateStats * Since: 1.22 */ @@ -316,6 +316,31 @@ gst_webrtc_ice_candidate_stats_free (GstWebRTCICECandidateStats * stats) } /** + * gst_webrtc_ice_candidate_stats_copy: + * @stats: The #GstWebRTCICE + * + * Returns: (transfer full): A copy of @stats + * Since: 1.22 + */ +GstWebRTCICECandidateStats * +gst_webrtc_ice_candidate_stats_copy (GstWebRTCICECandidateStats * stats) +{ + GstWebRTCICECandidateStats *copy = + g_malloc (sizeof (GstWebRTCICECandidateStats)); + + *copy = *stats; + + copy->ipaddr = g_strdup (stats->ipaddr); + copy->url = g_strdup (stats->url); + + return copy; +} + +G_DEFINE_BOXED_TYPE (GstWebRTCICECandidateStats, gst_webrtc_ice_candidate_stats, + (GBoxedCopyFunc) gst_webrtc_ice_candidate_stats_copy, + (GBoxedFreeFunc) gst_webrtc_ice_candidate_stats_free); + +/** * gst_webrtc_ice_set_on_ice_candidate: * @ice: The #GstWebRTCICE * @func: The #GstWebRTCICEOnCandidateFunc callback function diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h b/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h index a39c5a6..ea16441 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/webrtc/ice.h @@ -212,8 +212,14 @@ gboolean gst_webrtc_ice_get_selected_pair (GstWebRTCIC GST_WEBRTC_API void gst_webrtc_ice_candidate_stats_free (GstWebRTCICECandidateStats * stats); +GST_WEBRTC_API +GType gst_webrtc_ice_candidate_stats_get_type (void); + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstWebRTCICE, gst_object_unref) +GST_WEBRTC_API +GstWebRTCICECandidateStats * gst_webrtc_ice_candidate_stats_copy (GstWebRTCICECandidateStats *stats); + G_END_DECLS #endif /* __GST_WEBRTC_ICE_H__ */ -- 2.7.4