merge of '7b689eb33b4d7af20aef4f756fe9855306fc2401'

Tue, 02 Jun 2009 21:41:03 +0000

author
Michael Ruprecht <maiku@pidgin.im>
date
Tue, 02 Jun 2009 21:41:03 +0000
changeset 27206
26952d7d9c32
parent 27204
7b689eb33b4d (current diff)
parent 27205
fe56c88850ce (diff)
child 27221
665d80eca401

merge of '7b689eb33b4d7af20aef4f756fe9855306fc2401'
and 'fe56c88850ce419a3c770d0b721f7db3f34b8a06'

--- a/libpurple/media.c	Tue Jun 02 05:24:26 2009 +0000
+++ b/libpurple/media.c	Tue Jun 02 21:41:03 2009 +0000
@@ -2416,7 +2416,7 @@
 
 	if (!session) {
 		GError *err = NULL;
-		GList *codec_conf = NULL;
+		GList *codec_conf = NULL, *iter = NULL;
 		gchar *filename = NULL;
 		PurpleMediaSessionType session_type;
 		GstElement *src = NULL;
@@ -2433,15 +2433,6 @@
 			return FALSE;
 		}
 
-	/* XXX: SPEEX has a latency of 5 or 6 seconds for me */
-#if 0
-	/* SPEEX is added through the configuration */
-		codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
-				"SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
-		codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
-				"SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
-#endif
-
 		filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL);
 		codec_conf = fs_codec_list_from_keyfile(filename, &err);
 		g_free(filename);
@@ -2458,6 +2449,25 @@
 			g_error_free(err);
 		}
 
+		/*
+		 * Add SPEEX if the configuration file doesn't exist or
+		 * there isn't a speex entry.
+		 */
+		for (iter = codec_conf; iter; iter = g_list_next(iter)) {
+			FsCodec *codec = iter->data;
+			if (!g_ascii_strcasecmp(codec->encoding_name, "speex"))
+				break;
+		}
+
+		if (iter == NULL) {
+			codec_conf = g_list_prepend(codec_conf,
+					fs_codec_new(FS_CODEC_ID_ANY,
+					"SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
+			codec_conf = g_list_prepend(codec_conf,
+					fs_codec_new(FS_CODEC_ID_ANY,
+					"SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
+		}
+
 		fs_session_set_codec_preferences(session->session, codec_conf, NULL);
 
 		/*

mercurial