pidgin: ff248f72: Add speex as a default codec.

maiku at soc.pidgin.im maiku at soc.pidgin.im
Tue Jun 2 17:45:35 EDT 2009


-----------------------------------------------------------------
Revision: ff248f7206a9d4924256440c85e52b5355025efb
Ancestor: 96053e4134082b7931e5641214f274bced3fa0c3
Author: maiku at soc.pidgin.im
Date: 2009-06-02T21:39:53
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ff248f7206a9d4924256440c85e52b5355025efb

Modified files:
        libpurple/media.c

ChangeLog: 

Add speex as a default codec.

-------------- next part --------------
============================================================
--- libpurple/media.c	429807c9e9686b5c12cd134613627ca4d051ae55
+++ libpurple/media.c	691896c928253bf850113a04eb385efccd111277
@@ -2416,7 +2416,7 @@ purple_media_add_stream(PurpleMedia *med
 
 	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 @@ purple_media_add_stream(PurpleMedia *med
 			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 @@ purple_media_add_stream(PurpleMedia *med
 			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);
 
 		/*


More information about the Commits mailing list