changeset 27001:7358c1f6df19

merge of '28778df3113382d631f8cf40ff35a26ca515513f' and 'ff248f7206a9d4924256440c85e52b5355025efb'
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 02 Jun 2009 21:41:03 +0000
parents 432f02730dc1 (current diff) 5a4451b8fe29 (diff)
children b709ab0cb4bc
files
diffstat 1 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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);
 
 		/*