pidgin: 681fb864: media: Set the "controlling-mode" Farsig...

malu at pidgin.im malu at pidgin.im
Wed Feb 3 17:50:27 EST 2010


-----------------------------------------------------------------
Revision: 681fb86466372d3d72fbfb554c0b766c81d763e6
Ancestor: 12cc2cc3c1e0012329832ea2d170dca5b31f8b9b
Author: malu at pidgin.im
Date: 2010-02-03T22:46:22
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/681fb86466372d3d72fbfb554c0b766c81d763e6

Modified files:
        ChangeLog libpurple/media.c

ChangeLog: 

media: Set the "controlling-mode" Farsight2 parameter correctly when creating media streams.
Fixes receiving calls from Psi (which needs the receiver to be in
non-controlling STUN mode).
Closes #11267


-------------- next part --------------
============================================================
--- ChangeLog	6a1b6c6527a93a19e0d3e2f7045910584268b45c
+++ ChangeLog	73f5d12fac4ff7414e2c68ee72e339cafc46883a
@@ -5,6 +5,8 @@ version 2.6.6 (??/??/20??):
 	* Fix 'make check' on OS X. (David Fang)
 	* Fix a quirk in purple_markup_html_to_xhtml that caused some messages
 	  to be improperly converted to XHTML.
+	* Set "controlling-mode" correctly when initializing a media session.
+	  Fixes receiving voice calls from Psi.
 
 	General:
 	* Correctly disable all missing dependencies when using the
============================================================
--- libpurple/media.c	fe1eb5f8a2740b5420fb6f0ac10bd56d8c2b7c56
+++ libpurple/media.c	c3677b884cb261b4a3232a94e44c0eac2bc81d7f
@@ -2754,15 +2754,21 @@ purple_media_add_stream(PurpleMedia *med
 		FsStream *fsstream = NULL;
 		const gchar *stun_ip = purple_network_get_stun_ip();
 		const gchar *turn_ip = purple_network_get_turn_ip();
-
-		if (stun_ip || turn_ip) {
-			guint new_num_params = 
+		guint new_num_params =
+					!stun_ip && !turn_ip ? num_params + 1 :
 					(stun_ip && is_nice) && turn_ip ?
-					num_params + 2 : num_params + 1;
-			guint next_param_index = num_params;
-			GParameter *param = g_new0(GParameter, new_num_params);
-			memcpy(param, params, sizeof(GParameter) * num_params);
+					num_params + 3 : num_params + 2;
+		guint next_param_index = num_params;
+		GParameter *param = g_new0(GParameter, new_num_params);
+		memcpy(param, params, sizeof(GParameter) * num_params);
 
+		/* set controlling mode according to direction */
+		param[next_param_index].name = "controlling-mode";
+		g_value_init(&param[next_param_index].value, G_TYPE_BOOLEAN);
+		g_value_set_boolean(&param[next_param_index].value, initiator);
+		next_param_index++;
+		
+		if (stun_ip || turn_ip) {
 			if (stun_ip) {
 				purple_debug_info("media", 
 					"setting property stun-ip on new stream: %s\n", stun_ip);
@@ -2813,20 +2819,14 @@ purple_media_add_stream(PurpleMedia *med
 					return FALSE;
 				}
 			}
+		}
 
-			fsstream = fs_session_new_stream(session->session,
+		fsstream = fs_session_new_stream(session->session,
 					participant, initiator == TRUE ?
 					type_direction : (type_direction &
 					FS_DIRECTION_RECV), transmitter,
 					new_num_params, param, &err);
-			g_free(param);
-		} else {
-			fsstream = fs_session_new_stream(session->session,
-					participant, initiator == TRUE ?
-					type_direction : (type_direction &
-					FS_DIRECTION_RECV), transmitter,
-					num_params, params, &err);
-		}
+		g_free(param);
 
 		if (fsstream == NULL) {
 			purple_debug_error("media",


More information about the Commits mailing list