diff options
author | Gary Kramlich <grim@reaperworld.com> | 2018-03-07 23:53:17 -0600 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2018-03-07 23:53:17 -0600 |
commit | fb59333599408d8d810f452ad036c0f10d590f75 (patch) | |
tree | 37a4c46190700df0aa69043cbb63c0f66e08adb5 | |
parent | 7d1c3c1f68bdfaecb26c3aa1bf7fd5afd98ef8eb (diff) | |
download | pidgin-fb59333599408d8d810f452ad036c0f10d590f75.tar.gz |
Port backend-fs to newer api for farstream relay-info property. Fixes #17274
-rw-r--r-- | COPYRIGHT | 1 | ||||
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | libpurple/media/backend-fs2.c | 47 |
3 files changed, 47 insertions, 4 deletions
@@ -52,6 +52,7 @@ Stefan Becker Carlos Bederian Dave Bell Matthew W.S. Bell +bellet Igor Belyi David Benjamin Brian Bernas @@ -42,6 +42,9 @@ version 2.13.0 (??/??/????): Finch: * Fix handling of search results (#17238 David Woodhouse) + Voice & Video: + * Port backend-fs to newer api for farstream relay-info property (#17274 bellet) + version 2.12.0 (03/09/2017): libpurple: * Fix an out of bounds memory write in purple_markup_unescape_entity. diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c index 036efb1918..6fe6d20ac3 100644 --- a/libpurple/media/backend-fs2.c +++ b/libpurple/media/backend-fs2.c @@ -2093,6 +2093,7 @@ src_pad_added_cb(FsStream *fsstream, GstPad *srcpad, (GSourceFunc)src_pad_added_cb_cb, stream); } +#ifdef HAVE_FARSIGHT static GValueArray * append_relay_info(GValueArray *relay_info, const gchar *ip, gint port, const gchar *username, const gchar *password, const gchar *type) @@ -2118,6 +2119,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS return relay_info; } +#endif static gboolean create_stream(PurpleMediaBackendFs2 *self, @@ -2144,6 +2146,10 @@ create_stream(PurpleMediaBackendFs2 *self, TURN modes, like Google f.ex. */ gboolean got_turn_from_prpl = FALSE; guint i; +#ifndef HAVE_FARSIGHT + GPtrArray *relay_info = g_ptr_array_new_full (1, (GDestroyNotify) gst_structure_free); + gboolean ret; +#endif session = get_session(self, sess_id); @@ -2208,7 +2214,9 @@ create_stream(PurpleMediaBackendFs2 *self, if (turn_ip && purple_strequal("nice", transmitter) && !got_turn_from_prpl) { G_GNUC_BEGIN_IGNORE_DEPRECATIONS +#ifdef HAVE_FARSIGHT GValueArray *relay_info = g_value_array_new(0); +#endif G_GNUC_END_IGNORE_DEPRECATIONS gint port; const gchar *username = purple_prefs_get_string( @@ -2219,15 +2227,37 @@ G_GNUC_END_IGNORE_DEPRECATIONS /* UDP */ port = purple_prefs_get_int("/purple/network/turn_port"); if (port > 0) { +#ifdef HAVE_FARSIGHT relay_info = append_relay_info(relay_info, turn_ip, port, username, password, "udp"); +#else + g_ptr_array_add (relay_info, + gst_structure_new ("relay-info", + "ip", G_TYPE_STRING, turn_ip, + "port", G_TYPE_UINT, port, + "username", G_TYPE_STRING, username, + "password", G_TYPE_STRING, password, + "relay-type", G_TYPE_STRING, "udp", + NULL)); +#endif } /* TCP */ port = purple_prefs_get_int("/purple/network/turn_port_tcp"); if (port > 0) { +#ifdef HAVE_FARSIGHT relay_info = append_relay_info(relay_info, turn_ip, port, username, password, "tcp"); +#else + g_ptr_array_add (relay_info, + gst_structure_new ("relay-info", + "ip", G_TYPE_STRING, turn_ip, + "port", G_TYPE_UINT, port, + "username", G_TYPE_STRING, username, + "password", G_TYPE_STRING, password, + "relay-type", G_TYPE_STRING, "tcp", + NULL)); +#endif } /* TURN over SSL is only supported by libnice for Google's "psuedo" SSL mode @@ -2237,9 +2267,14 @@ G_GNUC_END_IGNORE_DEPRECATIONS "Setting relay-info on new stream\n"); _params[_num_params].name = "relay-info"; G_GNUC_BEGIN_IGNORE_DEPRECATIONS +#ifdef HAVE_FARSIGHT g_value_init(&_params[_num_params].value, G_TYPE_VALUE_ARRAY); g_value_set_boxed(&_params[_num_params].value, relay_info); g_value_array_free(relay_info); +#else + g_value_init(&_params[_num_params].value, G_TYPE_PTR_ARRAY); + g_value_set_boxed(&_params[_num_params].value, relay_info); +#endif G_GNUC_END_IGNORE_DEPRECATIONS _num_params++; } @@ -2264,16 +2299,20 @@ G_GNUC_END_IGNORE_DEPRECATIONS return FALSE; } #else - if (!fs_stream_set_transmitter(fsstream, transmitter, - _params, _num_params, &err)) { + ret = fs_stream_set_transmitter(fsstream, transmitter, + _params, _num_params, &err); + for (i = 0 ; i < _num_params ; i++) + g_value_unset (&_params[i].value); + g_free(_params); + if (relay_info) + g_ptr_array_unref (relay_info); + if (ret == FALSE) { purple_debug_error("backend-fs2", "Could not set transmitter %s: %s.\n", transmitter, err ? err->message : NULL); g_clear_error(&err); - g_free(_params); return FALSE; } - g_free(_params); #endif stream = g_new0(PurpleMediaBackendFs2Stream, 1); |