# HG changeset patch # User Mike Ruprecht # Date 1243978863 0 # Node ID 7358c1f6df195f73bd43afea35e5bcf2ef18d22b # Parent 432f02730dc1dd0aeecd0f35a0bf93357dc28b95# Parent 5a4451b8fe29a9da399cbc0c610364133a755571 merge of '28778df3113382d631f8cf40ff35a26ca515513f' and 'ff248f7206a9d4924256440c85e52b5355025efb' diff -r 432f02730dc1 -r 7358c1f6df19 libpurple/media.c --- 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); /*