aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-03-04 01:35:00 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-03-04 01:35:00 +0800
commitfbe95d63f97a800e295e12e190084e3d9265fcb3 (patch)
tree093f0c3bcf1204fca8c9f6a1fec9cd0bc70a02f5 /libempathy
parentd2c087504a1c77e12cba7b7a8558e12b4284ca36 (diff)
downloadgsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.tar
gsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.tar.gz
gsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.tar.bz2
gsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.tar.lz
gsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.tar.xz
gsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.tar.zst
gsoc2013-empathy-fbe95d63f97a800e295e12e190084e3d9265fcb3.zip
Hardcode some a default codec preferences
For video use H264 over Theora as it's better quality and there is no reason to prefer a free codec if people already have the patented bits installed anyway. Also prefer H263 as it's reasonable and it works around our H263-1998 negotiation being slightly broken because of gstreamer :( For audio prefer speex wideband over speex smallband and all other audio codecs. And in general disable various codecs that are not really suitable for use in conferencing. From: Sjoerd Simons <sjoerd.simons@collabora.co.uk> svn path=/trunk/; revision=2567
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-call-handler.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c
index 59afe3f99..8d159cdd4 100644
--- a/libempathy/empathy-call-handler.c
+++ b/libempathy/empathy-call-handler.c
@@ -289,6 +289,56 @@ empathy_call_handler_tf_channel_closed_cb (TfChannel *tfchannel,
g_signal_emit (G_OBJECT (handler), signals[CLOSED], 0);
}
+static GList *
+empathy_call_handler_tf_channel_codec_config_get_defaults (FsCodec *codecs)
+{
+ GList *l = NULL;
+ int i;
+
+ for (i = 0; codecs[i].encoding_name != NULL; i++)
+ l = g_list_append (l, fs_codec_copy (codecs + i));
+
+ return l;
+}
+
+static GList *
+empathy_call_handler_tf_channel_codec_config_cb (TfChannel *channel,
+ guint stream_id, FsMediaType media_type, guint direction, gpointer user_data)
+{
+ FsCodec audio_codecs[] = {
+ { FS_CODEC_ID_ANY, "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000, },
+ { FS_CODEC_ID_ANY, "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000, },
+
+ { FS_CODEC_ID_DISABLE, "DV", FS_MEDIA_TYPE_AUDIO, },
+ { FS_CODEC_ID_DISABLE, "MPA", FS_MEDIA_TYPE_AUDIO, },
+ { FS_CODEC_ID_DISABLE, "VORBIS", FS_MEDIA_TYPE_AUDIO, },
+ { FS_CODEC_ID_DISABLE, "MP3", FS_MEDIA_TYPE_AUDIO, },
+ { 0, NULL, 0,}
+ };
+ FsCodec video_codecs[] = {
+ { FS_CODEC_ID_ANY, "H264", FS_MEDIA_TYPE_VIDEO, },
+ { FS_CODEC_ID_ANY, "THEORA", FS_MEDIA_TYPE_VIDEO, },
+ { FS_CODEC_ID_ANY, "H263", FS_MEDIA_TYPE_VIDEO, },
+
+ { FS_CODEC_ID_DISABLE, "DV", FS_MEDIA_TYPE_VIDEO, },
+ { FS_CODEC_ID_DISABLE, "JPEG", FS_MEDIA_TYPE_VIDEO, },
+ { FS_CODEC_ID_DISABLE, "MPV", FS_MEDIA_TYPE_VIDEO, },
+ { 0, NULL, 0}
+ };
+
+ switch (media_type)
+ {
+ case FS_MEDIA_TYPE_AUDIO:
+ return empathy_call_handler_tf_channel_codec_config_get_defaults
+ (audio_codecs);
+ case FS_MEDIA_TYPE_VIDEO:
+ return empathy_call_handler_tf_channel_codec_config_get_defaults
+ (video_codecs);
+ }
+
+ return NULL;
+}
+
static void
empathy_call_handler_start_tpfs (EmpathyCallHandler *self)
{
@@ -308,6 +358,8 @@ empathy_call_handler_start_tpfs (EmpathyCallHandler *self)
G_CALLBACK (empathy_call_handler_tf_channel_stream_created_cb), self);
g_signal_connect (priv->tfchannel, "closed",
G_CALLBACK (empathy_call_handler_tf_channel_closed_cb), self);
+ g_signal_connect (priv->tfchannel, "stream-get-codec-config",
+ G_CALLBACK (empathy_call_handler_tf_channel_codec_config_cb), self);
g_object_unref (channel);
}