libpurple/protocols/jabber/jingle/rtp.c

Sat, 22 Aug 2009 02:52:30 +0000

author
Paul Aurich <darkrain42@pidgin.im>
date
Sat, 22 Aug 2009 02:52:30 +0000
changeset 28322
ac8fec1d2234
parent 28161
4368c139d67f
child 28333
f63e5c1222f3
permissions
-rw-r--r--

Remove specific copyright lines from the XMPP prpl.

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 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28161
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28161
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28161
diff changeset
8 * source distribution.
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28161
diff changeset
9 *
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
10 * 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
11 * 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
12 * 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
13 * (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
14 *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
15 * 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
16 * 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
17 * 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
18 * 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
19 *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
20 * 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
21 * 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
22 * 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
23 */
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
24
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
25 #include "config.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
26
26215
9ecaa256d77b Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26198
diff changeset
27 #ifdef USE_VV
9ecaa256d77b Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26198
diff changeset
28
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
29 #include "jabber.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
30 #include "jingle.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
31 #include "media.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32 #include "mediamanager.h"
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
33 #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
34 #include "rawudp.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
35 #include "rtp.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
36 #include "session.h"
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
37 #include "debug.h"
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 #include <string.h>
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
41 struct _JingleRtpPrivate
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 gchar *media_type;
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
44 gchar *ssrc;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
45 };
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
46
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
47 #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
48
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_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
50 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
51 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
52 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
53 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
54 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
55 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
56 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
57
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
58 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
59
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
60 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
61 #if 0
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
62 enum {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
63 LAST_SIGNAL
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
64 };
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
65 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
66 #endif
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
67
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
68 enum {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
69 PROP_0,
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
70 PROP_MEDIA_TYPE,
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
71 PROP_SSRC,
26147
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
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
74 GType
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
75 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
76 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
77 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
78
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
79 if (type == 0) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
80 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
81 sizeof(JingleRtpClass),
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 NULL,
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
84 (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
85 NULL,
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 sizeof(JingleRtp),
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
88 0,
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
89 (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
90 NULL
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 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
93 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
94 return type;
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
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
97 static void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
98 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
99 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
100 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
101 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
102
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
103 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
104 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
105 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
106 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
107 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
108 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
109 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
110
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
111 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
112 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
113 "Media Type",
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
114 "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
115 NULL,
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
116 G_PARAM_READWRITE));
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
117 g_object_class_install_property(gobject_class, PROP_SSRC,
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
118 g_param_spec_string("ssrc",
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
119 "ssrc",
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
120 "The ssrc for this rtp session.",
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
121 NULL,
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
122 G_PARAM_READWRITE));
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
123
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
124 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
125 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
126
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
127 static void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
128 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
129 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
130 rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp);
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
131 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
132 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
133
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
134 static void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
135 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
136 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
137 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
138 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
139
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
140 g_free(priv->media_type);
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
141 g_free(priv->ssrc);
26410
5952dcb9ce6c Plug some memory leaks related to transports.
Michael Ruprecht <maiku@pidgin.im>
parents: 26407
diff changeset
142
5952dcb9ce6c Plug some memory leaks related to transports.
Michael Ruprecht <maiku@pidgin.im>
parents: 26407
diff changeset
143 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
144 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
145
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
146 static void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
147 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
148 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
149 JingleRtp *rtp;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
150 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
151
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
152 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
153
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
154 switch (prop_id) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
155 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
156 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
157 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
158 break;
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
159 case PROP_SSRC:
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
160 g_free(rtp->priv->ssrc);
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
161 rtp->priv->ssrc = g_value_dup_string(value);
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
162 break;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
163 default:
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
164 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
165 break;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
166 }
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
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
169 static void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
170 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
171 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
172 JingleRtp *rtp;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
173 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
174
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
175 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
176
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
177 switch (prop_id) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
178 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
179 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
180 break;
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
181 case PROP_SSRC:
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
182 g_value_set_string(value, rtp->priv->ssrc);
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
183 break;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
184 default:
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
185 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
186 break;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
187 }
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
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
190 gchar *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
191 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
192 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
193 gchar *media_type;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
194 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
195 return media_type;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
196 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
197
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
198 gchar *
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
199 jingle_rtp_get_ssrc(JingleContent *content)
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 gchar *ssrc;
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
202 g_object_get(content, "ssrc", &ssrc, NULL);
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
203 return ssrc;
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
204 }
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
205
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
206 static PurpleMedia *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
207 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
208 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
209 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
210 PurpleMedia *media = NULL;
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
211 GList *iter = purple_media_manager_get_media_by_account(
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
212 purple_media_manager_get(),
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
213 purple_connection_get_account(js->gc));
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
214
26330
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
215 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
216 JingleSession *media_session =
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
217 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
218 if (media_session == session) {
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
219 media = iter->data;
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
220 break;
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
221 }
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
222 }
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
223 if (iter != NULL)
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
224 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
225
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
226 return media;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
227 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
228
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
229 static JingleRawUdpCandidate *
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
230 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
231 PurpleMediaCandidate *candidate)
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
232 {
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
233 gchar *id = jabber_get_next_id(jingle_session_get_js(session));
26620
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
234 gchar *ip = purple_media_candidate_get_ip(candidate);
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
235 JingleRawUdpCandidate *rawudp_candidate =
26620
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
236 jingle_rawudp_candidate_new(id, generation,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
237 purple_media_candidate_get_component_id(candidate),
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
238 ip, purple_media_candidate_get_port(candidate));
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
239 g_free(ip);
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
240 g_free(id);
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
241 return rawudp_candidate;
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
242 }
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
243
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
244 static JingleIceUdpCandidate *
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
245 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
246 PurpleMediaCandidate *candidate)
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
247 {
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
248 gchar *id = jabber_get_next_id(jingle_session_get_js(session));
26620
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
249 gchar *ip = purple_media_candidate_get_ip(candidate);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
250 gchar *username = purple_media_candidate_get_username(candidate);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
251 gchar *password = purple_media_candidate_get_password(candidate);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
252 PurpleMediaCandidateType type =
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
253 purple_media_candidate_get_candidate_type(candidate);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
254
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
255 JingleIceUdpCandidate *iceudp_candidate = jingle_iceudp_candidate_new(
26620
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
256 purple_media_candidate_get_component_id(candidate),
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
257 purple_media_candidate_get_foundation(candidate),
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
258 generation, id, ip, 0,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
259 purple_media_candidate_get_port(candidate),
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
260 purple_media_candidate_get_priority(candidate), "udp",
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
261 type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" :
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
262 type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" :
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
263 type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" :
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
264 type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" :
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
265 "", username, password);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
266 iceudp_candidate->reladdr =
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
267 purple_media_candidate_get_base_ip(candidate);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
268 iceudp_candidate->relport =
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
269 purple_media_candidate_get_base_port(candidate);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
270 g_free(password);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
271 g_free(username);
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
272 g_free(ip);
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
273 g_free(id);
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
274 return iceudp_candidate;
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
275 }
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
276
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
277 static JingleTransport *
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
278 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
279 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
280 if (type == JINGLE_TYPE_RAWUDP) {
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
281 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
282 JingleRawUdpCandidate *rawudp_candidate;
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
283 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
284 PurpleMediaCandidate *candidate = candidates->data;
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
285 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
286 session, generation, candidate);
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
287 jingle_rawudp_add_local_candidate(
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
288 JINGLE_RAWUDP(transport),
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
289 rawudp_candidate);
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
290 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
291 return transport;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
292 } else if (type == JINGLE_TYPE_ICEUDP) {
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
293 JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP);
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
294 JingleIceUdpCandidate *iceudp_candidate;
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
295 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
296 PurpleMediaCandidate *candidate = candidates->data;
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
297 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
298 session, generation, candidate);
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
299 jingle_iceudp_add_local_candidate(
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
300 JINGLE_ICEUDP(transport),
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
301 iceudp_candidate);
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
302 }
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
303 return transport;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
304 } else {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
305 return NULL;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
306 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
307 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
308
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
309 static GList *
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
310 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
311 {
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
312 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
313 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
314 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
315 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
316
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
317 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
318 JingleRawUdpCandidate *candidate = candidates->data;
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
319 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
320 "", candidate->component,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
321 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX,
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,
26154
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
323 candidate->ip, candidate->port));
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
324 }
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
325
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
326 return ret;
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
327 } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) {
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
328 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
329
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
330 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
331 JingleIceUdpCandidate *candidate = candidates->data;
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
332 PurpleMediaCandidate *new_candidate = purple_media_candidate_new(
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
333 candidate->foundation, candidate->component,
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
334 !strcmp(candidate->type, "host") ?
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
335 PURPLE_MEDIA_CANDIDATE_TYPE_HOST :
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
336 !strcmp(candidate->type, "srflx") ?
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
337 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX :
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
338 !strcmp(candidate->type, "prflx") ?
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
339 PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX :
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
340 !strcmp(candidate->type, "relay") ?
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
341 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
342 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
343 candidate->ip, candidate->port);
26620
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
344 g_object_set(new_candidate,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
345 "base-ip", candidate->reladdr,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
346 "base-port", candidate->relport,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
347 "username", candidate->username,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
348 "password", candidate->password,
a34fb2386da5 Hide and GObjectify PurpleMediaCandidate.
Michael Ruprecht <maiku@pidgin.im>
parents: 26618
diff changeset
349 "priority", candidate->priority, NULL);
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
350 ret = g_list_append(ret, new_candidate);
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
351 }
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
352
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
353 return ret;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
354 } else {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
355 return NULL;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
356 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
357 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
358
26437
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
359 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
360
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
361 static void
26418
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
362 jingle_rtp_candidates_prepared_cb(PurpleMedia *media,
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
363 gchar *sid, gchar *name, JingleSession *session)
26417
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
364 {
26418
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
365 JingleContent *content = jingle_session_find_content(
26422
457d5f0223b4 Use new find_content wildcard.
Michael Ruprecht <maiku@pidgin.im>
parents: 26420
diff changeset
366 session, sid, NULL);
26418
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
367 JingleTransport *oldtransport, *transport;
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
368 GList *candidates;
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
369
26417
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
370 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
371
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
372 if (content == NULL) {
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
373 purple_debug_error("jingle-rtp",
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
374 "jingle_rtp_candidates_prepared_cb: "
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
375 "Can't find session %s\n", sid);
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
376 return;
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
377 }
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
378
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
379 oldtransport = jingle_content_get_transport(content);
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
380 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
381 transport = JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport(
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
382 session, JINGLE_IS_RAWUDP(oldtransport) ?
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
383 JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP,
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
384 0, candidates));
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
385
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
386 g_list_free(candidates);
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
387 g_object_unref(oldtransport);
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
388
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
389 jingle_content_set_pending_transport(content, transport);
58d9b79f7af6 Implement jingle_rtp_candidates_prepared_cb.
Michael Ruprecht <maiku@pidgin.im>
parents: 26417
diff changeset
390 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
391
26437
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
392 jingle_rtp_ready(session);
26417
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
393 }
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
394
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
395 static void
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
396 jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid,
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
397 JingleSession *session)
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
398 {
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
399 purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: "
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
400 "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
401 jingle_rtp_ready(session);
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
402 }
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
403
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
404 static void
26229
3e786c9ebb62 Duplicate FsCandidate to remove it from the public interface.
Michael Ruprecht <maiku@pidgin.im>
parents: 26226
diff changeset
405 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
406 {
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
407 JingleContent *content = jingle_session_find_content(
26422
457d5f0223b4 Use new find_content wildcard.
Michael Ruprecht <maiku@pidgin.im>
parents: 26420
diff changeset
408 session, sid, NULL);
26416
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
409 JingleTransport *transport;
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
410
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
411 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
412
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
413 if (content == NULL) {
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
414 purple_debug_error("jingle-rtp",
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
415 "jingle_rtp_new_candidate_cb: "
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
416 "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
417 return;
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
418 }
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 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
421
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
422 if (JINGLE_IS_ICEUDP(transport))
26419
1fcdbc14e4cb Silence two warnings.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
423 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
424 jingle_rtp_candidate_to_iceudp(
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
425 session, 1, candidate));
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
426 else if (JINGLE_IS_RAWUDP(transport))
26419
1fcdbc14e4cb Silence two warnings.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
427 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
428 jingle_rtp_candidate_to_rawudp(
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
429 session, 1, candidate));
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
430
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
431 g_object_unref(transport);
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
432
1536df3f6fc7 Send any additional candidates found after session-initiate or
Michael Ruprecht <maiku@pidgin.im>
parents: 26410
diff changeset
433 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
434 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
435 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
436
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
437 static void
26694
3d9ac30490ab Fix merge for ./jingle/
Paul Aurich <darkrain42@pidgin.im>
parents: 26620
diff changeset
438 jingle_rtp_initiate_ack_cb(JabberStream *js, const char *from,
3d9ac30490ab Fix merge for ./jingle/
Paul Aurich <darkrain42@pidgin.im>
parents: 26620
diff changeset
439 JabberIqType type, const char *id,
3d9ac30490ab Fix merge for ./jingle/
Paul Aurich <darkrain42@pidgin.im>
parents: 26620
diff changeset
440 xmlnode *packet, gpointer data)
26311
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
441 {
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
442 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
443
26694
3d9ac30490ab Fix merge for ./jingle/
Paul Aurich <darkrain42@pidgin.im>
parents: 26620
diff changeset
444 if (type == JABBER_IQ_ERROR || xmlnode_get_child(packet, "error")) {
26311
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
445 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
446 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
447 return;
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
448 }
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
449 }
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
450
0baf4bc1b441 Wait to send transport-info until the session-initiate ack is received.
Michael Ruprecht <maiku@pidgin.im>
parents: 26303
diff changeset
451 static void
26449
9e381dc6ed24 Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents: 26441
diff changeset
452 jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26192
diff changeset
453 gchar *sid, gchar *name, JingleSession *session)
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26192
diff changeset
454 {
26449
9e381dc6ed24 Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents: 26441
diff changeset
455 purple_debug_info("jingle-rtp", "state-changed: state %d "
27974
2021706e911d Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
456 "id: %s name: %s\n", state, sid ? sid : "(null)",
2021706e911d Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
457 name ? name : "(null)");
26441
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
458 }
26194
b8aab50491f4 Use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26193
diff changeset
459
26441
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
460 static void
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
461 jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
26496
11e1e5221460 Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26495
diff changeset
462 gchar *sid, gchar *name, gboolean local,
11e1e5221460 Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26495
diff changeset
463 JingleSession *session)
26441
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
464 {
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
465 purple_debug_info("jingle-rtp", "stream-info: type %d "
27974
2021706e911d Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
466 "id: %s name: %s\n", type, sid ? sid : "(null)",
2021706e911d Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
467 name ? name : "(null)");
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
468
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
469 g_return_if_fail(JINGLE_IS_SESSION(session));
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
470
26441
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
471 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
472 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
473 session, "success"));
26194
b8aab50491f4 Use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26193
diff changeset
474 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
475 } 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
476 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
477 session, "decline"));
46a5bb7783e7 Use stream-info instead of state-changed for hangup and reject.
Michael Ruprecht <maiku@pidgin.im>
parents: 26437
diff changeset
478 g_object_unref(session);
28111
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
479 } else if (type == PURPLE_MEDIA_INFO_ACCEPT &&
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
480 jingle_session_is_initiator(session) == FALSE) {
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
481 jingle_rtp_ready(session);
26194
b8aab50491f4 Use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26193
diff changeset
482 }
26193
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26192
diff changeset
483 }
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26192
diff changeset
484
26431
993517d98857 Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents: 26428
diff changeset
485 static void
26437
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
486 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
487 {
993517d98857 Move sending session-initiate out of the ready-new callback.
Michael Ruprecht <maiku@pidgin.im>
parents: 26428
diff changeset
488 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
489
26437
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
490 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
491 purple_media_codecs_ready(media, NULL) &&
26437
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
492 (jingle_session_is_initiator(session) == TRUE ||
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
493 purple_media_accepted(media, NULL, NULL))) {
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
494 if (jingle_session_is_initiator(session)) {
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
495 JabberIq *iq = jingle_session_to_packet(
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
496 session, JINGLE_SESSION_INITIATE);
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
497 jabber_iq_set_callback(iq,
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
498 jingle_rtp_initiate_ack_cb, session);
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
499 jabber_iq_send(iq);
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
500 } else {
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
501 jabber_iq_send(jingle_session_to_packet(session,
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
502 JINGLE_SESSION_ACCEPT));
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
503 }
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
504
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
505 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
506 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
507 session);
26437
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
508 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
509 G_CALLBACK(jingle_rtp_codecs_changed_cb),
02b645aac6ee Stop sending multiple session-initiate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26433
diff changeset
510 session);
26433
3213aeff8bdb Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26431
diff changeset
511 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
512 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
513 session);
3213aeff8bdb Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26431
diff changeset
514 }
3213aeff8bdb Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26431
diff changeset
515 }
3213aeff8bdb Move sending session-accept out of the ready-new signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26431
diff changeset
516
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
517 static PurpleMedia *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
518 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
519 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
520 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
521 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
522 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
523
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
524 PurpleMedia *media = purple_media_manager_create_media(
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
525 purple_media_manager_get(),
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
526 purple_connection_get_account(js->gc),
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
527 "fsrtpconference", remote_jid,
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26696
diff changeset
528 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
529 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
530
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
531 if (!media) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
532 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
533 return NULL;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
534 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
535
26330
9d627ae05002 Get rid of the medias variable in JabberStream.
Michael Ruprecht <maiku@pidgin.im>
parents: 26325
diff changeset
536 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
537
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
538 /* connect callbacks */
26417
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
539 g_signal_connect(G_OBJECT(media), "candidates-prepared",
b73b6e73abe6 Add candidates-prepared signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26416
diff changeset
540 G_CALLBACK(jingle_rtp_candidates_prepared_cb), session);
26265
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
541 g_signal_connect(G_OBJECT(media), "codecs-changed",
66aee93241e2 Added codecs-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26264
diff changeset
542 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
543 g_signal_connect(G_OBJECT(media), "state-changed",
101122f0f3dd Add state-changed signal to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26192
diff changeset
544 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
545 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
546 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
547
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
548 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
549 return media;
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
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
552 static gboolean
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
553 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
554 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
555 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
556 PurpleMedia *media = jingle_rtp_get_media(session);
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
557 gchar *creator;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
558 gchar *media_type;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
559 gchar *remote_jid;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
560 gchar *senders;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
561 gchar *name;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
562 const gchar *transmitter;
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
563 gboolean is_audio;
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
564 gboolean is_creator;
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
565 PurpleMediaSessionType type;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
566 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
567 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
568 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
569
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
570 /* 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
571 if (media == NULL)
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
572 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
573
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
574 if (media == NULL)
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
575 return FALSE;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
576
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
577 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
578 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
579 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
580 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
581 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
582
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
583 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
584 transmitter = "rawudp";
26166
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
585 else if (JINGLE_IS_ICEUDP(transport))
ad7d09fef256 Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26161
diff changeset
586 transmitter = "nice";
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
587 else
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
588 transmitter = "notransmitter";
26410
5952dcb9ce6c Plug some memory leaks related to transports.
Michael Ruprecht <maiku@pidgin.im>
parents: 26407
diff changeset
589 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
590
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
591 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
592
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
593 if (!strcmp(senders, "both"))
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
594 type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
595 : PURPLE_MEDIA_VIDEO;
28161
4368c139d67f Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
596 else if ((strcmp(senders, "initiator") == 0) ==
4368c139d67f Fix unidirectional media sessions and add a colorspace before the video sink.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
597 jingle_session_is_initiator(session))
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
598 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
599 : 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
600 else
26226
dcb05990f479 Make FsStreamDirection and FsMediaType conversion functions static.
Michael Ruprecht <maiku@pidgin.im>
parents: 26215
diff changeset
601 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
602 : 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
603
26286
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26266
diff changeset
604 params =
443041606e32 Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <malu@pidgin.im>
parents: 26266
diff changeset
605 jingle_get_params(jingle_session_get_js(session), &num_params);
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
606
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
607 creator = jingle_content_get_creator(content);
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
608 if (!strcmp(creator, "initiator"))
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
609 is_creator = jingle_session_is_initiator(session);
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
610 else
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
611 is_creator = !jingle_session_is_initiator(session);
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
612 g_free(creator);
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
613
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
614 purple_media_add_stream(media, name, remote_jid,
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
615 type, is_creator, 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
616
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
617 g_free(name);
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
618 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
619 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
620 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
621 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
622 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
623
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
624 return TRUE;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
625 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
626
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
627 static GList *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
628 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
629 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
630 GList *codecs = NULL;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
631 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
632 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
633 PurpleMediaCodec *codec;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
634 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
635 PurpleMediaSessionType type =
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26229
diff changeset
636 !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
637 !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
638
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
639 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
640 codec_element ;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
641 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
642 xmlnode *param;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
643 gchar *codec_str;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
644 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
645
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
646 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
647 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
648
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26229
diff changeset
649 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
650 type,
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
651 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
652
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
653 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
654 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
655 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
656 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
657 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
658 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
659
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26229
diff changeset
660 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
661 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
662 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
663
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
664 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
665 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
666 return codecs;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
667 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
668
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
669 static JingleContent *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
670 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
671 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
672 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
673 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
674 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
675 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
676 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
677 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
678 if (ssrc != NULL)
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
679 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
680 return content;
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 static void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
684 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
685 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
686 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
687 PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data;
26618
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
688 GList *iter = purple_media_codec_get_optional_parameters(codec);
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
689 gchar *id, *name, *clockrate, *channels;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
690 gchar *codec_str;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
691 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
692
26618
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
693 id = g_strdup_printf("%d",
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
694 purple_media_codec_get_id(codec));
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
695 name = purple_media_codec_get_encoding_name(codec);
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
696 clockrate = g_strdup_printf("%d",
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
697 purple_media_codec_get_clock_rate(codec));
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
698 channels = g_strdup_printf("%d",
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
699 purple_media_codec_get_channels(codec));
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
700
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
701 xmlnode_set_attrib(payload, "name", name);
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
702 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
703 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
704 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
705
26618
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
706 g_free(channels);
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
707 g_free(clockrate);
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
708 g_free(name);
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
709 g_free(id);
9e9e610ca1a1 Hide and gobjectify PurpleMediaCodec.
Michael Ruprecht <maiku@pidgin.im>
parents: 26617
diff changeset
710
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
711 for (; iter; iter = g_list_next(iter)) {
26617
514bdfc137d5 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
712 PurpleKeyValuePair *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
713 xmlnode *param = xmlnode_new_child(payload, "parameter");
26617
514bdfc137d5 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
714 xmlnode_set_attrib(param, "name", mparam->key);
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26229
diff changeset
715 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
716 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
717
26232
f91c96072586 Wrap FsCodec and remove the Farsight2 include from media.h.
Michael Ruprecht <maiku@pidgin.im>
parents: 26229
diff changeset
718 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
719 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
720 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
721 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
722 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
723
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
724 static xmlnode *
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
725 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
726 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
727 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
728 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
729 if (description != NULL) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
730 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
731 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
732 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
733 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
734 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
735 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
736
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
737 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
738
26405
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
739 if (ssrc != NULL)
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
740 xmlnode_set_attrib(description, "ssrc", ssrc);
4cf4d5dcc183 Add ssrc property to JingleRtp.
Michael Ruprecht <maiku@pidgin.im>
parents: 26404
diff changeset
741
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
742 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
743 g_free(name);
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
744 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
745
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
746 jingle_rtp_add_payloads(description, codecs);
26428
77d845d3e0c3 Plug memory leak.
Michael Ruprecht <maiku@pidgin.im>
parents: 26422
diff changeset
747 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
748 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
749 return node;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
750 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
751
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
752 static void
26149
92b095c37277 Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
753 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
754 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
755 switch (action) {
26407
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
756 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
757 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
758 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
759 JingleTransport *transport = jingle_transport_parse(
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
760 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
761 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
762 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
763 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
764 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
765 gchar *remote_jid =
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
766 jingle_session_get_remote_jid(session);
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
767 PurpleMedia *media;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
768
26407
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
769 if (action == JINGLE_SESSION_INITIATE &&
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
770 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
771 /* XXX: send error */
26404
3947a428b87d Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26330
diff changeset
772 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
773 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
774 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
775 break;
1ba69535986d Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents: 26154
diff changeset
776 }
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
777
26407
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
778 media = jingle_rtp_get_media(session);
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
779 purple_media_set_remote_codecs(media,
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
780 name, remote_jid, codecs);
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
781 purple_media_add_remote_candidates(media,
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
782 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
783
26501
c186275f46aa Remove purple_media_accept.
Michael Ruprecht <maiku@pidgin.im>
parents: 26499
diff changeset
784 if (action == JINGLE_SESSION_ACCEPT)
c186275f46aa Remove purple_media_accept.
Michael Ruprecht <maiku@pidgin.im>
parents: 26499
diff changeset
785 purple_media_stream_info(media,
c186275f46aa Remove purple_media_accept.
Michael Ruprecht <maiku@pidgin.im>
parents: 26499
diff changeset
786 PURPLE_MEDIA_INFO_ACCEPT,
c186275f46aa Remove purple_media_accept.
Michael Ruprecht <maiku@pidgin.im>
parents: 26499
diff changeset
787 name, remote_jid, FALSE);
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
788
26407
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
789 g_free(remote_jid);
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
790 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
791 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
792 break;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
793 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
794 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
795 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
796 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
797
ca6d9f19c4b6 Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
798 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
799 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
800 }
ca6d9f19c4b6 Remove PurpleMedias from JabberStream's list when a media session ends.
Michael Ruprecht <maiku@pidgin.im>
parents: 26191
diff changeset
801
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
802 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
803 break;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
804 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
805 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
806 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
807 JingleTransport *transport = jingle_transport_parse(
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
808 xmlnode_get_child(xmlcontent, "transport"));
78fa18d44718 Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents: 26149
diff changeset
809 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
810 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
811 gchar *remote_jid =
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
812 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
813
26407
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
814 purple_media_add_remote_candidates(
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
815 jingle_rtp_get_media(session),
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
816 name, remote_jid, candidates);
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
817
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
818 g_free(remote_jid);
48782a6424e0 Update Jingle Ice-Udp according to the XEP.
Michael Ruprecht <maiku@pidgin.im>
parents: 26405
diff changeset
819 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
820 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
821 break;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
822 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
823 default:
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
824 break;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
825 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
826 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
827
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
828 gboolean
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
829 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
830 PurpleMediaSessionType type)
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
831 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
832 /* create content negotiation */
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
833 JingleSession *session;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
834 JingleContent *content;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
835 JingleTransport *transport;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
836 JabberBuddy *jb;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
837 JabberBuddyResource *jbr;
26170
829055c78478 Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26166
diff changeset
838 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
839
26643
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
840 gchar *resource = NULL, *me = NULL, *sid = NULL;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
841
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
842 /* 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
843 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
844 if (!jb) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
845 purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n");
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
846 return FALSE;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
847 }
26643
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
848
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
849 resource = jabber_get_resource(who);
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
850 jbr = jabber_buddy_find_resource(jb, resource);
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
851 g_free(resource);
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
852
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
853 if (!jbr) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
854 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
855 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
856
26170
829055c78478 Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26166
diff changeset
857 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
858 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
859 } 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
860 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
861 } else {
829055c78478 Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26166
diff changeset
862 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
863 "the same transport types\n");
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
864 return FALSE;
26170
829055c78478 Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26166
diff changeset
865 }
829055c78478 Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26166
diff changeset
866
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
867 /* 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
868 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
869
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
870 sid = jabber_get_next_id(js);
26643
401d7a92ecb1 Add a resource selector when initiating media.
Michael Ruprecht <maiku@pidgin.im>
parents: 26620
diff changeset
871 session = jingle_session_create(js, sid, me, who, TRUE);
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
872 g_free(sid);
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
873
26149
92b095c37277 Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
874
92b095c37277 Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
875 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
876 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
877 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
878 "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
879 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
880 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
881 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
882 }
92b095c37277 Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
883 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
884 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
885 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
886 "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
887 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
888 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
889 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
890 }
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
891
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
892 g_free(me);
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
893
26495
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
894 if (jingle_rtp_get_media(session) == NULL) {
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
895 return FALSE;
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
896 }
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
897
52846ebe1c7d Don't assume a PurpleMedia instance will be created immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26449
diff changeset
898 return TRUE;
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
899 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
900
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
901 void
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
902 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
903 {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
904 JingleSession *session;
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
905 /* 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
906 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
907
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
908 if (session) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
909 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
910 if (media) {
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
911 purple_debug_info("jingle-rtp", "hanging up media\n");
26499
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
912 purple_media_stream_info(media,
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
913 PURPLE_MEDIA_INFO_HANGUP,
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
914 NULL, NULL, TRUE);
26147
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
915 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
916 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
917 }
791ee9c9a75e Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
918
26215
9ecaa256d77b Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26198
diff changeset
919 #endif /* USE_VV */
9ecaa256d77b Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26198
diff changeset
920

mercurial