soc.2008.vv: 37613689: Set the proper send codec in Farsight.
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Wed Jul 23 18:40:48 EDT 2008
-----------------------------------------------------------------
Revision: 37613689fde707599c3bd245b7d4a4564db5541e
Ancestor: 02add41f00f6d38d130d85acfe142b64f37c79fe
Author: maiku at soc.pidgin.im
Date: 2008-07-23T20:10:18
Branch: im.pidgin.soc.2008.vv
URL: http://d.pidgin.im/viewmtn/revision/info/37613689fde707599c3bd245b7d4a4564db5541e
Modified files:
libpurple/media.c libpurple/media.h
libpurple/protocols/jabber/jingle.c
ChangeLog:
Set the proper send codec in Farsight.
-------------- next part --------------
============================================================
--- libpurple/media.c b6ca017b1b2b5f5e2e64a66cda585f839ab952bd
+++ libpurple/media.c 36a1e3ccde79bcbd7443d0d8ee04ccfdbd88b1d2
@@ -1237,4 +1237,20 @@ purple_media_candidates_prepared(PurpleM
return TRUE;
}
+gboolean
+purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, FsCodec *codec)
+{
+ PurpleMediaSession *session = purple_media_get_session(media, sess_id);
+ GError *err = NULL;
+
+ fs_session_set_send_codec(session->session, codec, &err);
+
+ if (err) {
+ purple_debug_error("media", "Error setting send codec\n");
+ g_error_free(err);
+ return FALSE;
+ }
+ return TRUE;
+}
+
#endif /* USE_VV */
============================================================
--- libpurple/media.h 08b3cb1921a757afed555e535277a1f3c7b9c8b4
+++ libpurple/media.h fa7d6013ba43279002d785d2c474142ec47d7c6a
@@ -147,6 +147,8 @@ gboolean purple_media_candidates_prepare
gboolean purple_media_candidates_prepared(PurpleMedia *media, const gchar *name);
+gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, FsCodec *codec);
+
G_END_DECLS
#endif /* USE_VV */
============================================================
--- libpurple/protocols/jabber/jingle.c 969b856746597607282da5e16debf2ca21005160
+++ libpurple/protocols/jabber/jingle.c eb1e83a5cb33fcb6cd062ce338704b24c0127a56
@@ -1196,6 +1196,10 @@ jabber_jingle_session_handle_session_acc
/* we have found a suitable codec, but we will not start the stream
just yet, wait for transport negotiation to complete... */
+ purple_media_set_send_codec(
+ jabber_jingle_session_get_media(session),
+ xmlnode_get_attrib(content, "name"),
+ codec_intersection->data);
}
/* if we also got transport candidates, add them to our streams
list of known remote candidates */
@@ -1288,6 +1292,8 @@ jabber_jingle_session_handle_session_ini
for (content = xmlnode_get_child(jingle, "content"); content;
content = xmlnode_get_next_twin(content)) {
+ GList *codec_intersection = NULL;
+
/* init media */
if (!content) {
purple_debug_error("jingle", "jingle tag must contain content tag\n");
@@ -1307,9 +1313,18 @@ jabber_jingle_session_handle_session_ini
purple_media_set_remote_codecs(session->media,
xmlnode_get_attrib(content, "name"),
initiator, codecs);
+
+ codec_intersection = purple_media_get_negotiated_codecs(session->media,
+ xmlnode_get_attrib(content, "name"));
purple_debug_info("jingle", "codec intersection: %i\n",
- g_list_length(purple_media_get_negotiated_codecs(session->media,
- xmlnode_get_attrib(content, "name"))));
+ g_list_length(codec_intersection));
+
+ if (g_list_length(codec_intersection) > 0) {
+ purple_media_set_send_codec(
+ jabber_jingle_session_get_media(session),
+ xmlnode_get_attrib(content, "name"),
+ codec_intersection->data);
+ }
}
jabber_iq_send(jabber_jingle_session_create_ack(session, jingle));
jabber_iq_send(jabber_jingle_session_create_session_info(session, "ringing"));
More information about the Commits
mailing list