Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/jingle/rtp.c @ 26187:836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 05 Feb 2009 23:30:48 +0000 |
parents | 4a245ffb4051 |
children | 9cda61a15698 |
rev | line source |
---|---|
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
1 /** |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file rtp.c |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
4 * purple |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
5 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
9 * (at your option) any later version. |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
10 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
15 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
19 */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
20 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
21 #include "config.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
22 |
26091
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26074
diff
changeset
|
23 #ifdef USE_VV |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26074
diff
changeset
|
24 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
25 #include "jabber.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
26 #include "jingle.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
27 #include "media.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
28 #include "mediamanager.h" |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
29 #include "iceudp.h" |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
30 #include "rawudp.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
31 #include "rtp.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
32 #include "session.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
33 #include "debug.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
34 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
35 #include <string.h> |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
36 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
37 struct _JingleRtpPrivate |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
38 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
39 gchar *media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
40 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
41 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
42 #define JINGLE_RTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RTP, JingleRtpPrivate)) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
43 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
44 static void jingle_rtp_class_init (JingleRtpClass *klass); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
45 static void jingle_rtp_init (JingleRtp *rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
46 static void jingle_rtp_finalize (GObject *object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
47 static void jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
48 static void jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
49 static JingleContent *jingle_rtp_parse_internal(xmlnode *rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
50 static xmlnode *jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
51 static void jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
52 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
53 static PurpleMedia *jingle_rtp_get_media(JingleSession *session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
54 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
55 static JingleContentClass *parent_class = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
56 #if 0 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
57 enum { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
58 LAST_SIGNAL |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
59 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
60 static guint jingle_rtp_signals[LAST_SIGNAL] = {0}; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
61 #endif |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
62 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
63 enum { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
64 PROP_0, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
65 PROP_MEDIA_TYPE, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
66 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
67 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
68 GType |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
69 jingle_rtp_get_type() |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
70 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
71 static GType type = 0; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
72 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
73 if (type == 0) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
74 static const GTypeInfo info = { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
75 sizeof(JingleRtpClass), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
76 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
77 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
78 (GClassInitFunc) jingle_rtp_class_init, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
79 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
80 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
81 sizeof(JingleRtp), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
82 0, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
83 (GInstanceInitFunc) jingle_rtp_init, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
84 NULL |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
85 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
86 type = g_type_register_static(JINGLE_TYPE_CONTENT, "JingleRtp", &info, 0); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
87 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
88 return type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
89 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
90 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
91 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
92 jingle_rtp_class_init (JingleRtpClass *klass) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
93 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
94 GObjectClass *gobject_class = (GObjectClass*)klass; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
95 parent_class = g_type_class_peek_parent(klass); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
96 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
97 gobject_class->finalize = jingle_rtp_finalize; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
98 gobject_class->set_property = jingle_rtp_set_property; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
99 gobject_class->get_property = jingle_rtp_get_property; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
100 klass->parent_class.to_xml = jingle_rtp_to_xml_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
101 klass->parent_class.parse = jingle_rtp_parse_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
102 klass->parent_class.description_type = JINGLE_APP_RTP; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
103 klass->parent_class.handle_action = jingle_rtp_handle_action_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
104 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
105 g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
106 g_param_spec_string("media-type", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
107 "Media Type", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
108 "The media type (\"audio\" or \"video\") for this rtp session.", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
109 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
110 G_PARAM_READWRITE)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
111 g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
112 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
113 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
114 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
115 jingle_rtp_init (JingleRtp *rtp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
116 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
117 rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
118 memset(rtp->priv, 0, sizeof(rtp->priv)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
119 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
120 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
121 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
122 jingle_rtp_finalize (GObject *rtp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
123 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
124 JingleRtpPrivate *priv = JINGLE_RTP_GET_PRIVATE(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
125 purple_debug_info("jingle-rtp","jingle_rtp_finalize\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
126 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
127 g_free(priv->media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
128 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
129 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
130 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
131 jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
132 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
133 JingleRtp *rtp; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
134 g_return_if_fail(JINGLE_IS_RTP(object)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
135 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
136 rtp = JINGLE_RTP(object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
137 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
138 switch (prop_id) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
139 case PROP_MEDIA_TYPE: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
140 g_free(rtp->priv->media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
141 rtp->priv->media_type = g_value_dup_string(value); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
142 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
143 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
144 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
145 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
146 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
147 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
148 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
149 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
150 jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
151 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
152 JingleRtp *rtp; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
153 g_return_if_fail(JINGLE_IS_RTP(object)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
154 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
155 rtp = JINGLE_RTP(object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
156 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
157 switch (prop_id) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
158 case PROP_MEDIA_TYPE: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
159 g_value_set_string(value, rtp->priv->media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
160 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
161 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
162 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
163 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
164 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
165 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
166 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
167 gchar * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
168 jingle_rtp_get_media_type(JingleContent *content) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
169 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
170 gchar *media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
171 g_object_get(content, "media-type", &media_type, NULL); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
172 return media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
173 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
174 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
175 static PurpleMedia * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
176 jingle_rtp_get_media(JingleSession *session) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
177 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
178 JabberStream *js = jingle_session_get_js(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
179 gchar *sid = jingle_session_get_sid(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
180 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
181 PurpleMedia *media = (PurpleMedia *) (js->medias) ? |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
182 g_hash_table_lookup(js->medias, sid) : NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
183 g_free(sid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
184 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
185 return media; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
186 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
187 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
188 static JingleTransport * |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
189 jingle_rtp_candidates_to_transport(JingleSession *session, GType type, guint generation, GList *candidates) |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
190 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
191 if (type == JINGLE_TYPE_RAWUDP) { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
192 JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_RAWUDP); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
193 JingleRawUdpCandidate *rawudp_candidate; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
194 for (; candidates; candidates = g_list_next(candidates)) { |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
195 PurpleMediaCandidate *candidate = candidates->data; |
26180 | 196 gchar *id = jabber_get_next_id( |
197 jingle_session_get_js(session)); | |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
198 rawudp_candidate = jingle_rawudp_candidate_new(id, |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
199 generation, candidate->component_id, |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
200 candidate->ip, candidate->port); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
201 jingle_rawudp_add_local_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); |
26180 | 202 g_free(id); |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
203 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
204 return transport; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
205 } else if (type == JINGLE_TYPE_ICEUDP) { |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
206 JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
207 JingleIceUdpCandidate *iceudp_candidate; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
208 for (; candidates; candidates = g_list_next(candidates)) { |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
209 PurpleMediaCandidate *candidate = candidates->data; |
26179
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
210 gchar *id = jabber_get_next_id( |
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
211 jingle_session_get_js(session)); |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
212 iceudp_candidate = jingle_iceudp_candidate_new(candidate->component_id, |
26179
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
213 candidate->foundation, generation, id, candidate->ip, |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
214 0, candidate->port, candidate->priority, "udp", |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
215 candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
216 candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
217 candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
218 candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : "", |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
219 candidate->username, candidate->password); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
220 jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); |
26179
84ea07648377
Add the id attribute to ice-udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26162
diff
changeset
|
221 g_free(id); |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
222 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
223 return transport; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
224 } else { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
225 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
226 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
227 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
228 |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
229 static GList * |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
230 jingle_rtp_transport_to_candidates(JingleTransport *transport) |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
231 { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
232 const gchar *type = jingle_transport_get_transport_type(transport); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
233 GList *ret = NULL; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
234 if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) { |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
235 GList *candidates = jingle_rawudp_get_remote_candidates(JINGLE_RAWUDP(transport)); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
236 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
237 for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
238 JingleRawUdpCandidate *candidate = candidates->data; |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
239 ret = g_list_append(ret, purple_media_candidate_new( |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
240 "", candidate->component, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
241 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
242 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
243 candidate->ip, candidate->port)); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
244 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
245 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
246 return ret; |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
247 } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
248 GList *candidates = jingle_iceudp_get_remote_candidates(JINGLE_ICEUDP(transport)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
249 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
250 for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
251 JingleIceUdpCandidate *candidate = candidates->data; |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
252 PurpleMediaCandidate *new_candidate = purple_media_candidate_new( |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
253 candidate->foundation, candidate->component, |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
254 !strcmp(candidate->type, "host") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
255 PURPLE_MEDIA_CANDIDATE_TYPE_HOST : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
256 !strcmp(candidate->type, "srflx") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
257 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
258 !strcmp(candidate->type, "prflx") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
259 PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
260 !strcmp(candidate->type, "relay") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
261 PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
262 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
263 candidate->ip, candidate->port); |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
264 new_candidate->username = g_strdup(candidate->username); |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
265 new_candidate->password = g_strdup(candidate->password); |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
266 new_candidate->priority = candidate->priority; |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
267 ret = g_list_append(ret, new_candidate); |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
268 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
269 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
270 return ret; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
271 } else { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
272 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
273 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
274 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
275 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
276 static void |
26142
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
277 jingle_rtp_accepted_cb(PurpleMedia *media, gchar *sid, gchar *name, |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
278 JingleSession *session) |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
279 { |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
280 purple_debug_info("jingle-rtp", "jingle_rtp_accepted_cb\n"); |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
281 } |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
282 |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
283 static void |
26141
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
284 jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
285 JingleSession *session) |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
286 { |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
287 purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
288 "session_id: %s jingle_session: %p\n", sid, session); |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
289 } |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
290 |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
291 static void |
26103
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26099
diff
changeset
|
292 jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
293 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
294 purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
295 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
296 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
297 static void |
26187
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
298 jingle_rtp_initiate_ack_cb(JabberStream *js, xmlnode *packet, gpointer data) |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
299 { |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
300 JingleSession *session = data; |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
301 |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
302 if (!strcmp(xmlnode_get_attrib(packet, "type"), "error") || |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
303 xmlnode_get_child(packet, "error")) { |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
304 gchar *sid = jingle_session_get_sid(session); |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
305 purple_media_end(jingle_rtp_get_media(session), NULL, NULL); |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
306 g_hash_table_remove(jingle_session_get_js( |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
307 session)->medias, sid); |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
308 g_free(sid); |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
309 return; |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
310 } |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
311 |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
312 jabber_iq_send(jingle_session_to_packet(session, |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
313 JINGLE_TRANSPORT_INFO)); |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
314 } |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
315 |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
316 static void |
26066
607d82dce00e
Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26065
diff
changeset
|
317 jingle_rtp_ready_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session) |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
318 { |
26066
607d82dce00e
Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26065
diff
changeset
|
319 purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
320 |
26067
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
321 if (sid == NULL && name == NULL) { |
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
322 if (jingle_session_is_initiator(session) == TRUE) { |
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
323 GList *contents = jingle_session_get_contents(session); |
26187
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
324 JabberIq *iq = jingle_session_to_packet( |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
325 session, JINGLE_SESSION_INITIATE); |
26066
607d82dce00e
Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26065
diff
changeset
|
326 |
26187
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
327 if (contents->data) { |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
328 JingleTransport *transport = |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
329 jingle_content_get_transport(contents->data); |
26067
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
330 if (JINGLE_IS_ICEUDP(transport)) |
26187
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
331 jabber_iq_set_callback(iq, |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
332 jingle_rtp_initiate_ack_cb, session); |
26067
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
333 } |
26187
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
334 |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26180
diff
changeset
|
335 jabber_iq_send(iq); |
26067
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
336 } else { |
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
337 jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO)); |
b0e6a64cbf2e
Use the new ready signal instead of accept to send a session-accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26066
diff
changeset
|
338 jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT)); |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
339 } |
26072
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
340 } else if (sid != NULL && name != NULL) { |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
341 JingleContent *content = jingle_session_find_content(session, sid, "initiator"); |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
342 JingleTransport *oldtransport = jingle_content_get_transport(content); |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
343 GList *candidates = purple_media_get_local_candidates(media, sid, name); |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
344 JingleTransport *transport = |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
345 JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport( |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
346 session, JINGLE_IS_RAWUDP(oldtransport) ? |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
347 JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP, |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
348 0, candidates)); |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
349 g_list_free(candidates); |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
350 |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
351 jingle_content_set_pending_transport(content, transport); |
266c3cc02e0e
Move functionality to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26071
diff
changeset
|
352 jingle_content_accept_transport(content); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
353 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
354 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
355 |
26069
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
356 static void |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
357 jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaStateChangedType type, |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
358 gchar *sid, gchar *name, JingleSession *session) |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
359 { |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
360 purple_debug_info("jingle-rtp", "state-changed: type %d id: %s name: %s\n", type, sid, name); |
26070
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
361 |
26111
8b16e5fcaa32
Added reject and hangup states to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26106
diff
changeset
|
362 if ((type == PURPLE_MEDIA_STATE_CHANGED_REJECTED || |
8b16e5fcaa32
Added reject and hangup states to the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26106
diff
changeset
|
363 type == PURPLE_MEDIA_STATE_CHANGED_HANGUP) && |
26071
8dba34f5f21a
Temporarily fix an oversight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26070
diff
changeset
|
364 sid == NULL && name == NULL) { |
26070
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
365 gchar *sid = jingle_session_get_sid(session); |
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
366 jabber_iq_send(jingle_session_to_packet(session, |
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
367 JINGLE_SESSION_TERMINATE)); |
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
368 g_hash_table_remove(jingle_session_get_js(session)->medias, sid); |
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
369 g_free(sid); |
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
370 g_object_unref(session); |
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26069
diff
changeset
|
371 } |
26069
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
372 } |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
373 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
374 static PurpleMedia * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
375 jingle_rtp_create_media(JingleContent *content) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
376 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
377 JingleSession *session = jingle_content_get_session(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
378 JabberStream *js = jingle_session_get_js(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
379 gchar *remote_jid = jingle_session_get_remote_jid(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
380 gchar *sid = jingle_session_get_sid(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
381 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
382 PurpleMedia *media = purple_media_manager_create_media(purple_media_manager_get(), |
26063
c7d4b67b3332
Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26046
diff
changeset
|
383 js->gc, "fsrtpconference", remote_jid, |
c7d4b67b3332
Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26046
diff
changeset
|
384 jingle_session_is_initiator(session)); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
385 g_free(remote_jid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
386 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
387 if (!media) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
388 purple_debug_error("jingle-rtp", "Couldn't create media session\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
389 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
390 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
391 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
392 /* insert it into the hash table */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
393 if (!js->medias) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
394 purple_debug_info("jingle-rtp", "Creating hash table for media\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
395 js->medias = g_hash_table_new(g_str_hash, g_str_equal); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
396 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
397 purple_debug_info("jingle-rtp", "inserting media with sid: %s into table\n", sid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
398 g_hash_table_insert(js->medias, sid, media); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
399 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
400 /* connect callbacks */ |
26142
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
401 g_signal_connect(G_OBJECT(media), "accepted", |
5b64b7d8da39
Added the accepted signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26141
diff
changeset
|
402 G_CALLBACK(jingle_rtp_accepted_cb), session); |
26141
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
403 g_signal_connect(G_OBJECT(media), "codecs-changed", |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26140
diff
changeset
|
404 G_CALLBACK(jingle_rtp_codecs_changed_cb), session); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
405 g_signal_connect(G_OBJECT(media), "new-candidate", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
406 G_CALLBACK(jingle_rtp_new_candidate_cb), session); |
26065
7caa7e2ce870
Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26063
diff
changeset
|
407 g_signal_connect(G_OBJECT(media), "ready-new", |
26066
607d82dce00e
Have XMPP use the new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26065
diff
changeset
|
408 G_CALLBACK(jingle_rtp_ready_cb), session); |
26069
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
409 g_signal_connect(G_OBJECT(media), "state-changed", |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26068
diff
changeset
|
410 G_CALLBACK(jingle_rtp_state_changed_cb), session); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
411 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
412 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
413 return media; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
414 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
415 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
416 static gboolean |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
417 jingle_rtp_init_media(JingleContent *content) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
418 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
419 JingleSession *session = jingle_content_get_session(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
420 PurpleMedia *media = jingle_rtp_get_media(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
421 gchar *media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
422 gchar *remote_jid; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
423 gchar *senders; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
424 gchar *name; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
425 const gchar *transmitter; |
26099
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
426 gboolean is_audio; |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
427 PurpleMediaSessionType type; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
428 JingleTransport *transport; |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26142
diff
changeset
|
429 GParameter *params = NULL; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26142
diff
changeset
|
430 guint num_params; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
431 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
432 /* maybe this create ought to just be in initiate and handle initiate */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
433 if (media == NULL) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
434 media = jingle_rtp_create_media(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
435 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
436 if (media == NULL) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
437 return FALSE; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
438 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
439 name = jingle_content_get_name(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
440 media_type = jingle_rtp_get_media_type(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
441 remote_jid = jingle_session_get_remote_jid(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
442 senders = jingle_content_get_senders(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
443 transport = jingle_content_get_transport(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
444 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
445 if (JINGLE_IS_RAWUDP(transport)) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
446 transmitter = "rawudp"; |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
447 else if (JINGLE_IS_ICEUDP(transport)) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
448 transmitter = "nice"; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
449 else |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
450 transmitter = "notransmitter"; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
451 |
26099
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
452 is_audio = !strcmp(media_type, "audio"); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
453 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
454 if (!strcmp(senders, "both")) |
26099
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
455 type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
456 : PURPLE_MEDIA_VIDEO; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
457 else if (!strcmp(senders, "initiator") |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
458 && jingle_session_is_initiator(session)) |
26099
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
459 type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
460 : PURPLE_MEDIA_SEND_VIDEO; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
461 else |
26099
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
462 type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26091
diff
changeset
|
463 : PURPLE_MEDIA_RECV_VIDEO; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
464 |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26142
diff
changeset
|
465 params = |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26142
diff
changeset
|
466 jingle_get_params(jingle_session_get_js(session), &num_params); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
467 purple_media_add_stream(media, name, remote_jid, |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26142
diff
changeset
|
468 type, transmitter, num_params, params); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
469 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
470 g_free(name); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
471 g_free(media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
472 g_free(remote_jid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
473 g_free(senders); |
26162
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26142
diff
changeset
|
474 g_free(params); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
475 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
476 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
477 return TRUE; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
478 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
479 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
480 static GList * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
481 jingle_rtp_parse_codecs(xmlnode *description) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
482 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
483 GList *codecs = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
484 xmlnode *codec_element = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
485 const char *encoding_name,*id, *clock_rate; |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
486 PurpleMediaCodec *codec; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
487 const gchar *media = xmlnode_get_attrib(description, "media"); |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
488 PurpleMediaSessionType type = |
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
489 !strcmp(media, "video") ? PURPLE_MEDIA_VIDEO : |
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
490 !strcmp(media, "audio") ? PURPLE_MEDIA_AUDIO : 0; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
491 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
492 for (codec_element = xmlnode_get_child(description, "payload-type") ; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
493 codec_element ; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
494 codec_element = xmlnode_get_next_twin(codec_element)) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
495 xmlnode *param; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
496 gchar *codec_str; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
497 encoding_name = xmlnode_get_attrib(codec_element, "name"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
498 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
499 id = xmlnode_get_attrib(codec_element, "id"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
500 clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
501 |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
502 codec = purple_media_codec_new(atoi(id), encoding_name, |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
503 type, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
504 clock_rate ? atoi(clock_rate) : 0); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
505 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
506 for (param = xmlnode_get_child(codec_element, "parameter"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
507 param; param = xmlnode_get_next_twin(param)) { |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
508 purple_media_codec_add_optional_parameter(codec, |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
509 xmlnode_get_attrib(param, "name"), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
510 xmlnode_get_attrib(param, "value")); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
511 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
512 |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
513 codec_str = purple_media_codec_to_string(codec); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
514 purple_debug_info("jingle-rtp", "received codec: %s\n", codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
515 g_free(codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
516 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
517 codecs = g_list_append(codecs, codec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
518 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
519 return codecs; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
520 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
521 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
522 static JingleContent * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
523 jingle_rtp_parse_internal(xmlnode *rtp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
524 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
525 JingleContent *content = parent_class->parse(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
526 xmlnode *description = xmlnode_get_child(rtp, "description"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
527 const gchar *media_type = xmlnode_get_attrib(description, "media"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
528 purple_debug_info("jingle-rtp", "rtp parse\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
529 g_object_set(content, "media-type", media_type, NULL); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
530 return content; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
531 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
532 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
533 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
534 jingle_rtp_add_payloads(xmlnode *description, GList *codecs) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
535 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
536 for (; codecs ; codecs = codecs->next) { |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
537 PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
538 GList *iter = codec->optional_params; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
539 char id[8], clockrate[10], channels[10]; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
540 gchar *codec_str; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
541 xmlnode *payload = xmlnode_new_child(description, "payload-type"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
542 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
543 g_snprintf(id, sizeof(id), "%d", codec->id); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
544 g_snprintf(clockrate, sizeof(clockrate), "%d", codec->clock_rate); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
545 g_snprintf(channels, sizeof(channels), "%d", codec->channels); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
546 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
547 xmlnode_set_attrib(payload, "name", codec->encoding_name); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
548 xmlnode_set_attrib(payload, "id", id); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
549 xmlnode_set_attrib(payload, "clockrate", clockrate); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
550 xmlnode_set_attrib(payload, "channels", channels); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
551 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
552 for (; iter; iter = g_list_next(iter)) { |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
553 PurpleMediaCodecParameter *mparam = iter->data; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
554 xmlnode *param = xmlnode_new_child(payload, "parameter"); |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
555 xmlnode_set_attrib(param, "name", mparam->name); |
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
556 xmlnode_set_attrib(param, "value", mparam->value); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
557 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
558 |
26106
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26103
diff
changeset
|
559 codec_str = purple_media_codec_to_string(codec); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
560 purple_debug_info("jingle", "adding codec: %s\n", codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
561 g_free(codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
562 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
563 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
564 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
565 static xmlnode * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
566 jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
567 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
568 xmlnode *node = parent_class->to_xml(rtp, content, action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
569 xmlnode *description = xmlnode_get_child(node, "description"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
570 if (description != NULL) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
571 JingleSession *session = jingle_content_get_session(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
572 PurpleMedia *media = jingle_rtp_get_media(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
573 gchar *media_type = jingle_rtp_get_media_type(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
574 gchar *name = jingle_content_get_name(rtp); |
26036
a5f1804fcb4b
Combine get_*_codecs functions to mirror Farsight 2.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26032
diff
changeset
|
575 GList *codecs = purple_media_get_codecs(media, name); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
576 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
577 xmlnode_set_attrib(description, "media", media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
578 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
579 g_free(media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
580 g_free(name); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
581 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
582 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
583 jingle_rtp_add_payloads(description, codecs); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
584 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
585 return node; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
586 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
587 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
588 static void |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
589 jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
590 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
591 switch (action) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
592 case JINGLE_SESSION_ACCEPT: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
593 JingleSession *session = jingle_content_get_session(content); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
594 xmlnode *description = xmlnode_get_child(xmlcontent, "description"); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
595 GList *codecs = jingle_rtp_parse_codecs(description); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
596 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
597 purple_media_set_remote_codecs(jingle_rtp_get_media(session), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
598 jingle_content_get_name(content), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
599 jingle_session_get_remote_jid(session), codecs); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
600 |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
601 /* This needs to be for the entire session, not a single content */ |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
602 /* very hacky */ |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
603 if (xmlnode_get_next_twin(xmlcontent) == NULL) |
26122
5d9a97a23d6e
Remove some of the deprecated API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26111
diff
changeset
|
604 purple_media_accept(jingle_rtp_get_media(session)); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
605 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
606 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
607 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
608 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
609 case JINGLE_SESSION_INITIATE: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
610 JingleSession *session = jingle_content_get_session(content); |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
611 JingleTransport *transport = jingle_transport_parse( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
612 xmlnode_get_child(xmlcontent, "transport")); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
613 xmlnode *description = xmlnode_get_child(xmlcontent, "description"); |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
614 GList *candidates = jingle_rtp_transport_to_candidates(transport); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
615 GList *codecs = jingle_rtp_parse_codecs(description); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
616 |
26032
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
617 if (jingle_rtp_init_media(content) == FALSE) { |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
618 /* XXX: send error */ |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
619 jabber_iq_send(jingle_session_to_packet(session, |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
620 JINGLE_SESSION_TERMINATE)); |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
621 g_object_unref(session); |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
622 break; |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26030
diff
changeset
|
623 } |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
624 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
625 purple_media_set_remote_codecs(jingle_rtp_get_media(session), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
626 jingle_content_get_name(content), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
627 jingle_session_get_remote_jid(session), codecs); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
628 |
26042
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
629 if (JINGLE_IS_RAWUDP(transport)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
630 purple_media_add_remote_candidates(jingle_rtp_get_media(session), |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
631 jingle_content_get_name(content), |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
632 jingle_session_get_remote_jid(session), |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
633 candidates); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26037
diff
changeset
|
634 } |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
635 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
636 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
637 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
638 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
639 case JINGLE_SESSION_TERMINATE: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
640 JingleSession *session = jingle_content_get_session(content); |
26068
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
641 PurpleMedia *media = jingle_rtp_get_media(session); |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
642 |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
643 if (media != NULL) { |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
644 gchar *sid = jingle_session_get_sid(session); |
26140
ac56e5707a72
Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26122
diff
changeset
|
645 purple_media_end(media, NULL, NULL); |
26068
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
646 g_hash_table_remove(jingle_session_get_js( |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
647 session)->medias, sid); |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
648 g_free(sid); |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
649 } |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26067
diff
changeset
|
650 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
651 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
652 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
653 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
654 case JINGLE_TRANSPORT_INFO: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
655 JingleSession *session = jingle_content_get_session(content); |
26030
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
656 JingleTransport *transport = jingle_transport_parse( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
657 xmlnode_get_child(xmlcontent, "transport")); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26025
diff
changeset
|
658 GList *candidates = jingle_rtp_transport_to_candidates(transport); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
659 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
660 purple_media_add_remote_candidates(jingle_rtp_get_media(session), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
661 jingle_content_get_name(content), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
662 jingle_session_get_remote_jid(session), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
663 candidates); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
664 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
665 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
666 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
667 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
668 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
669 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
670 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
671 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
672 PurpleMedia * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
673 jingle_rtp_initiate_media(JabberStream *js, const gchar *who, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
674 PurpleMediaSessionType type) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
675 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
676 /* create content negotiation */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
677 JingleSession *session; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
678 JingleContent *content; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
679 JingleTransport *transport; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
680 JabberBuddy *jb; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
681 JabberBuddyResource *jbr; |
26037
403453f8b643
Fix a few GLib warnings when trying to start a second media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26036
diff
changeset
|
682 PurpleMedia *media; |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
683 const gchar *transport_type; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
684 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
685 gchar *jid = NULL, *me = NULL, *sid = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
686 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
687 /* construct JID to send to */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
688 jb = jabber_buddy_find(js, who, FALSE); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
689 if (!jb) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
690 purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
691 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
692 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
693 jbr = jabber_buddy_find_resource(jb, NULL); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
694 if (!jbr) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
695 purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
696 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
697 |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
698 if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
699 transport_type = JINGLE_TRANSPORT_ICEUDP; |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
700 } else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_RAWUDP)) { |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
701 transport_type = JINGLE_TRANSPORT_RAWUDP; |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
702 } else { |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
703 purple_debug_error("jingle-rtp", "Resource doesn't support " |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
704 "the same transport types\n"); |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
705 return NULL; |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
706 } |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
707 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
708 if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
709 jid = g_strdup_printf("%s/%s", who, jbr->name); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
710 } else { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
711 jid = g_strdup(who); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
712 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
713 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
714 /* set ourselves as initiator */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
715 me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
716 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
717 sid = jabber_get_next_id(js); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
718 session = jingle_session_create(js, sid, me, jid, TRUE); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
719 g_free(sid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
720 |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
721 |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
722 if (type & PURPLE_MEDIA_AUDIO) { |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
723 transport = jingle_transport_create(transport_type); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
724 content = jingle_content_create(JINGLE_APP_RTP, "initiator", |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
725 "session", "audio-session", "both", transport); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
726 jingle_session_add_content(session, content); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
727 JINGLE_RTP(content)->priv->media_type = g_strdup("audio"); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
728 jingle_rtp_init_media(content); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
729 } |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
730 if (type & PURPLE_MEDIA_VIDEO) { |
26046
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26042
diff
changeset
|
731 transport = jingle_transport_create(transport_type); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
732 content = jingle_content_create(JINGLE_APP_RTP, "initiator", |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
733 "session", "video-session", "both", transport); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
734 jingle_session_add_content(session, content); |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
735 JINGLE_RTP(content)->priv->media_type = g_strdup("video"); |
26025
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
736 jingle_rtp_init_media(content); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26023
diff
changeset
|
737 } |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
738 |
26037
403453f8b643
Fix a few GLib warnings when trying to start a second media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26036
diff
changeset
|
739 if ((media = jingle_rtp_get_media(session)) == NULL) { |
403453f8b643
Fix a few GLib warnings when trying to start a second media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26036
diff
changeset
|
740 return NULL; |
403453f8b643
Fix a few GLib warnings when trying to start a second media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26036
diff
changeset
|
741 } |
403453f8b643
Fix a few GLib warnings when trying to start a second media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26036
diff
changeset
|
742 |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
743 g_free(jid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
744 g_free(me); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
745 |
26037
403453f8b643
Fix a few GLib warnings when trying to start a second media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26036
diff
changeset
|
746 return media; |
26023
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
747 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
748 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
749 void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
750 jingle_rtp_terminate_session(JabberStream *js, const gchar *who) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
751 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
752 JingleSession *session; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
753 /* XXX: This may cause file transfers and xml sessions to stop as well */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
754 session = jingle_session_find_by_jid(js, who); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
755 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
756 if (session) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
757 PurpleMedia *media = jingle_rtp_get_media(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
758 if (media) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
759 purple_debug_info("jingle-rtp", "hanging up media\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
760 purple_media_hangup(media); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
761 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
762 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
763 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
764 |
26091
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26074
diff
changeset
|
765 #endif /* USE_VV */ |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26074
diff
changeset
|
766 |