Sun, 04 Jan 2009 05:19:54 +0000
Add initiator property to PurpleMedia.
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
1 | /** |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
2 | * @file rtp.c |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
3 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
4 | * purple |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
5 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
6 | * This program is free software; you can redistribute it and/or modify |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
7 | * it under the terms of the GNU General Public License as published by |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
8 | * the Free Software Foundation; either version 2 of the License, or |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
9 | * (at your option) any later version. |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
10 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
11 | * This program is distributed in the hope that it will be useful, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
14 | * GNU General Public License for more details. |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
15 | * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
16 | * You should have received a copy of the GNU General Public License |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
17 | * along with this program; if not, write to the Free Software |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
19 | */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
20 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
21 | #include "config.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
22 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
23 | #include "jabber.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
24 | #include "jingle.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
25 | #include "media.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
26 | #include "mediamanager.h" |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
27 | #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
|
28 | #include "rawudp.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
29 | #include "rtp.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
30 | #include "session.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
31 | #include "debug.h" |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
32 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
33 | #include <string.h> |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
34 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
35 | struct _JingleRtpPrivate |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
36 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
37 | gchar *media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
38 | gboolean candidates_ready; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
39 | gboolean codecs_ready; |
|
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 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
42 | #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
|
43 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
44 | 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
|
45 | 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
|
46 | 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
|
47 | 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
|
48 | 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
|
49 | 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
|
50 | 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
|
51 | 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
|
52 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
53 | 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
|
54 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
55 | 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
|
56 | #if 0 |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
57 | enum { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
58 | LAST_SIGNAL |
|
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 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
|
61 | #endif |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
62 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
63 | enum { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
64 | PROP_0, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
65 | PROP_MEDIA_TYPE, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
66 | }; |
|
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 | GType |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
69 | 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
|
70 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
71 | 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
|
72 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
73 | if (type == 0) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
74 | 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
|
75 | sizeof(JingleRtpClass), |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
76 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
77 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
78 | (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
|
79 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
80 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
81 | sizeof(JingleRtp), |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
82 | 0, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
83 | (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
|
84 | NULL |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
85 | }; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
86 | 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
|
87 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
88 | return type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
89 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
90 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
91 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
92 | 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
|
93 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
94 | 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
|
95 | 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
|
96 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
97 | 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
|
98 | 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
|
99 | 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
|
100 | 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
|
101 | 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
|
102 | 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
|
103 | 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
|
104 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
105 | 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
|
106 | 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
|
107 | "Media Type", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
108 | "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
|
109 | NULL, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
110 | G_PARAM_READWRITE)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
111 | 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
|
112 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
113 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
114 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
115 | 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
|
116 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
117 | rtp->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
|
118 | memset(rtp->priv, 0, sizeof(rtp->priv)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
119 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
120 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
121 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
122 | 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
|
123 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
124 | 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
|
125 | 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
|
126 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
127 | g_free(priv->media_type); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
128 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
129 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
130 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
131 | jingle_rtp_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
|
132 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
133 | JingleRtp *rtp; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
134 | 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
|
135 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
136 | 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
|
137 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
138 | switch (prop_id) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
139 | 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
|
140 | 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
|
141 | 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
|
142 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
143 | default: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
144 | 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
|
145 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
146 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
147 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
148 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
149 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
150 | 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
|
151 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
152 | JingleRtp *rtp; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
153 | 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
|
154 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
155 | 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
|
156 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
157 | switch (prop_id) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
158 | 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
|
159 | 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
|
160 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
161 | default: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
162 | 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
|
163 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
164 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
165 | } |
|
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 | static gboolean |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
168 | jingle_rtp_ready_to_initiate(JingleSession *session, PurpleMedia *media) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
169 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
170 | if (jingle_session_is_initiator(session)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
171 | GList *iter = jingle_session_get_contents(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
172 | for (; iter; iter = g_list_next(iter)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
173 | JingleContent *content = iter->data; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
174 | gchar *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
|
175 | if (!JINGLE_IS_RTP(content) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
176 | || JINGLE_RTP_GET_PRIVATE(content)->codecs_ready == FALSE |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
177 | || JINGLE_RTP_GET_PRIVATE(content)->candidates_ready == FALSE) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
178 | g_free(name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
179 | return FALSE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
180 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
181 | g_free(name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
182 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
183 | return TRUE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
184 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
185 | return FALSE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
186 | } |
|
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 | gchar * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
189 | 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
|
190 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
191 | gchar *media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
192 | 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
|
193 | return media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
194 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
195 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
196 | static PurpleMedia * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
197 | 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
|
198 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
199 | 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
|
200 | gchar *sid = jingle_session_get_sid(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
201 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
202 | PurpleMedia *media = (PurpleMedia *) (js->medias) ? |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
203 | g_hash_table_lookup(js->medias, sid) : NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
204 | g_free(sid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
205 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
206 | return media; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
207 | } |
|
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 | static JingleTransport * |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
210 | 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
|
211 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
212 | if (type == JINGLE_TYPE_RAWUDP) { |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
213 | gchar *id = jabber_get_next_id(jingle_session_get_js(session)); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
214 | 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
|
215 | JingleRawUdpCandidate *rawudp_candidate; |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
216 | for (; candidates; candidates = g_list_next(candidates)) { |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
217 | FsCandidate *candidate = candidates->data; |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
218 | id = jabber_get_next_id(jingle_session_get_js(session)); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
219 | rawudp_candidate = jingle_rawudp_candidate_new(id, |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
220 | generation, candidate->component_id, |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
221 | candidate->ip, candidate->port); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
222 | jingle_rawudp_add_local_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
223 | } |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
224 | g_free(id); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
225 | return transport; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
226 | } else if (type == JINGLE_TYPE_ICEUDP) { |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
227 | JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
228 | JingleIceUdpCandidate *iceudp_candidate; |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
229 | for (; candidates; candidates = g_list_next(candidates)) { |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
230 | FsCandidate *candidate = candidates->data; |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
231 | iceudp_candidate = jingle_iceudp_candidate_new(candidate->component_id, |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
232 | candidate->foundation, generation, candidate->ip, |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
233 | 0, candidate->port, candidate->priority, "udp", |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
234 | candidate->type == FS_CANDIDATE_TYPE_HOST ? "host" : |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
235 | candidate->type == FS_CANDIDATE_TYPE_SRFLX ? "srflx" : |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
236 | candidate->type == FS_CANDIDATE_TYPE_PRFLX ? "prflx" : |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
237 | candidate->type == FS_CANDIDATE_TYPE_RELAY ? "relay" : "", |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
238 | candidate->username, candidate->password); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
239 | jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
240 | } |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
241 | return transport; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
242 | } else { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
243 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
244 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
245 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
246 | |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
247 | static GList * |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
248 | 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
|
249 | { |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
250 | 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
|
251 | 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
|
252 | 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
|
253 | 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
|
254 | |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
255 | 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
|
256 | JingleRawUdpCandidate *candidate = candidates->data; |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
257 | ret = g_list_append(ret, fs_candidate_new("", candidate->component, |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
258 | FS_CANDIDATE_TYPE_SRFLX, FS_NETWORK_PROTOCOL_UDP, |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
259 | candidate->ip, candidate->port)); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
260 | } |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
261 | |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
262 | return ret; |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
263 | } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) { |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
264 | 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
|
265 | |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
266 | 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
|
267 | JingleIceUdpCandidate *candidate = candidates->data; |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
268 | FsCandidate *fscandidate = fs_candidate_new( |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
269 | candidate->foundation, candidate->component, |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
270 | !strcmp(candidate->type, "host") ? FS_CANDIDATE_TYPE_HOST : |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
271 | !strcmp(candidate->type, "srflx") ? FS_CANDIDATE_TYPE_SRFLX : |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
272 | !strcmp(candidate->type, "prflx") ? FS_CANDIDATE_TYPE_PRFLX : |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
273 | !strcmp(candidate->type, "relay") ? FS_CANDIDATE_TYPE_RELAY : 0, |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
274 | FS_NETWORK_PROTOCOL_UDP, candidate->ip, candidate->port); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
275 | fscandidate->username = g_strdup(candidate->username); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
276 | fscandidate->password = g_strdup(candidate->password); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
277 | fscandidate->priority = candidate->priority; |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
278 | ret = g_list_append(ret, fscandidate); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
279 | } |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
280 | |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
281 | return ret; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
282 | } else { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
283 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
284 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
285 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
286 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
287 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
288 | jingle_rtp_accept_cb(PurpleMedia *media, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
289 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
290 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
291 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
292 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
293 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
294 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
295 | jingle_rtp_reject_cb(PurpleMedia *media, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
296 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
297 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
298 | 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
|
299 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
300 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
301 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
302 | jingle_rtp_hangup_cb(PurpleMedia *media, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
303 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
304 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE)); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
305 | 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
|
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 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
309 | jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, FsCandidate *candidate, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
310 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
311 | purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
312 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
313 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
314 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
315 | jingle_rtp_candidates_prepared_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
316 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
317 | JingleContent *content = jingle_session_find_content(session, sid, "initiator"); |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
318 | JingleTransport *oldtransport = jingle_content_get_transport(content); |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
319 | GList *candidates = purple_media_get_local_candidates(media, sid, name); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
320 | JingleTransport *transport = |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
321 | JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport( |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
322 | session, JINGLE_IS_RAWUDP(oldtransport) ? |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
323 | JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP, |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
324 | 0, candidates)); |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
325 | g_list_free(candidates); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
326 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
327 | JINGLE_RTP_GET_PRIVATE(content)->candidates_ready = TRUE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
328 | |
|
26154
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
329 | jingle_content_set_pending_transport(content, transport); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
330 | jingle_content_accept_transport(content); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
331 | |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
332 | if (jingle_rtp_ready_to_initiate(session, media)) { |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
333 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE)); |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
334 | if (JINGLE_IS_ICEUDP(transport)) |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
335 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO)); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
336 | } |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
337 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
338 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
339 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
340 | jingle_rtp_candidate_pair_established_cb(PurpleMedia *media, FsCandidate *local_candidate, FsCandidate *remote_candidate, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
341 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
342 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
343 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
344 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
345 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
346 | jingle_rtp_codecs_ready_cb(PurpleMedia *media, gchar *sid, JingleSession *session) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
347 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
348 | JingleContent *content = jingle_session_find_content(session, sid, "initiator"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
349 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
350 | if (content == NULL) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
351 | content = jingle_session_find_content(session, sid, "responder"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
352 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
353 | if (JINGLE_RTP_GET_PRIVATE(content)->codecs_ready == FALSE) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
354 | JINGLE_RTP_GET_PRIVATE(content)->codecs_ready = |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
355 | purple_media_codecs_ready(media, sid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
356 | |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
357 | if (jingle_rtp_ready_to_initiate(session, media)) { |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
358 | JingleTransport *transport = jingle_content_get_transport(content); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
359 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE)); |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
360 | if (JINGLE_IS_ICEUDP(transport)) |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
361 | jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO)); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
362 | } |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
363 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
364 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
365 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
366 | static PurpleMedia * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
367 | 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
|
368 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
369 | 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
|
370 | 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
|
371 | 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
|
372 | gchar *sid = jingle_session_get_sid(session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
373 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
374 | PurpleMedia *media = purple_media_manager_create_media(purple_media_manager_get(), |
|
26187
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26170
diff
changeset
|
375 | js->gc, "fsrtpconference", remote_jid, |
|
3b3059a7c091
Add initiator property to PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26170
diff
changeset
|
376 | 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
|
377 | 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
|
378 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
379 | if (!media) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
380 | 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
|
381 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
382 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
383 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
384 | /* insert it into the hash table */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
385 | if (!js->medias) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
386 | purple_debug_info("jingle-rtp", "Creating hash table for media\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
387 | js->medias = g_hash_table_new(g_str_hash, g_str_equal); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
388 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
389 | purple_debug_info("jingle-rtp", "inserting media with sid: %s into table\n", sid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
390 | g_hash_table_insert(js->medias, sid, media); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
391 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
392 | /* connect callbacks */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
393 | g_signal_connect(G_OBJECT(media), "accepted", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
394 | G_CALLBACK(jingle_rtp_accept_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
395 | g_signal_connect(G_OBJECT(media), "reject", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
396 | G_CALLBACK(jingle_rtp_reject_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
397 | g_signal_connect(G_OBJECT(media), "hangup", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
398 | G_CALLBACK(jingle_rtp_hangup_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
399 | g_signal_connect(G_OBJECT(media), "new-candidate", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
400 | G_CALLBACK(jingle_rtp_new_candidate_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
401 | g_signal_connect(G_OBJECT(media), "candidates-prepared", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
402 | G_CALLBACK(jingle_rtp_candidates_prepared_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
403 | g_signal_connect(G_OBJECT(media), "candidate-pair", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
404 | G_CALLBACK(jingle_rtp_candidate_pair_established_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
405 | g_signal_connect(G_OBJECT(media), "codecs-ready", |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
406 | G_CALLBACK(jingle_rtp_codecs_ready_cb), session); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
407 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
408 | 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
|
409 | return media; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
410 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
411 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
412 | static gboolean |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
413 | 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
|
414 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
415 | 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
|
416 | 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
|
417 | gchar *media_type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
418 | gchar *remote_jid; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
419 | gchar *senders; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
420 | gchar *name; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
421 | const gchar *transmitter; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
422 | FsMediaType type; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
423 | FsStreamDirection direction; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
424 | JingleTransport *transport; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
425 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
426 | /* 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
|
427 | if (media == NULL) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
428 | 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
|
429 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
430 | if (media == NULL) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
431 | return FALSE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
432 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
433 | 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
|
434 | 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
|
435 | 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
|
436 | 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
|
437 | 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
|
438 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
439 | 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
|
440 | transmitter = "rawudp"; |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
441 | else if (JINGLE_IS_ICEUDP(transport)) |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
442 | transmitter = "nice"; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
443 | else |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
444 | transmitter = "notransmitter"; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
445 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
446 | if (!strcmp(media_type, "audio")) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
447 | type = FS_MEDIA_TYPE_AUDIO; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
448 | else |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
449 | type = FS_MEDIA_TYPE_VIDEO; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
450 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
451 | if (!strcmp(senders, "both")) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
452 | direction = FS_DIRECTION_BOTH; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
453 | else if (!strcmp(senders, "initiator") |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
454 | && jingle_session_is_initiator(session)) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
455 | direction = FS_DIRECTION_SEND; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
456 | else |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
457 | direction = FS_DIRECTION_RECV; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
458 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
459 | purple_media_add_stream(media, name, remote_jid, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
460 | purple_media_from_fs(type, direction), |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
461 | transmitter, 0, NULL); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
462 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
463 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
464 | g_free(name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
465 | 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
|
466 | 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
|
467 | g_free(senders); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
468 | 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
|
469 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
470 | return TRUE; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
471 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
472 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
473 | static GList * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
474 | 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
|
475 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
476 | GList *codecs = NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
477 | 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
|
478 | const char *encoding_name,*id, *clock_rate; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
479 | FsCodec *codec; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
480 | const gchar *media = xmlnode_get_attrib(description, "media"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
481 | FsMediaType type = !strcmp(media, "video") ? FS_MEDIA_TYPE_VIDEO : |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
482 | !strcmp(media, "audio") ? FS_MEDIA_TYPE_AUDIO : 0; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
483 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
484 | 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
|
485 | codec_element ; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
486 | 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
|
487 | xmlnode *param; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
488 | gchar *codec_str; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
489 | 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
|
490 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
491 | 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
|
492 | 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
|
493 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
494 | codec = fs_codec_new(atoi(id), encoding_name, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
495 | type, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
496 | 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
|
497 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
498 | 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
|
499 | param; param = xmlnode_get_next_twin(param)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
500 | fs_codec_add_optional_parameter(codec, |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
501 | 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
|
502 | 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
|
503 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
504 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
505 | codec_str = fs_codec_to_string(codec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
506 | 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
|
507 | 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
|
508 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
509 | 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
|
510 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
511 | return codecs; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
512 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
513 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
514 | static JingleContent * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
515 | 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
|
516 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
517 | 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
|
518 | 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
|
519 | const gchar *media_type = xmlnode_get_attrib(description, "media"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
520 | 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
|
521 | g_object_set(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
|
522 | return content; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
523 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
524 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
525 | static void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
526 | 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
|
527 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
528 | for (; codecs ; codecs = codecs->next) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
529 | FsCodec *codec = (FsCodec*)codecs->data; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
530 | GList *iter = codec->optional_params; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
531 | char id[8], clockrate[10], channels[10]; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
532 | gchar *codec_str; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
533 | 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
|
534 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
535 | g_snprintf(id, sizeof(id), "%d", codec->id); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
536 | g_snprintf(clockrate, sizeof(clockrate), "%d", codec->clock_rate); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
537 | g_snprintf(channels, sizeof(channels), "%d", codec->channels); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
538 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
539 | xmlnode_set_attrib(payload, "name", codec->encoding_name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
544 | for (; iter; iter = g_list_next(iter)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
545 | FsCodecParameter *fsparam = iter->data; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
546 | xmlnode *param = xmlnode_new_child(payload, "parameter"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
547 | xmlnode_set_attrib(param, "name", fsparam->name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
548 | xmlnode_set_attrib(param, "value", fsparam->value); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
549 | } |
|
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 | codec_str = fs_codec_to_string(codec); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
552 | 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
|
553 | 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
|
554 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
555 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
556 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
557 | static xmlnode * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
558 | 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
|
559 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
560 | 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
|
561 | 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
|
562 | if (description != NULL) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
563 | 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
|
564 | 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
|
565 | gchar *media_type = jingle_rtp_get_media_type(rtp); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
566 | 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
|
567 | 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
|
568 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
569 | 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
|
570 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
571 | 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
|
572 | g_free(name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
573 | 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
|
574 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
575 | jingle_rtp_add_payloads(description, codecs); |
|
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 | return node; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
578 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
579 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
580 | static void |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
581 | 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
|
582 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
583 | switch (action) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
584 | case JINGLE_SESSION_ACCEPT: { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
585 | JingleSession *session = jingle_content_get_session(content); |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
586 | xmlnode *description = xmlnode_get_child(xmlcontent, "description"); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
587 | GList *codecs = jingle_rtp_parse_codecs(description); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
588 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
589 | purple_media_set_remote_codecs(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
|
590 | 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
|
591 | jingle_session_get_remote_jid(session), codecs); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
592 | |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
593 | /* This needs to be for the entire session, not a single content */ |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
594 | /* very hacky */ |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
595 | if (xmlnode_get_next_twin(xmlcontent) == NULL) |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
596 | purple_media_got_accept(jingle_rtp_get_media(session)); |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
597 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
598 | 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
|
599 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
600 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
601 | 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
|
602 | 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
|
603 | JingleTransport *transport = jingle_transport_parse( |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
604 | 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
|
605 | 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
|
606 | 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
|
607 | GList *codecs = jingle_rtp_parse_codecs(description); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
608 | |
|
26156
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
609 | if (jingle_rtp_init_media(content) == FALSE) { |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
610 | /* XXX: send error */ |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
611 | jabber_iq_send(jingle_session_to_packet(session, |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
612 | JINGLE_SESSION_TERMINATE)); |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
613 | 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
|
614 | break; |
|
1ba69535986d
Fix crash when remote client reconnects and tries to restart the media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26154
diff
changeset
|
615 | } |
|
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 | purple_media_set_remote_codecs(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
|
618 | 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
|
619 | jingle_session_get_remote_jid(session), codecs); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
620 | |
|
26166
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
621 | if (JINGLE_IS_RAWUDP(transport)) { |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
622 | purple_media_add_remote_candidates(jingle_rtp_get_media(session), |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
623 | jingle_content_get_name(content), |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
624 | jingle_session_get_remote_jid(session), |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
625 | candidates); |
|
ad7d09fef256
Added a Jingle ice-udp transmitter.
Michael Ruprecht <maiku@pidgin.im>
parents:
26161
diff
changeset
|
626 | } |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
627 | |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
628 | /* very hacky */ |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
629 | if (xmlnode_get_next_twin(xmlcontent) == NULL) |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
630 | purple_media_ready(jingle_rtp_get_media(session)); |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
631 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
632 | 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
|
633 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
634 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
635 | 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
|
636 | 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
|
637 | purple_media_got_hangup(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
|
638 | 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
|
639 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
640 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
641 | 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
|
642 | 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
|
643 | JingleTransport *transport = jingle_transport_parse( |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
644 | xmlnode_get_child(xmlcontent, "transport")); |
|
78fa18d44718
Update Jingle raw-udp to latest spec version.
Michael Ruprecht <maiku@pidgin.im>
parents:
26149
diff
changeset
|
645 | 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
|
646 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
647 | purple_media_add_remote_candidates(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
|
648 | 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
|
649 | 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
|
650 | candidates); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
651 | 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
|
652 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
653 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
654 | default: |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
655 | break; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
656 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
657 | } |
|
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 | PurpleMedia * |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
660 | 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
|
661 | PurpleMediaSessionType type) |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
662 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
663 | /* create content negotiation */ |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
664 | JingleSession *session; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
665 | JingleContent *content; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
666 | JingleTransport *transport; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
667 | JabberBuddy *jb; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
668 | JabberBuddyResource *jbr; |
|
26161
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
669 | PurpleMedia *media; |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
670 | 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
|
671 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
672 | gchar *jid = NULL, *me = NULL, *sid = NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
673 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
674 | /* 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
|
675 | 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
|
676 | if (!jb) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
677 | purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
678 | return NULL; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
679 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
680 | jbr = jabber_buddy_find_resource(jb, NULL); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
681 | if (!jbr) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
682 | 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
|
683 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
684 | |
|
26170
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
685 | 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
|
686 | 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
|
687 | } 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
|
688 | 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
|
689 | } else { |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
690 | 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
|
691 | "the same transport types\n"); |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
692 | return NULL; |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
693 | } |
|
829055c78478
Choose the transport type according to the responder's caps.
Michael Ruprecht <maiku@pidgin.im>
parents:
26166
diff
changeset
|
694 | |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
695 | if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
696 | jid = g_strdup_printf("%s/%s", who, jbr->name); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
697 | } else { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
698 | jid = g_strdup(who); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
699 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
700 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
701 | /* 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
|
702 | 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
|
703 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
704 | sid = jabber_get_next_id(js); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
705 | session = jingle_session_create(js, sid, me, jid, TRUE); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
706 | g_free(sid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
707 | |
|
26149
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
708 | |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
709 | 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
|
710 | 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
|
711 | 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
|
712 | "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
|
713 | 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
|
714 | 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
|
715 | 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
|
716 | } |
|
92b095c37277
Fix support for audio and video (at the same time) sessions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26147
diff
changeset
|
717 | 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
|
718 | 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
|
719 | 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
|
720 | "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
|
721 | 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
|
722 | 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
|
723 | 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
|
724 | } |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
725 | |
|
26161
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
726 | if ((media = jingle_rtp_get_media(session)) == NULL) { |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
727 | return NULL; |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
728 | } |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
729 | |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
730 | purple_media_ready(media); |
|
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
731 | purple_media_wait(media); |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
732 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
733 | g_free(jid); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
734 | g_free(me); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
735 | |
|
26161
7fb369b925b5
Fix a few GLib warnings when trying to start a second media session.
Michael Ruprecht <maiku@pidgin.im>
parents:
26160
diff
changeset
|
736 | return media; |
|
26147
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
737 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
738 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
739 | void |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
740 | 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
|
741 | { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
742 | JingleSession *session; |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
743 | /* 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
|
744 | 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
|
745 | |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
746 | if (session) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
747 | 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
|
748 | if (media) { |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
749 | purple_debug_info("jingle-rtp", "hanging up media\n"); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
750 | purple_media_hangup(media); |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
751 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
752 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
753 | } |
|
791ee9c9a75e
Add files I missed committing before and remove a few unnecessary functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff
changeset
|
754 |