webrtc: Make GstWebRTCIceCandidateStats a Boxed type

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2891>
This commit is contained in:
Thibault Saunier 2022-08-15 11:36:25 -04:00 committed by GStreamer Marge Bot
parent ff0d73be57
commit 8dd4c215da
2 changed files with 33 additions and 2 deletions

View file

@ -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
*/
@ -315,6 +315,31 @@ gst_webrtc_ice_candidate_stats_free (GstWebRTCICECandidateStats * stats)
g_free (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

View file

@ -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__ */