webrtc:ice: Avoid using GArray in public API

And use plain null terminated C arrays instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2891>
This commit is contained in:
Thibault Saunier 2022-08-15 11:52:50 -04:00 committed by GStreamer Marge Bot
parent 50202d6b53
commit b3e0205c5a
3 changed files with 16 additions and 14 deletions

View file

@ -244,10 +244,10 @@ gst_webrtc_ice_set_tos (GstWebRTCICE * ice, GstWebRTCICEStream * stream,
* gst_webrtc_ice_get_local_candidates:
* @ice: The #GstWebRTCICE
* @stream: The #GstWebRTCICEStream
* Returns: (transfer full) (element-type GstWebRTCICECandidateStats): List of local candidates
* Returns: (transfer full)(array zero-terminated=1): List of local candidates
* Since: 1.22
*/
GArray *
GstWebRTCICECandidateStats *
gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
GstWebRTCICEStream * stream)
{
@ -262,10 +262,10 @@ gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
* gst_webrtc_ice_get_remote_candidates:
* @ice: The #GstWebRTCICE
* @stream: The #GstWebRTCICEStream
* Returns: (transfer full) (element-type GstWebRTCICECandidateStats): List of remote candidates
* Returns: (transfer full) (array zero-terminated=1): List of remote candidates
* Since: 1.22
*/
GArray *
GstWebRTCICECandidateStats *
gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice,
GstWebRTCICEStream * stream)
{

View file

@ -111,9 +111,11 @@ struct _GstWebRTCICEClass {
GstWebRTCICEOnCandidateFunc func,
gpointer user_data,
GDestroyNotify notify);
GArray * (*get_local_candidates) (GstWebRTCICE * ice,
GstWebRTCICECandidateStats*
(*get_local_candidates) (GstWebRTCICE * ice,
GstWebRTCICEStream * stream);
GArray * (*get_remote_candidates) (GstWebRTCICE * ice,
GstWebRTCICECandidateStats*
(get_remote_candidates) (GstWebRTCICE * ice,
GstWebRTCICEStream * stream);
gboolean (*get_selected_pair) (GstWebRTCICE * ice,
GstWebRTCICEStream * stream,
@ -196,11 +198,11 @@ void gst_webrtc_ice_set_tos (GstWebRTCIC
guint tos);
GST_WEBRTC_API
GArray * gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
GstWebRTCICECandidateStats* gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
GstWebRTCICEStream * stream);
GST_WEBRTC_API
GArray * gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice,
GstWebRTCICECandidateStats* gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice,
GstWebRTCICEStream * stream);
GST_WEBRTC_API

View file

@ -1189,7 +1189,7 @@ _populate_candidate_list_stats (GstWebRTCNice * ice, GSList * cands,
}
}
static GArray *
static GstWebRTCICECandidateStats *
gst_webrtc_nice_get_local_candidates (GstWebRTCICE * ice,
GstWebRTCICEStream * stream)
{
@ -1197,7 +1197,7 @@ gst_webrtc_nice_get_local_candidates (GstWebRTCICE * ice,
GSList *cands = NULL;
GArray *result =
g_array_new (FALSE, TRUE, sizeof (GstWebRTCICECandidateStats));
g_array_new (TRUE, TRUE, sizeof (GstWebRTCICECandidateStats));
cands = nice_agent_get_local_candidates (nice->priv->nice_agent,
stream->stream_id, NICE_COMPONENT_TYPE_RTP);
@ -1205,10 +1205,10 @@ gst_webrtc_nice_get_local_candidates (GstWebRTCICE * ice,
_populate_candidate_list_stats (nice, cands, stream, result, TRUE);
g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);
return result;
return (GstWebRTCICECandidateStats *) g_array_free (result, FALSE);
}
static GArray *
static GstWebRTCICECandidateStats *
gst_webrtc_nice_get_remote_candidates (GstWebRTCICE * ice,
GstWebRTCICEStream * stream)
{
@ -1216,7 +1216,7 @@ gst_webrtc_nice_get_remote_candidates (GstWebRTCICE * ice,
GSList *cands = NULL;
GArray *result =
g_array_new (FALSE, TRUE, sizeof (GstWebRTCICECandidateStats));
g_array_new (TRUE, TRUE, sizeof (GstWebRTCICECandidateStats));
cands = nice_agent_get_remote_candidates (nice->priv->nice_agent,
stream->stream_id, NICE_COMPONENT_TYPE_RTP);
@ -1224,7 +1224,7 @@ gst_webrtc_nice_get_remote_candidates (GstWebRTCICE * ice,
_populate_candidate_list_stats (nice, cands, stream, result, FALSE);
g_slist_free_full (cands, (GDestroyNotify) nice_candidate_free);
return result;
return (GstWebRTCICECandidateStats *) g_array_free (result, FALSE);
}
static gboolean