Sat, 21 Mar 2009 00:34:29 +0000
Use stream-info instead of state-changed for hangup and reject.
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
2 | * @file rtp.c |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
4 | * purple |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
5 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or modify |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
7 | * it under the terms of the GNU General Public License as published by |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
8 | * the Free Software Foundation; either version 2 of the License, or |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
9 | * (at your option) any later version. |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
10 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
11 | * This program is distributed in the hope that it will be useful, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
14 | * GNU General Public License for more details. |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
15 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
17 | * along with this program; if not, write to the Free Software |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
19 | */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
20 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
21 | #include "config.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
22 | |
|
26215
9ecaa256d77b
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26198
diff
changeset
|
23 | #ifdef USE_VV |
|
9ecaa256d77b
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26198
diff
changeset
|
24 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
25 | #include "jabber.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
26 | #include "jingle.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
27 | #include "media.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
28 | #include "mediamanager.h" |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
29 | #include "iceudp.h" |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
30 | #include "rawudp.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
31 | #include "rtp.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
32 | #include "session.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
33 | #include "debug.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
34 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
35 | #include <string.h> |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
36 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
37 | struct _JingleRtpPrivate |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
38 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
39 | gchar *media_type; |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
40 | gchar *ssrc; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
41 | }; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
42 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
43 | #define JINGLE_RTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RTP, JingleRtpPrivate)) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
44 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
45 | static void jingle_rtp_class_init (JingleRtpClass *klass); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
46 | static void jingle_rtp_init (JingleRtp *rtp); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
47 | static void jingle_rtp_finalize (GObject *object); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
48 | static void jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
49 | static void jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
50 | static JingleContent *jingle_rtp_parse_internal(xmlnode *rtp); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
51 | static xmlnode *jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
52 | static void jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
53 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
54 | static PurpleMedia *jingle_rtp_get_media(JingleSession *session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
55 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
56 | static JingleContentClass *parent_class = NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
57 | #if 0 |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
58 | enum { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
59 | LAST_SIGNAL |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
60 | }; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
61 | static guint jingle_rtp_signals[LAST_SIGNAL] = {0}; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
62 | #endif |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
63 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
64 | enum { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
65 | PROP_0, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
66 | PROP_MEDIA_TYPE, |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
67 | PROP_SSRC, |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
68 | }; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
69 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
70 | GType |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
71 | jingle_rtp_get_type() |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
72 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
73 | static GType type = 0; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
74 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
75 | if (type == 0) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
76 | static const GTypeInfo info = { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
77 | sizeof(JingleRtpClass), |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
78 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
79 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
80 | (GClassInitFunc) jingle_rtp_class_init, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
81 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
82 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
83 | sizeof(JingleRtp), |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
84 | 0, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
85 | (GInstanceInitFunc) jingle_rtp_init, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
86 | NULL |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
87 | }; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
88 | type = g_type_register_static(JINGLE_TYPE_CONTENT, "JingleRtp", &info, 0); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
89 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
90 | return type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
91 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
92 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
93 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
94 | jingle_rtp_class_init (JingleRtpClass *klass) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
95 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
96 | GObjectClass *gobject_class = (GObjectClass*)klass; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
97 | parent_class = g_type_class_peek_parent(klass); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
98 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
99 | gobject_class->finalize = jingle_rtp_finalize; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
100 | gobject_class->set_property = jingle_rtp_set_property; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
101 | gobject_class->get_property = jingle_rtp_get_property; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
102 | klass->parent_class.to_xml = jingle_rtp_to_xml_internal; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
103 | klass->parent_class.parse = jingle_rtp_parse_internal; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
104 | klass->parent_class.description_type = JINGLE_APP_RTP; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
105 | klass->parent_class.handle_action = jingle_rtp_handle_action_internal; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
106 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
107 | g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
108 | g_param_spec_string("media-type", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
109 | "Media Type", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
110 | "The media type (\"audio\" or \"video\") for this rtp session.", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
111 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
112 | G_PARAM_READWRITE)); |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
113 | g_object_class_install_property(gobject_class, PROP_SSRC, |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
114 | g_param_spec_string("ssrc", |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
115 | "ssrc", |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
116 | "The ssrc for this rtp session.", |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
117 | NULL, |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
118 | G_PARAM_READWRITE)); |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
119 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
120 | g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
121 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
122 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
123 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
124 | jingle_rtp_init (JingleRtp *rtp) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
125 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
126 | rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp); |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
127 | memset(rtp->priv, 0, sizeof(*rtp->priv)); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
128 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
129 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
130 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
131 | jingle_rtp_finalize (GObject *rtp) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
132 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
133 | JingleRtpPrivate *priv = JINGLE_RTP_GET_PRIVATE(rtp); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
134 | purple_debug_info("jingle-rtp","jingle_rtp_finalize\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
135 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
136 | g_free(priv->media_type); |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
137 | g_free(priv->ssrc); |
|
26410
5952dcb9ce6c
Plug some memory leaks related to transports.
Michael Ruprecht <maiku@pidgin.im>
parents:
26407
diff
changeset
|
138 | |
|
5952dcb9ce6c
Plug some memory leaks related to transports.
Michael Ruprecht <maiku@pidgin.im>
parents:
26407
diff
changeset
|
139 | G_OBJECT_CLASS(parent_class)->finalize(rtp); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
140 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
141 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
142 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
143 | jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
144 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
145 | JingleRtp *rtp; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
146 | g_return_if_fail(JINGLE_IS_RTP(object)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
147 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
148 | rtp = JINGLE_RTP(object); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
149 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
150 | switch (prop_id) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
151 | case PROP_MEDIA_TYPE: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
152 | g_free(rtp->priv->media_type); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
153 | rtp->priv->media_type = g_value_dup_string(value); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
154 | break; |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
155 | case PROP_SSRC: |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
156 | g_free(rtp->priv->ssrc); |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
157 | rtp->priv->ssrc = g_value_dup_string(value); |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
158 | break; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
159 | default: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
160 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
161 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
162 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
163 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
164 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
165 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
166 | jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
167 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
168 | JingleRtp *rtp; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
169 | g_return_if_fail(JINGLE_IS_RTP(object)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
170 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
171 | rtp = JINGLE_RTP(object); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
172 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
173 | switch (prop_id) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
174 | case PROP_MEDIA_TYPE: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
175 | g_value_set_string(value, rtp->priv->media_type); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
176 | break; |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
177 | case PROP_SSRC: |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
178 | g_value_set_string(value, rtp->priv->ssrc); |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
179 | break; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
180 | default: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
181 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
182 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
183 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
184 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
185 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
186 | gchar * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
187 | jingle_rtp_get_media_type(JingleContent *content) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
188 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
189 | gchar *media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
190 | g_object_get(content, "media-type", &media_type, NULL); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
191 | return media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
192 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
193 | |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
194 | gchar * |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
195 | jingle_rtp_get_ssrc(JingleContent *content) |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
196 | { |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
197 | gchar *ssrc; |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
198 | g_object_get(content, "ssrc", &ssrc, NULL); |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
199 | return ssrc; |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
200 | } |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
201 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
202 | static PurpleMedia * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
203 | jingle_rtp_get_media(JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
204 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
205 | JabberStream *js = jingle_session_get_js(session); |
|
26330
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
206 | PurpleMedia *media = NULL; |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
207 | GList *iter = purple_media_manager_get_media_by_connection( |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
208 | purple_media_manager_get(), js->gc); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
209 | |
|
26330
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
210 | for (; iter; iter = g_list_delete_link(iter, iter)) { |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
211 | JingleSession *media_session = |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
212 | purple_media_get_prpl_data(iter->data); |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
213 | if (media_session == session) { |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
214 | media = iter->data; |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
215 | break; |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
216 | } |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
217 | } |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
218 | if (iter != NULL) |
|
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
219 | g_list_free(iter); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
220 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
221 | return media; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
222 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
223 | |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
224 | static JingleRawUdpCandidate * |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
225 | jingle_rtp_candidate_to_rawudp(JingleSession *session, guint generation, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
226 | PurpleMediaCandidate *candidate) |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
227 | { |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
228 | gchar *id = jabber_get_next_id(jingle_session_get_js(session)); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
229 | JingleRawUdpCandidate *rawudp_candidate = |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
230 | jingle_rawudp_candidate_new(id, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
231 | generation, candidate->component_id, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
232 | candidate->ip, candidate->port); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
233 | g_free(id); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
234 | return rawudp_candidate; |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
235 | } |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
236 | |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
237 | static JingleIceUdpCandidate * |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
238 | jingle_rtp_candidate_to_iceudp(JingleSession *session, guint generation, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
239 | PurpleMediaCandidate *candidate) |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
240 | { |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
241 | gchar *id = jabber_get_next_id(jingle_session_get_js(session)); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
242 | JingleIceUdpCandidate *iceudp_candidate = jingle_iceudp_candidate_new( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
243 | candidate->component_id, candidate->foundation, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
244 | generation, id, candidate->ip, 0, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
245 | candidate->port, candidate->priority, "udp", |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
246 | candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" : |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
247 | candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" : |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
248 | candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" : |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
249 | candidate->type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : "", |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
250 | candidate->username, candidate->password); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
251 | iceudp_candidate->reladdr = g_strdup(candidate->base_ip); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
252 | iceudp_candidate->relport = candidate->base_port; |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
253 | g_free(id); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
254 | return iceudp_candidate; |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
255 | } |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
256 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
257 | static JingleTransport * |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
258 | jingle_rtp_candidates_to_transport(JingleSession *session, GType type, guint generation, GList *candidates) |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
259 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
260 | if (type == JINGLE_TYPE_RAWUDP) { |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
261 | JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_RAWUDP); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
262 | JingleRawUdpCandidate *rawudp_candidate; |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
263 | for (; candidates; candidates = g_list_next(candidates)) { |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
264 | PurpleMediaCandidate *candidate = candidates->data; |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
265 | rawudp_candidate = jingle_rtp_candidate_to_rawudp( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
266 | session, generation, candidate); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
267 | jingle_rawudp_add_local_candidate( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
268 | JINGLE_RAWUDP(transport), |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
269 | rawudp_candidate); |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
270 | } |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
271 | return transport; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
272 | } else if (type == JINGLE_TYPE_ICEUDP) { |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
273 | JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
274 | JingleIceUdpCandidate *iceudp_candidate; |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
275 | for (; candidates; candidates = g_list_next(candidates)) { |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
276 | PurpleMediaCandidate *candidate = candidates->data; |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
277 | iceudp_candidate = jingle_rtp_candidate_to_iceudp( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
278 | session, generation, candidate); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
279 | jingle_iceudp_add_local_candidate( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
280 | JINGLE_ICEUDP(transport), |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
281 | iceudp_candidate); |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
282 | } |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
283 | return transport; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
284 | } else { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
285 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
286 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
287 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
288 | |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
289 | static GList * |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
290 | jingle_rtp_transport_to_candidates(JingleTransport *transport) |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
291 | { |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
292 | const gchar *type = jingle_transport_get_transport_type(transport); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
293 | GList *ret = NULL; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
294 | if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) { |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
295 | GList *candidates = jingle_rawudp_get_remote_candidates(JINGLE_RAWUDP(transport)); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
296 | |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
297 | for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
298 | JingleRawUdpCandidate *candidate = candidates->data; |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
299 | ret = g_list_append(ret, purple_media_candidate_new( |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
300 | "", candidate->component, |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
301 | PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
302 | PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
303 | candidate->ip, candidate->port)); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
304 | } |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
305 | |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
306 | return ret; |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
307 | } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) { |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
308 | GList *candidates = jingle_iceudp_get_remote_candidates(JINGLE_ICEUDP(transport)); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
309 | |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
310 | for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
311 | JingleIceUdpCandidate *candidate = candidates->data; |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
312 | PurpleMediaCandidate *new_candidate = purple_media_candidate_new( |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
313 | candidate->foundation, candidate->component, |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
314 | !strcmp(candidate->type, "host") ? |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
315 | PURPLE_MEDIA_CANDIDATE_TYPE_HOST : |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
316 | !strcmp(candidate->type, "srflx") ? |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
317 | PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX : |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
318 | !strcmp(candidate->type, "prflx") ? |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
319 | PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX : |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
320 | !strcmp(candidate->type, "relay") ? |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
321 | PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0, |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
322 | PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
323 | candidate->ip, candidate->port); |
|
26325
5427d1073629
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Michael Ruprecht <maiku@pidgin.im>
parents:
26312
diff
changeset
|
324 | new_candidate->base_ip = g_strdup(candidate->reladdr); |
|
5427d1073629
Use the correct values for Jingle Ice-Udp's rel-addr and rel-port.
Michael Ruprecht <maiku@pidgin.im>
parents:
26312
diff
changeset
|
325 | new_candidate->base_port = candidate->relport; |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
326 | new_candidate->username = g_strdup(candidate->username); |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
327 | new_candidate->password = g_strdup(candidate->password); |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
328 | new_candidate->priority = candidate->priority; |
|
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
329 | ret = g_list_append(ret, new_candidate); |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
330 | } |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
331 | |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
332 | return ret; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
333 | } else { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
334 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
335 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
336 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
337 | |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
338 | static void jingle_rtp_ready(JingleSession *session); |
|
26431
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
339 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
340 | static void |
|
26266
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
341 | jingle_rtp_accepted_cb(PurpleMedia *media, gchar *sid, gchar *name, |
|
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
342 | JingleSession *session) |
|
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
343 | { |
|
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
344 | purple_debug_info("jingle-rtp", "jingle_rtp_accepted_cb\n"); |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
345 | jingle_rtp_ready(session); |
|
26266
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
346 | } |
|
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
347 | |
|
069e72982f87
Added the accepted signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26265
diff
changeset
|
348 | static void |
|
26418
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
349 | jingle_rtp_candidates_prepared_cb(PurpleMedia *media, |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
350 | gchar *sid, gchar *name, JingleSession *session) |
|
26417
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
351 | { |
|
26418
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
352 | JingleContent *content = jingle_session_find_content( |
|
26422
457d5f0223b4
Use new find_content wildcard.
Michael Ruprecht <maiku@pidgin.im>
parents:
26420
diff
changeset
|
353 | session, sid, NULL); |
|
26418
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
354 | JingleTransport *oldtransport, *transport; |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
355 | GList *candidates; |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
356 | |
|
26417
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
357 | purple_debug_info("jingle-rtp", "jingle_rtp_candidates_prepared_cb\n"); |
|
26418
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
358 | |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
359 | if (content == NULL) { |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
360 | purple_debug_error("jingle-rtp", |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
361 | "jingle_rtp_candidates_prepared_cb: " |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
362 | "Can't find session %s\n", sid); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
363 | return; |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
364 | } |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
365 | |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
366 | oldtransport = jingle_content_get_transport(content); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
367 | candidates = purple_media_get_local_candidates(media, sid, name); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
368 | transport = JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport( |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
369 | session, JINGLE_IS_RAWUDP(oldtransport) ? |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
370 | JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP, |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
371 | 0, candidates)); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
372 | |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
373 | g_list_free(candidates); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
374 | g_object_unref(oldtransport); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
375 | |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
376 | jingle_content_set_pending_transport(content, transport); |
|
58d9b79f7af6
Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents:
26417
diff
changeset
|
377 | jingle_content_accept_transport(content); |
|
26431
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
378 | |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
379 | jingle_rtp_ready(session); |
|
26417
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
380 | } |
|
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
381 | |
|
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
382 | static void |
|
26265
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
383 | jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
384 | JingleSession *session) |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
385 | { |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
386 | purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
387 | "session_id: %s jingle_session: %p\n", sid, session); |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
388 | jingle_rtp_ready(session); |
|
26265
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
389 | } |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
390 | |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
391 | static void |
|
26229
3e786c9ebb62
Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents:
26226
diff
changeset
|
392 | jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
393 | { |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
394 | JingleContent *content = jingle_session_find_content( |
|
26422
457d5f0223b4
Use new find_content wildcard.
Michael Ruprecht <maiku@pidgin.im>
parents:
26420
diff
changeset
|
395 | session, sid, NULL); |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
396 | JingleTransport *transport; |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
397 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
398 | purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n"); |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
399 | |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
400 | if (content == NULL) { |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
401 | purple_debug_error("jingle-rtp", |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
402 | "jingle_rtp_new_candidate_cb: " |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
403 | "Can't find session %s\n", sid); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
404 | return; |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
405 | } |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
406 | |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
407 | transport = jingle_content_get_transport(content); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
408 | |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
409 | if (JINGLE_IS_ICEUDP(transport)) |
| 26419 | 410 | jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
411 | jingle_rtp_candidate_to_iceudp( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
412 | session, 1, candidate)); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
413 | else if (JINGLE_IS_RAWUDP(transport)) |
| 26419 | 414 | jingle_rawudp_add_local_candidate(JINGLE_RAWUDP(transport), |
|
26416
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
415 | jingle_rtp_candidate_to_rawudp( |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
416 | session, 1, candidate)); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
417 | |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
418 | g_object_unref(transport); |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
419 | |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
420 | jabber_iq_send(jingle_session_to_packet(session, |
|
1536df3f6fc7
Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents:
26410
diff
changeset
|
421 | JINGLE_TRANSPORT_INFO)); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
422 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
423 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
424 | static void |
|
26311
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
425 | jingle_rtp_initiate_ack_cb(JabberStream *js, xmlnode *packet, gpointer data) |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
426 | { |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
427 | JingleSession *session = data; |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
428 | |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
429 | if (!strcmp(xmlnode_get_attrib(packet, "type"), "error") || |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
430 | xmlnode_get_child(packet, "error")) { |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
431 | purple_media_end(jingle_rtp_get_media(session), NULL, NULL); |
|
26312
dcbb96abceae
Free the session as well on error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26311
diff
changeset
|
432 | g_object_unref(session); |
|
26311
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
433 | return; |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
434 | } |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
435 | } |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
436 | |
|
0baf4bc1b441
Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents:
26303
diff
changeset
|
437 | static void |
|
26193
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
438 | jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaStateChangedType type, |
|
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
439 | gchar *sid, gchar *name, JingleSession *session) |
|
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
440 | { |
|
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
441 | purple_debug_info("jingle-rtp", "state-changed: type %d id: %s name: %s\n", type, sid, name); |
|
26441
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
442 | } |
|
26194
b8aab50491f4
Use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26193
diff
changeset
|
443 | |
|
26441
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
444 | static void |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
445 | jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
446 | gchar *sid, gchar *name, JingleSession *session) |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
447 | { |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
448 | purple_debug_info("jingle-rtp", "stream-info: type %d " |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
449 | "id: %s name: %s\n", type, sid, name); |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
450 | if (type == PURPLE_MEDIA_INFO_HANGUP) { |
|
26404
3947a428b87d
Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26330
diff
changeset
|
451 | jabber_iq_send(jingle_session_terminate_packet( |
|
3947a428b87d
Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26330
diff
changeset
|
452 | session, "success")); |
|
26194
b8aab50491f4
Use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26193
diff
changeset
|
453 | g_object_unref(session); |
|
26441
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
454 | } else if (type == PURPLE_MEDIA_INFO_REJECT) { |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
455 | jabber_iq_send(jingle_session_terminate_packet( |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
456 | session, "decline")); |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
457 | g_object_unref(session); |
|
26194
b8aab50491f4
Use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26193
diff
changeset
|
458 | } |
|
26193
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
459 | } |
|
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
460 | |
|
26431
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
461 | static void |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
462 | jingle_rtp_ready(JingleSession *session) |
|
26431
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
463 | { |
|
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
464 | PurpleMedia *media = jingle_rtp_get_media(session); |
|
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
465 | |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
466 | if (purple_media_candidates_prepared(media, NULL, NULL) && |
|
26431
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
467 | purple_media_codecs_ready(media, NULL) && |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
468 | (jingle_session_is_initiator(session) == TRUE || |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
469 | purple_media_accepted(media, NULL, NULL))) { |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
470 | if (jingle_session_is_initiator(session)) { |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
471 | JabberIq *iq = jingle_session_to_packet( |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
472 | session, JINGLE_SESSION_INITIATE); |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
473 | jabber_iq_set_callback(iq, |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
474 | jingle_rtp_initiate_ack_cb, session); |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
475 | jabber_iq_send(iq); |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
476 | } else { |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
477 | jabber_iq_send(jingle_session_to_packet(session, |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
478 | JINGLE_SESSION_ACCEPT)); |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
479 | } |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
480 | |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
481 | g_signal_handlers_disconnect_by_func(G_OBJECT(media), |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
482 | G_CALLBACK(jingle_rtp_accepted_cb), session); |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
483 | g_signal_handlers_disconnect_by_func(G_OBJECT(media), |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
484 | G_CALLBACK(jingle_rtp_candidates_prepared_cb), |
|
26431
993517d98857
Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents:
26428
diff
changeset
|
485 | session); |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
486 | g_signal_handlers_disconnect_by_func(G_OBJECT(media), |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
487 | G_CALLBACK(jingle_rtp_codecs_changed_cb), |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
488 | session); |
|
26433
3213aeff8bdb
Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26431
diff
changeset
|
489 | g_signal_connect(G_OBJECT(media), "new-candidate", |
|
3213aeff8bdb
Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26431
diff
changeset
|
490 | G_CALLBACK(jingle_rtp_new_candidate_cb), |
|
3213aeff8bdb
Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26431
diff
changeset
|
491 | session); |
|
3213aeff8bdb
Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26431
diff
changeset
|
492 | } |
|
3213aeff8bdb
Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26431
diff
changeset
|
493 | } |
|
3213aeff8bdb
Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26431
diff
changeset
|
494 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
495 | static PurpleMedia * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
496 | jingle_rtp_create_media(JingleContent *content) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
497 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
498 | JingleSession *session = jingle_content_get_session(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
499 | JabberStream *js = jingle_session_get_js(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
500 | gchar *remote_jid = jingle_session_get_remote_jid(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
501 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
502 | PurpleMedia *media = purple_media_manager_create_media(purple_media_manager_get(), |
|
26187
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26170
diff
changeset
|
503 | js->gc, "fsrtpconference", remote_jid, |
|
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26170
diff
changeset
|
504 | jingle_session_is_initiator(session)); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
505 | g_free(remote_jid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
506 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
507 | if (!media) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
508 | purple_debug_error("jingle-rtp", "Couldn't create media session\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
509 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
510 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
511 | |
|
26330
9d627ae05002
Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26325
diff
changeset
|
512 | purple_media_set_prpl_data(media, session); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
513 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
514 | /* connect callbacks */ |
|
26437
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
515 | if (jingle_session_is_initiator(session) == FALSE) |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
516 | g_signal_connect(G_OBJECT(media), "accepted", |
|
02b645aac6ee
Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26433
diff
changeset
|
517 | G_CALLBACK(jingle_rtp_accepted_cb), session); |
|
26417
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
518 | g_signal_connect(G_OBJECT(media), "candidates-prepared", |
|
b73b6e73abe6
Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26416
diff
changeset
|
519 | G_CALLBACK(jingle_rtp_candidates_prepared_cb), session); |
|
26265
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
520 | g_signal_connect(G_OBJECT(media), "codecs-changed", |
|
66aee93241e2
Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26264
diff
changeset
|
521 | G_CALLBACK(jingle_rtp_codecs_changed_cb), session); |
|
26193
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
522 | g_signal_connect(G_OBJECT(media), "state-changed", |
|
101122f0f3dd
Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26192
diff
changeset
|
523 | G_CALLBACK(jingle_rtp_state_changed_cb), session); |
|
26441
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
524 | g_signal_connect(G_OBJECT(media), "stream-info", |
|
46a5bb7783e7
Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents:
26437
diff
changeset
|
525 | G_CALLBACK(jingle_rtp_stream_info_cb), session); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
526 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
527 | g_object_unref(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
528 | return media; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
529 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
530 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
531 | static gboolean |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
532 | jingle_rtp_init_media(JingleContent *content) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
533 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
534 | JingleSession *session = jingle_content_get_session(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
535 | PurpleMedia *media = jingle_rtp_get_media(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
536 | gchar *media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
537 | gchar *remote_jid; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
538 | gchar *senders; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
539 | gchar *name; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
540 | const gchar *transmitter; |
|
26226
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
541 | gboolean is_audio; |
|
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
542 | PurpleMediaSessionType type; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
543 | JingleTransport *transport; |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26266
diff
changeset
|
544 | GParameter *params = NULL; |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26266
diff
changeset
|
545 | guint num_params; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
546 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
547 | /* maybe this create ought to just be in initiate and handle initiate */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
548 | if (media == NULL) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
549 | media = jingle_rtp_create_media(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
550 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
551 | if (media == NULL) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
552 | return FALSE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
553 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
554 | name = jingle_content_get_name(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
555 | media_type = jingle_rtp_get_media_type(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
556 | remote_jid = jingle_session_get_remote_jid(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
557 | senders = jingle_content_get_senders(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
558 | transport = jingle_content_get_transport(content); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
559 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
560 | if (JINGLE_IS_RAWUDP(transport)) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
561 | transmitter = "rawudp"; |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
562 | else if (JINGLE_IS_ICEUDP(transport)) |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
563 | transmitter = "nice"; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
564 | else |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
565 | transmitter = "notransmitter"; |
|
26410
5952dcb9ce6c
Plug some memory leaks related to transports.
Michael Ruprecht <maiku@pidgin.im>
parents:
26407
diff
changeset
|
566 | g_object_unref(transport); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
567 | |
|
26226
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
568 | is_audio = !strcmp(media_type, "audio"); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
569 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
570 | if (!strcmp(senders, "both")) |
|
26226
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
571 | type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO |
|
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
572 | : PURPLE_MEDIA_VIDEO; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
573 | else if (!strcmp(senders, "initiator") |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
574 | && jingle_session_is_initiator(session)) |
|
26226
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
575 | type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO |
|
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
576 | : PURPLE_MEDIA_SEND_VIDEO; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
577 | else |
|
26226
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
578 | type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO |
|
dcb05990f479
Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents:
26215
diff
changeset
|
579 | : PURPLE_MEDIA_RECV_VIDEO; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
580 | |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26266
diff
changeset
|
581 | params = |
|
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26266
diff
changeset
|
582 | jingle_get_params(jingle_session_get_js(session), &num_params); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
583 | purple_media_add_stream(media, name, remote_jid, |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26266
diff
changeset
|
584 | type, transmitter, num_params, params); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
585 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
586 | g_free(name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
587 | g_free(media_type); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
588 | g_free(remote_jid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
589 | g_free(senders); |
|
26286
443041606e32
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents:
26266
diff
changeset
|
590 | g_free(params); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
591 | g_object_unref(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
592 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
593 | return TRUE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
594 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
595 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
596 | static GList * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
597 | jingle_rtp_parse_codecs(xmlnode *description) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
598 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
599 | GList *codecs = NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
600 | xmlnode *codec_element = NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
601 | const char *encoding_name,*id, *clock_rate; |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
602 | PurpleMediaCodec *codec; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
603 | const gchar *media = xmlnode_get_attrib(description, "media"); |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
604 | PurpleMediaSessionType type = |
|
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
605 | !strcmp(media, "video") ? PURPLE_MEDIA_VIDEO : |
|
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
606 | !strcmp(media, "audio") ? PURPLE_MEDIA_AUDIO : 0; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
607 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
608 | for (codec_element = xmlnode_get_child(description, "payload-type") ; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
609 | codec_element ; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
610 | codec_element = xmlnode_get_next_twin(codec_element)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
611 | xmlnode *param; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
612 | gchar *codec_str; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
613 | encoding_name = xmlnode_get_attrib(codec_element, "name"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
614 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
615 | id = xmlnode_get_attrib(codec_element, "id"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
616 | clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
617 | |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
618 | codec = purple_media_codec_new(atoi(id), encoding_name, |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
619 | type, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
620 | clock_rate ? atoi(clock_rate) : 0); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
621 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
622 | for (param = xmlnode_get_child(codec_element, "parameter"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
623 | param; param = xmlnode_get_next_twin(param)) { |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
624 | purple_media_codec_add_optional_parameter(codec, |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
625 | xmlnode_get_attrib(param, "name"), |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
626 | xmlnode_get_attrib(param, "value")); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
627 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
628 | |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
629 | codec_str = purple_media_codec_to_string(codec); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
630 | purple_debug_info("jingle-rtp", "received codec: %s\n", codec_str); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
631 | g_free(codec_str); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
632 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
633 | codecs = g_list_append(codecs, codec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
634 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
635 | return codecs; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
636 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
637 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
638 | static JingleContent * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
639 | jingle_rtp_parse_internal(xmlnode *rtp) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
640 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
641 | JingleContent *content = parent_class->parse(rtp); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
642 | xmlnode *description = xmlnode_get_child(rtp, "description"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
643 | const gchar *media_type = xmlnode_get_attrib(description, "media"); |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
644 | const gchar *ssrc = xmlnode_get_attrib(description, "ssrc"); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
645 | purple_debug_info("jingle-rtp", "rtp parse\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
646 | g_object_set(content, "media-type", media_type, NULL); |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
647 | if (ssrc != NULL) |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
648 | g_object_set(content, "ssrc", ssrc, NULL); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
649 | return content; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
650 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
651 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
652 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
653 | jingle_rtp_add_payloads(xmlnode *description, GList *codecs) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
654 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
655 | for (; codecs ; codecs = codecs->next) { |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
656 | PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
657 | GList *iter = codec->optional_params; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
658 | char id[8], clockrate[10], channels[10]; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
659 | gchar *codec_str; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
660 | xmlnode *payload = xmlnode_new_child(description, "payload-type"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
661 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
662 | g_snprintf(id, sizeof(id), "%d", codec->id); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
663 | g_snprintf(clockrate, sizeof(clockrate), "%d", codec->clock_rate); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
664 | g_snprintf(channels, sizeof(channels), "%d", codec->channels); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
665 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
666 | xmlnode_set_attrib(payload, "name", codec->encoding_name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
667 | xmlnode_set_attrib(payload, "id", id); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
668 | xmlnode_set_attrib(payload, "clockrate", clockrate); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
669 | xmlnode_set_attrib(payload, "channels", channels); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
670 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
671 | for (; iter; iter = g_list_next(iter)) { |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
672 | PurpleMediaCodecParameter *mparam = iter->data; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
673 | xmlnode *param = xmlnode_new_child(payload, "parameter"); |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
674 | xmlnode_set_attrib(param, "name", mparam->name); |
|
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
675 | xmlnode_set_attrib(param, "value", mparam->value); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
676 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
677 | |
|
26232
f91c96072586
Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents:
26229
diff
changeset
|
678 | codec_str = purple_media_codec_to_string(codec); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
679 | purple_debug_info("jingle", "adding codec: %s\n", codec_str); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
680 | g_free(codec_str); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
681 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
682 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
683 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
684 | static xmlnode * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
685 | jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
686 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
687 | xmlnode *node = parent_class->to_xml(rtp, content, action); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
688 | xmlnode *description = xmlnode_get_child(node, "description"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
689 | if (description != NULL) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
690 | JingleSession *session = jingle_content_get_session(rtp); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
691 | PurpleMedia *media = jingle_rtp_get_media(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
692 | gchar *media_type = jingle_rtp_get_media_type(rtp); |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
693 | gchar *ssrc = jingle_rtp_get_ssrc(rtp); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
694 | gchar *name = jingle_content_get_name(rtp); |
|
26160
46bc5e18d59c
Combine get_*_codecs functions to mirror Farsight 2.
Michael Ruprecht <maiku@pidgin.im>
parents:
26156
diff
changeset
|
695 | GList *codecs = purple_media_get_codecs(media, name); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
696 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
697 | xmlnode_set_attrib(description, "media", media_type); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
698 | |
|
26405
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
699 | if (ssrc != NULL) |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
700 | xmlnode_set_attrib(description, "ssrc", ssrc); |
|
4cf4d5dcc183
Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents:
26404
diff
changeset
|
701 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
702 | g_free(media_type); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
703 | g_free(name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
704 | g_object_unref(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
705 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
706 | jingle_rtp_add_payloads(description, codecs); |
| 26428 | 707 | purple_media_codec_list_free(codecs); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
708 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
709 | return node; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
710 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
711 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
712 | static void |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
713 | jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
714 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
715 | switch (action) { |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
716 | case JINGLE_SESSION_ACCEPT: |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
717 | case JINGLE_SESSION_INITIATE: { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
718 | JingleSession *session = jingle_content_get_session(content); |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
719 | JingleTransport *transport = jingle_transport_parse( |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
720 | xmlnode_get_child(xmlcontent, "transport")); |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
721 | xmlnode *description = xmlnode_get_child(xmlcontent, "description"); |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
722 | GList *candidates = jingle_rtp_transport_to_candidates(transport); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
723 | GList *codecs = jingle_rtp_parse_codecs(description); |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
724 | gchar *name = jingle_content_get_name(content); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
725 | gchar *remote_jid = |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
726 | jingle_session_get_remote_jid(session); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
727 | PurpleMedia *media; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
728 | |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
729 | if (action == JINGLE_SESSION_INITIATE && |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
730 | jingle_rtp_init_media(content) == FALSE) { |
|
26156
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
731 | /* XXX: send error */ |
|
26404
3947a428b87d
Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26330
diff
changeset
|
732 | jabber_iq_send(jingle_session_terminate_packet( |
|
3947a428b87d
Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents:
26330
diff
changeset
|
733 | session, "general-error")); |
|
26156
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
734 | g_object_unref(session); |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
735 | break; |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
736 | } |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
737 | |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
738 | media = jingle_rtp_get_media(session); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
739 | purple_media_set_remote_codecs(media, |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
740 | name, remote_jid, codecs); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
741 | purple_media_add_remote_candidates(media, |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
742 | name, remote_jid, candidates); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
743 | |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
744 | /* This needs to be for the entire session, not a single content */ |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
745 | /* very hacky */ |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
746 | if (action == JINGLE_SESSION_ACCEPT && |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
747 | xmlnode_get_next_twin(xmlcontent) == NULL) |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
748 | purple_media_accept(media); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
749 | |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
750 | g_free(remote_jid); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
751 | g_free(name); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
752 | g_object_unref(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
753 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
754 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
755 | case JINGLE_SESSION_TERMINATE: { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
756 | JingleSession *session = jingle_content_get_session(content); |
|
26192
ca6d9f19c4b6
Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents:
26191
diff
changeset
|
757 | PurpleMedia *media = jingle_rtp_get_media(session); |
|
ca6d9f19c4b6
Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents:
26191
diff
changeset
|
758 | |
|
ca6d9f19c4b6
Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents:
26191
diff
changeset
|
759 | if (media != NULL) { |
|
26264
c062fc1f212f
Added purple_media_end and removed the purple_media_got_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents:
26248
diff
changeset
|
760 | purple_media_end(media, NULL, NULL); |
|
26192
ca6d9f19c4b6
Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents:
26191
diff
changeset
|
761 | } |
|
ca6d9f19c4b6
Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents:
26191
diff
changeset
|
762 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
763 | g_object_unref(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
764 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
765 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
766 | case JINGLE_TRANSPORT_INFO: { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
767 | JingleSession *session = jingle_content_get_session(content); |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
768 | JingleTransport *transport = jingle_transport_parse( |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
769 | xmlnode_get_child(xmlcontent, "transport")); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
770 | GList *candidates = jingle_rtp_transport_to_candidates(transport); |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
771 | gchar *name = jingle_content_get_name(content); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
772 | gchar *remote_jid = |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
773 | jingle_session_get_remote_jid(session); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
774 | |
|
26407
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
775 | purple_media_add_remote_candidates( |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
776 | jingle_rtp_get_media(session), |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
777 | name, remote_jid, candidates); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
778 | |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
779 | g_free(remote_jid); |
|
48782a6424e0
Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents:
26405
diff
changeset
|
780 | g_free(name); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
781 | g_object_unref(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
782 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
783 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
784 | default: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
785 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
786 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
787 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
788 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
789 | PurpleMedia * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
790 | jingle_rtp_initiate_media(JabberStream *js, const gchar *who, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
791 | PurpleMediaSessionType type) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
792 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
793 | /* create content negotiation */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
794 | JingleSession *session; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
795 | JingleContent *content; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
796 | JingleTransport *transport; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
797 | JabberBuddy *jb; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
798 | JabberBuddyResource *jbr; |
|
26161
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
799 | PurpleMedia *media; |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
800 | const gchar *transport_type; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
801 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
802 | gchar *jid = NULL, *me = NULL, *sid = NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
803 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
804 | /* construct JID to send to */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
805 | jb = jabber_buddy_find(js, who, FALSE); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
806 | if (!jb) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
807 | purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
808 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
809 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
810 | jbr = jabber_buddy_find_resource(jb, NULL); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
811 | if (!jbr) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
812 | purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
813 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
814 | |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
815 | if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
816 | transport_type = JINGLE_TRANSPORT_ICEUDP; |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
817 | } else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_RAWUDP)) { |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
818 | transport_type = JINGLE_TRANSPORT_RAWUDP; |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
819 | } else { |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
820 | purple_debug_error("jingle-rtp", "Resource doesn't support " |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
821 | "the same transport types\n"); |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
822 | return NULL; |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
823 | } |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
824 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
825 | if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
826 | jid = g_strdup_printf("%s/%s", who, jbr->name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
827 | } else { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
828 | jid = g_strdup(who); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
829 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
830 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
831 | /* set ourselves as initiator */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
832 | me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
833 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
834 | sid = jabber_get_next_id(js); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
835 | session = jingle_session_create(js, sid, me, jid, TRUE); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
836 | g_free(sid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
837 | |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
838 | |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
839 | if (type & PURPLE_MEDIA_AUDIO) { |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
840 | transport = jingle_transport_create(transport_type); |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
841 | content = jingle_content_create(JINGLE_APP_RTP, "initiator", |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
842 | "session", "audio-session", "both", transport); |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
843 | jingle_session_add_content(session, content); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
844 | JINGLE_RTP(content)->priv->media_type = g_strdup("audio"); |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
845 | jingle_rtp_init_media(content); |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
846 | } |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
847 | if (type & PURPLE_MEDIA_VIDEO) { |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
848 | transport = jingle_transport_create(transport_type); |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
849 | content = jingle_content_create(JINGLE_APP_RTP, "initiator", |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
850 | "session", "video-session", "both", transport); |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
851 | jingle_session_add_content(session, content); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
852 | JINGLE_RTP(content)->priv->media_type = g_strdup("video"); |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
853 | jingle_rtp_init_media(content); |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
854 | } |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
855 | |
|
26161
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
856 | if ((media = jingle_rtp_get_media(session)) == NULL) { |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
857 | return NULL; |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
858 | } |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
859 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
860 | g_free(jid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
861 | g_free(me); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
862 | |
|
26161
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
863 | return media; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
864 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
865 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
866 | void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
867 | jingle_rtp_terminate_session(JabberStream *js, const gchar *who) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
868 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
869 | JingleSession *session; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
870 | /* XXX: This may cause file transfers and xml sessions to stop as well */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
871 | session = jingle_session_find_by_jid(js, who); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
872 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
873 | if (session) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
874 | PurpleMedia *media = jingle_rtp_get_media(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
875 | if (media) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
876 | purple_debug_info("jingle-rtp", "hanging up media\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
877 | purple_media_hangup(media); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
878 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
879 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
880 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
881 | |
|
26215
9ecaa256d77b
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26198
diff
changeset
|
882 | #endif /* USE_VV */ |
|
9ecaa256d77b
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26198
diff
changeset
|
883 |