maiku.vv: 666da29c: Have the responder wait to set the send ...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Sep 5 03:25:29 EDT 2008


-----------------------------------------------------------------
Revision: 666da29cf73f58a00caf5cd3df39c2e6299c332b
Ancestor: 9d222e7169d19b5b1818013c9a5ef827ab3f935f
Author: maiku at soc.pidgin.im
Date: 2008-09-05T05:46:14
Branch: im.pidgin.maiku.vv
URL: http://d.pidgin.im/viewmtn/revision/info/666da29cf73f58a00caf5cd3df39c2e6299c332b

Modified files:
        libpurple/protocols/jabber/jingle.c

ChangeLog: 

Have the responder wait to set the send codec until codecs are ready.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle.c	670d4292cd432fdf0bbee6dae2a1b999a3868915
+++ libpurple/protocols/jabber/jingle.c	e71c5db6e66d05201c35bb176ce7eb66d1c4085a
@@ -822,6 +822,26 @@ jabber_jingle_session_accept(JingleSessi
 			purple_media_candidates_prepared(
 				jabber_jingle_session_get_media(session),
 				jabber_jingle_session_get_remote_jid(session))) {
+		GList *contents = jabber_jingle_session_get_contents(session);
+		for (; contents; contents = contents->next) {
+			JingleSessionContent *jsc = contents->data;
+			GList *codec_intersection =
+					purple_media_get_negotiated_codecs(session->media,
+					jabber_jingle_session_content_get_name(jsc));
+			purple_debug_info("jingle", "codec intersection: %i\n",
+					g_list_length(codec_intersection));
+
+			if (codec_intersection != NULL) {
+				gchar *codec_str = fs_codec_to_string(codec_intersection->data);
+				purple_debug_info("jingle", "Setting send codec: %s\n", codec_str);
+				g_free(codec_str);
+				purple_media_set_send_codec(
+						jabber_jingle_session_get_media(session),
+						jabber_jingle_session_content_get_name(jsc),
+						codec_intersection->data);
+			}
+		}
+
 		jabber_iq_send(jabber_jingle_session_create_session_accept(session));
 		
 		purple_debug_info("jingle", "Sent session accept.\n");
@@ -852,10 +872,6 @@ jabber_jingle_session_send_session_accep
 			jabber_iq_send(result);
 		}
 		fs_candidate_list_destroy(candidates);
-
-		purple_debug_info("jingle", "codec intersection: %i\n",
-				g_list_length(purple_media_get_negotiated_codecs(media,
-				jabber_jingle_session_content_get_name(jsc))));
 	}
 
 	jabber_jingle_session_set_state(session, ACCEPTED);
@@ -1367,8 +1383,6 @@ jabber_jingle_session_handle_session_ini
 
 	for (content = xmlnode_get_child(jingle, "content"); content;
 			content = xmlnode_get_next_twin(content)) {
-		GList *codec_intersection = NULL;
-
 		/* init media */
 		if (!content) {
 			purple_debug_error("jingle", "jingle tag must contain content tag\n");
@@ -1388,18 +1402,6 @@ jabber_jingle_session_handle_session_ini
 		purple_media_set_remote_codecs(session->media,
 					       xmlnode_get_attrib(content, "name"),
 					       initiator, codecs);
-
-		codec_intersection = purple_media_get_negotiated_codecs(session->media,
-				xmlnode_get_attrib(content, "name"));
-		purple_debug_info("jingle", "codec intersection: %i\n",
-				g_list_length(codec_intersection));
-
-		if (g_list_length(codec_intersection) > 0) {
-			purple_media_set_send_codec(
-					jabber_jingle_session_get_media(session),
-					xmlnode_get_attrib(content, "name"),
-					codec_intersection->data);
-		}
 	}
 	jabber_iq_send(jabber_jingle_session_create_ack(session, jingle));
 	jabber_iq_send(jabber_jingle_session_create_session_info(session, "ringing"));


More information about the Commits mailing list