soc.2008.vv: 8ec50f93: Send negotiated codecs in session-accept...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Fri Jun 6 23:56:02 EDT 2008


-----------------------------------------------------------------
Revision: 8ec50f93625e0ff6d5743d26f40cb0214d6ce1ec
Ancestor: dc7c2c884202112dc5e8b92ca656616c8bc74a72
Author: maiku at soc.pidgin.im
Date: 2008-06-07T03:43:45
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/8ec50f93625e0ff6d5743d26f40cb0214d6ce1ec

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

ChangeLog: 

Send negotiated codecs in session-accept opposed to all local codecs.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle.c	3e8861280a81162b198c3e000db1a29946b25328
+++ libpurple/protocols/jabber/jingle.c	df417a340f77d8782d886c2a9180e1000937c7db
@@ -435,14 +435,9 @@ jabber_jingle_session_add_payload_types(
 
 static void
 jabber_jingle_session_add_payload_types(const JingleSessionContent *jsc,
-					xmlnode *description)
+					xmlnode *description,
+					GList *codecs)
 {
-	JingleSession *session = jabber_jingle_session_content_get_session(jsc);
-	PurpleMedia *media = jabber_jingle_session_get_media(session);
-	/* should this be local_codecs or negotiated-codecs? */
-	GList *codecs = purple_media_get_local_codecs(media,
-			jabber_jingle_session_content_get_name(jsc));
-
 	for (; codecs ; codecs = codecs->next) {
 		FsCodec *codec = (FsCodec*)codecs->data;
 		char id[8], clockrate[10], channels[10];
@@ -457,7 +452,6 @@ jabber_jingle_session_add_payload_types(
 		xmlnode_set_attrib(payload, "clockrate", clockrate);
 		xmlnode_set_attrib(payload, "channels", channels);
 	}
-	fs_codec_list_destroy(codecs);
 }
 
 static xmlnode *
@@ -680,17 +674,21 @@ jabber_jingle_session_create_session_acc
 
 	for (; contents; contents = contents->next) {
 		JingleSessionContent *jsc = contents->data;
-		const gchar *session_name = jabber_jingle_session_content_get_name(jsc);
+		const gchar *content_name = jabber_jingle_session_content_get_name(jsc);
 		xmlnode *content = jabber_jingle_session_add_content(jsc, jingle);
 		xmlnode *description = jabber_jingle_session_add_description(jsc, content);
 		xmlnode *transport = jabber_jingle_session_add_transport(jsc, content);
-		if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP))
-			jabber_jingle_session_add_payload_types(jsc, description);
+		if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP)) {
+			GList *codecs = purple_media_get_negotiated_codecs(media,
+									   content_name);
+			jabber_jingle_session_add_payload_types(jsc, description, codecs);
+			fs_codec_list_destroy(codecs);
+		}
 		if (jabber_jingle_session_content_is_transport_type(jsc, TRANSPORT_ICEUDP)) {
 			jabber_jingle_session_add_candidate_iceudp(transport, 
-					purple_media_get_local_candidate(media, session_name,
+					purple_media_get_local_candidate(media, content_name,
 									 remote_jid),
-					purple_media_get_remote_candidate(media, session_name,
+					purple_media_get_remote_candidate(media, content_name,
 									  remote_jid));
 		}
 	}
@@ -724,8 +722,14 @@ jabber_jingle_session_create_session_ini
 		JingleSessionContent *jsc = contents->data;
 		xmlnode *content = jabber_jingle_session_add_content(jsc, jingle);
 		xmlnode *description = jabber_jingle_session_add_description(jsc, content);
-		if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP))
-			jabber_jingle_session_add_payload_types(jsc, description);
+		if (jabber_jingle_session_content_is_type(jsc, JINGLE_RTP)) {
+			PurpleMedia *media = jabber_jingle_session_get_media(session);
+			const gchar *content_name =
+					jabber_jingle_session_content_get_name(jsc);
+			GList *codecs = purple_media_get_local_codecs(media, content_name);
+			jabber_jingle_session_add_payload_types(jsc, description, codecs);
+			fs_codec_list_destroy(codecs);
+		}
 		jabber_jingle_session_add_transport(jsc, content);
 	}
 


More information about the Commits mailing list