empathy r2567 - trunk/libempathy



Author: xclaesse
Date: Tue Mar  3 17:35:00 2009
New Revision: 2567
URL: http://svn.gnome.org/viewvc/empathy?rev=2567&view=rev

Log:
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>

Modified:
   trunk/libempathy/empathy-call-handler.c

Modified: trunk/libempathy/empathy-call-handler.c
==============================================================================
--- trunk/libempathy/empathy-call-handler.c	(original)
+++ trunk/libempathy/empathy-call-handler.c	Tue Mar  3 17:35:00 2009
@@ -289,6 +289,56 @@
   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 @@
       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);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]