pidgin: 16c47a35: Handle Jingle's description-info method.

maiku at pidgin.im maiku at pidgin.im
Tue Nov 10 21:10:30 EST 2009


-----------------------------------------------------------------
Revision: 16c47a3521f79a6091f5196bb3649c2f9ca2922f
Ancestor: cea0a94190c6ddf69977976b807b9bc5aa880987
Author: maiku at pidgin.im
Date: 2009-11-11T02:05:01
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/16c47a3521f79a6091f5196bb3649c2f9ca2922f

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

ChangeLog: 

Handle Jingle's description-info method.

This makes Pidgin<->Empathy work more reliably, especially for video.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c	49fe4058345a502d41b67c6f51fce3786d05354e
+++ libpurple/protocols/jabber/jingle/rtp.c	b60827da45c612f08e4c7bb65b4c65a29973918c
@@ -823,6 +823,65 @@ jingle_rtp_handle_action_internal(Jingle
 			g_object_unref(session);
 			break;
 		}
+		case JINGLE_DESCRIPTION_INFO: {
+			JingleSession *session =
+					jingle_content_get_session(content);
+			xmlnode *description = xmlnode_get_child(
+					xmlcontent, "description");
+			GList *codecs, *iter, *iter2, *remote_codecs =
+					jingle_rtp_parse_codecs(description);
+			gchar *name = jingle_content_get_name(content);
+			gchar *remote_jid =
+					jingle_session_get_remote_jid(session);
+			PurpleMedia *media;
+
+			media = jingle_rtp_get_media(session);
+
+			/*
+			 * This may have problems if description-info is
+			 * received without the optional parameters for a
+			 * codec with configuration info (such as THEORA
+			 * or H264). The local configuration info may be
+			 * set for the remote codec.
+			 *
+			 * As of 2.6.3 there's no API to support getting
+			 * the remote codecs specifically, just the
+			 * intersection. Another option may be to cache
+			 * the remote codecs received in initiate/accept.
+			 */
+			codecs = purple_media_get_codecs(media, name);
+
+			for (iter = codecs; iter; iter = g_list_next(iter)) {
+				guint id;
+
+				id = purple_media_codec_get_id(iter->data);
+				iter2 = remote_codecs;
+
+				for (; iter2; iter2 = g_list_next(iter2)) {
+					if (purple_media_codec_get_id(
+							iter2->data) != id)
+						continue;
+
+					g_object_unref(iter->data);
+					iter->data = iter2->data;
+					remote_codecs = g_list_delete_link(
+							remote_codecs, iter2);
+					break;
+				}
+			}
+
+			codecs = g_list_concat(codecs, remote_codecs);
+			g_list_free (remote_codecs);
+
+			purple_media_set_remote_codecs(media,
+					name, remote_jid, codecs);
+
+			purple_media_codec_list_free (codecs);
+			g_free(remote_jid);
+			g_free(name);
+			g_object_unref(session);
+			break;
+		}
 		default:
 			break;
 	}


More information about the Commits mailing list