mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
webrtc:ice: Fix candidate stats related APIs for bindings
null-terminated arrays of structures is not usable. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2917>
This commit is contained in:
parent
42838c3b9e
commit
d04a80676e
3 changed files with 21 additions and 18 deletions
|
@ -254,7 +254,7 @@ gst_webrtc_ice_set_tos (GstWebRTCICE * ice, GstWebRTCICEStream * stream,
|
|||
* Returns: (transfer full)(array zero-terminated=1): List of local candidates
|
||||
* Since: 1.22
|
||||
*/
|
||||
GstWebRTCICECandidateStats *
|
||||
GstWebRTCICECandidateStats **
|
||||
gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream)
|
||||
{
|
||||
|
@ -272,7 +272,7 @@ gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
|
|||
* Returns: (transfer full) (array zero-terminated=1): List of remote candidates
|
||||
* Since: 1.22
|
||||
*/
|
||||
GstWebRTCICECandidateStats *
|
||||
GstWebRTCICECandidateStats **
|
||||
gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream)
|
||||
{
|
||||
|
|
|
@ -113,9 +113,9 @@ struct _GstWebRTCICEClass {
|
|||
GstWebRTCICEOnCandidateFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
GstWebRTCICECandidateStats* (*get_local_candidates) (GstWebRTCICE * ice,
|
||||
GstWebRTCICECandidateStats** (*get_local_candidates)(GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream);
|
||||
GstWebRTCICECandidateStats* (*get_remote_candidates)(GstWebRTCICE * ice,
|
||||
GstWebRTCICECandidateStats**(*get_remote_candidates)(GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream);
|
||||
gboolean (*get_selected_pair) (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream,
|
||||
|
@ -198,11 +198,11 @@ void gst_webrtc_ice_set_tos (GstWebRTCIC
|
|||
guint tos);
|
||||
|
||||
GST_WEBRTC_API
|
||||
GstWebRTCICECandidateStats* gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICECandidateStats** gst_webrtc_ice_get_local_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream);
|
||||
|
||||
GST_WEBRTC_API
|
||||
GstWebRTCICECandidateStats* gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICECandidateStats** gst_webrtc_ice_get_remote_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream);
|
||||
|
||||
GST_WEBRTC_API
|
||||
|
|
|
@ -1177,27 +1177,30 @@ _populate_candidate_stats (GstWebRTCNice * ice, NiceCandidate * cand,
|
|||
|
||||
static void
|
||||
_populate_candidate_list_stats (GstWebRTCNice * ice, GSList * cands,
|
||||
GstWebRTCICEStream * stream, GArray * result, gboolean is_local)
|
||||
GstWebRTCICEStream * stream, GPtrArray * result, gboolean is_local)
|
||||
{
|
||||
GSList *item;
|
||||
|
||||
for (item = cands; item != NULL; item = item->next) {
|
||||
GstWebRTCICECandidateStats stats;
|
||||
GstWebRTCICECandidateStats *stats =
|
||||
g_malloc0 (sizeof (GstWebRTCICECandidateStats));
|
||||
NiceCandidate *c = item->data;
|
||||
_populate_candidate_stats (ice, c, stream, &stats, is_local);
|
||||
g_array_append_val (result, stats);
|
||||
}
|
||||
_populate_candidate_stats (ice, c, stream, stats, is_local);
|
||||
g_ptr_array_add (result, stats);
|
||||
}
|
||||
|
||||
static GstWebRTCICECandidateStats *
|
||||
g_ptr_array_add (result, NULL);
|
||||
}
|
||||
|
||||
static GstWebRTCICECandidateStats **
|
||||
gst_webrtc_nice_get_local_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream)
|
||||
{
|
||||
GstWebRTCNice *nice = GST_WEBRTC_NICE (ice);
|
||||
GSList *cands = NULL;
|
||||
|
||||
GArray *result =
|
||||
g_array_new (TRUE, TRUE, sizeof (GstWebRTCICECandidateStats));
|
||||
/* TODO: Use a g_ptr_array_new_null_terminated once when we depend on GLib 2.74 */
|
||||
GPtrArray *result = g_ptr_array_new ();
|
||||
|
||||
cands = nice_agent_get_local_candidates (nice->priv->nice_agent,
|
||||
stream->stream_id, NICE_COMPONENT_TYPE_RTP);
|
||||
|
@ -1205,18 +1208,18 @@ 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 (GstWebRTCICECandidateStats *) g_array_free (result, FALSE);
|
||||
return (GstWebRTCICECandidateStats **) g_ptr_array_free (result, FALSE);
|
||||
}
|
||||
|
||||
static GstWebRTCICECandidateStats *
|
||||
static GstWebRTCICECandidateStats **
|
||||
gst_webrtc_nice_get_remote_candidates (GstWebRTCICE * ice,
|
||||
GstWebRTCICEStream * stream)
|
||||
{
|
||||
GstWebRTCNice *nice = GST_WEBRTC_NICE (ice);
|
||||
GSList *cands = NULL;
|
||||
|
||||
GArray *result =
|
||||
g_array_new (TRUE, TRUE, sizeof (GstWebRTCICECandidateStats));
|
||||
/* TODO: Use a g_ptr_array_new_null_terminated once when we depend on GLib 2.74 */
|
||||
GPtrArray *result = g_ptr_array_new ();
|
||||
|
||||
cands = nice_agent_get_remote_candidates (nice->priv->nice_agent,
|
||||
stream->stream_id, NICE_COMPONENT_TYPE_RTP);
|
||||
|
@ -1224,7 +1227,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 (GstWebRTCICECandidateStats *) g_array_free (result, FALSE);
|
||||
return (GstWebRTCICECandidateStats **) g_ptr_array_free (result, FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue