Mercurial > pidgin
annotate libpurple/protocols/jabber/jingle/rtp.c @ 28533:52eef06b1829
Fix receiving any codecs that aren't in the codec intersection.
The g_list_concat docs said that it reused the elements. I misread that as the
data in the node, but it appears it means the node itself. Therefore, it
shouldn't be freed like I did.
author | maiku@pidgin.im |
---|---|
date | Wed, 11 Nov 2009 05:40:13 +0000 |
parents | 5f77d173f8da |
children | ffcc5c128553 0b5520bf1fe3 |
rev | line source |
---|---|
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
1 /** |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
2 * @file rtp.c |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
4 * purple |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
5 * |
28048
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27884
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27884
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27884
diff
changeset
|
8 * source distribution. |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27884
diff
changeset
|
9 * |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
13 * (at your option) any later version. |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
14 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
19 * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
23 */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
24 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
25 #include "config.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
26 |
26009
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24998
diff
changeset
|
27 #ifdef USE_VV |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24998
diff
changeset
|
28 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
29 #include "jabber.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
30 #include "jingle.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
31 #include "media.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
32 #include "mediamanager.h" |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
33 #include "iceudp.h" |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
34 #include "rawudp.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
35 #include "rtp.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
36 #include "session.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
37 #include "debug.h" |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
38 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
39 #include <string.h> |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
40 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
41 struct _JingleRtpPrivate |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
42 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
43 gchar *media_type; |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
44 gchar *ssrc; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
45 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
46 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
47 #define JINGLE_RTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RTP, JingleRtpPrivate)) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
48 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
49 static void jingle_rtp_class_init (JingleRtpClass *klass); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
50 static void jingle_rtp_init (JingleRtp *rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
51 static void jingle_rtp_finalize (GObject *object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
52 static void jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
53 static void jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
54 static JingleContent *jingle_rtp_parse_internal(xmlnode *rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
55 static xmlnode *jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
56 static void jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
57 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
58 static PurpleMedia *jingle_rtp_get_media(JingleSession *session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
59 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
60 static JingleContentClass *parent_class = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
61 #if 0 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
62 enum { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
63 LAST_SIGNAL |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
64 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
65 static guint jingle_rtp_signals[LAST_SIGNAL] = {0}; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
66 #endif |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
67 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
68 enum { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
69 PROP_0, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
70 PROP_MEDIA_TYPE, |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
71 PROP_SSRC, |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
72 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
73 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
74 GType |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
75 jingle_rtp_get_type() |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
76 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
77 static GType type = 0; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
78 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
79 if (type == 0) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
80 static const GTypeInfo info = { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
81 sizeof(JingleRtpClass), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
82 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
83 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
84 (GClassInitFunc) jingle_rtp_class_init, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
85 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
86 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
87 sizeof(JingleRtp), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
88 0, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
89 (GInstanceInitFunc) jingle_rtp_init, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
90 NULL |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
91 }; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
92 type = g_type_register_static(JINGLE_TYPE_CONTENT, "JingleRtp", &info, 0); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
93 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
94 return type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
95 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
96 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
97 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
98 jingle_rtp_class_init (JingleRtpClass *klass) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
99 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
100 GObjectClass *gobject_class = (GObjectClass*)klass; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
101 parent_class = g_type_class_peek_parent(klass); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
102 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
103 gobject_class->finalize = jingle_rtp_finalize; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
104 gobject_class->set_property = jingle_rtp_set_property; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
105 gobject_class->get_property = jingle_rtp_get_property; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
106 klass->parent_class.to_xml = jingle_rtp_to_xml_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
107 klass->parent_class.parse = jingle_rtp_parse_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
108 klass->parent_class.description_type = JINGLE_APP_RTP; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
109 klass->parent_class.handle_action = jingle_rtp_handle_action_internal; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
110 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
111 g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
112 g_param_spec_string("media-type", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
113 "Media Type", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
114 "The media type (\"audio\" or \"video\") for this rtp session.", |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
115 NULL, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
116 G_PARAM_READWRITE)); |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
117 g_object_class_install_property(gobject_class, PROP_SSRC, |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
118 g_param_spec_string("ssrc", |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
119 "ssrc", |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
120 "The ssrc for this rtp session.", |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
121 NULL, |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
122 G_PARAM_READWRITE)); |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
123 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
124 g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
125 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
126 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
127 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
128 jingle_rtp_init (JingleRtp *rtp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
129 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
130 rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp); |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
131 memset(rtp->priv, 0, sizeof(*rtp->priv)); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
132 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
133 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
134 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
135 jingle_rtp_finalize (GObject *rtp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
136 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
137 JingleRtpPrivate *priv = JINGLE_RTP_GET_PRIVATE(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
138 purple_debug_info("jingle-rtp","jingle_rtp_finalize\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
139 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
140 g_free(priv->media_type); |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
141 g_free(priv->ssrc); |
26290
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26287
diff
changeset
|
142 |
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26287
diff
changeset
|
143 G_OBJECT_CLASS(parent_class)->finalize(rtp); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
144 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
145 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
146 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
147 jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
148 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
149 JingleRtp *rtp; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
150 g_return_if_fail(JINGLE_IS_RTP(object)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
151 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
152 rtp = JINGLE_RTP(object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
153 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
154 switch (prop_id) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
155 case PROP_MEDIA_TYPE: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
156 g_free(rtp->priv->media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
157 rtp->priv->media_type = g_value_dup_string(value); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
158 break; |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
159 case PROP_SSRC: |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
160 g_free(rtp->priv->ssrc); |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
161 rtp->priv->ssrc = g_value_dup_string(value); |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
162 break; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
163 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
164 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
165 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
166 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
167 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
168 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
169 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
170 jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
171 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
172 JingleRtp *rtp; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
173 g_return_if_fail(JINGLE_IS_RTP(object)); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
174 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
175 rtp = JINGLE_RTP(object); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
176 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
177 switch (prop_id) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
178 case PROP_MEDIA_TYPE: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
179 g_value_set_string(value, rtp->priv->media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
180 break; |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
181 case PROP_SSRC: |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
182 g_value_set_string(value, rtp->priv->ssrc); |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
183 break; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
184 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
185 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
186 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
187 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
188 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
189 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
190 gchar * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
191 jingle_rtp_get_media_type(JingleContent *content) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
192 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
193 gchar *media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
194 g_object_get(content, "media-type", &media_type, NULL); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
195 return media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
196 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
197 |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
198 gchar * |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
199 jingle_rtp_get_ssrc(JingleContent *content) |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
200 { |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
201 gchar *ssrc; |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
202 g_object_get(content, "ssrc", &ssrc, NULL); |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
203 return ssrc; |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
204 } |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
205 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
206 static PurpleMedia * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
207 jingle_rtp_get_media(JingleSession *session) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
208 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
209 JabberStream *js = jingle_session_get_js(session); |
26124
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
210 PurpleMedia *media = NULL; |
26524
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
211 GList *iter = purple_media_manager_get_media_by_account( |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
212 purple_media_manager_get(), |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
213 purple_connection_get_account(js->gc)); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
214 |
26124
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
215 for (; iter; iter = g_list_delete_link(iter, iter)) { |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
216 JingleSession *media_session = |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
217 purple_media_get_prpl_data(iter->data); |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
218 if (media_session == session) { |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
219 media = iter->data; |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
220 break; |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
221 } |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
222 } |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
223 if (iter != NULL) |
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
224 g_list_free(iter); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
225 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
226 return media; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
227 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
228 |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
229 static JingleRawUdpCandidate * |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
230 jingle_rtp_candidate_to_rawudp(JingleSession *session, guint generation, |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
231 PurpleMediaCandidate *candidate) |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
232 { |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
233 gchar *id = jabber_get_next_id(jingle_session_get_js(session)); |
26406
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
234 gchar *ip = purple_media_candidate_get_ip(candidate); |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
235 JingleRawUdpCandidate *rawudp_candidate = |
26406
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
236 jingle_rawudp_candidate_new(id, generation, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
237 purple_media_candidate_get_component_id(candidate), |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
238 ip, purple_media_candidate_get_port(candidate)); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
239 g_free(ip); |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
240 g_free(id); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
241 return rawudp_candidate; |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
242 } |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
243 |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
244 static JingleIceUdpCandidate * |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
245 jingle_rtp_candidate_to_iceudp(JingleSession *session, guint generation, |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
246 PurpleMediaCandidate *candidate) |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
247 { |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
248 gchar *id = jabber_get_next_id(jingle_session_get_js(session)); |
26406
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
249 gchar *ip = purple_media_candidate_get_ip(candidate); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
250 gchar *username = purple_media_candidate_get_username(candidate); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
251 gchar *password = purple_media_candidate_get_password(candidate); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
252 PurpleMediaCandidateType type = |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
253 purple_media_candidate_get_candidate_type(candidate); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
254 |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
255 JingleIceUdpCandidate *iceudp_candidate = jingle_iceudp_candidate_new( |
26406
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
256 purple_media_candidate_get_component_id(candidate), |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
257 purple_media_candidate_get_foundation(candidate), |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
258 generation, id, ip, 0, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
259 purple_media_candidate_get_port(candidate), |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
260 purple_media_candidate_get_priority(candidate), "udp", |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
261 type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" : |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
262 type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" : |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
263 type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" : |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
264 type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
265 "", username, password); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
266 iceudp_candidate->reladdr = |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
267 purple_media_candidate_get_base_ip(candidate); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
268 iceudp_candidate->relport = |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
269 purple_media_candidate_get_base_port(candidate); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
270 g_free(password); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
271 g_free(username); |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
272 g_free(ip); |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
273 g_free(id); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
274 return iceudp_candidate; |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
275 } |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
276 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
277 static JingleTransport * |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
278 jingle_rtp_candidates_to_transport(JingleSession *session, GType type, guint generation, GList *candidates) |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
279 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
280 if (type == JINGLE_TYPE_RAWUDP) { |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
281 JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_RAWUDP); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
282 JingleRawUdpCandidate *rawudp_candidate; |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
283 for (; candidates; candidates = g_list_next(candidates)) { |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
284 PurpleMediaCandidate *candidate = candidates->data; |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
285 rawudp_candidate = jingle_rtp_candidate_to_rawudp( |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
286 session, generation, candidate); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
287 jingle_rawudp_add_local_candidate( |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
288 JINGLE_RAWUDP(transport), |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
289 rawudp_candidate); |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
290 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
291 return transport; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
292 } else if (type == JINGLE_TYPE_ICEUDP) { |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
293 JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
294 JingleIceUdpCandidate *iceudp_candidate; |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
295 for (; candidates; candidates = g_list_next(candidates)) { |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
296 PurpleMediaCandidate *candidate = candidates->data; |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
297 iceudp_candidate = jingle_rtp_candidate_to_iceudp( |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
298 session, generation, candidate); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
299 jingle_iceudp_add_local_candidate( |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
300 JINGLE_ICEUDP(transport), |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
301 iceudp_candidate); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
302 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
303 return transport; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
304 } else { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
305 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
306 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
307 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
308 |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
309 static GList * |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
310 jingle_rtp_transport_to_candidates(JingleTransport *transport) |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
311 { |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
312 const gchar *type = jingle_transport_get_transport_type(transport); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
313 GList *ret = NULL; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
314 if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) { |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
315 GList *candidates = jingle_rawudp_get_remote_candidates(JINGLE_RAWUDP(transport)); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
316 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
317 for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
318 JingleRawUdpCandidate *candidate = candidates->data; |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
319 ret = g_list_append(ret, purple_media_candidate_new( |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
320 "", candidate->component, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
321 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
322 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
323 candidate->ip, candidate->port)); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
324 } |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
325 |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
326 return ret; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
327 } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
328 GList *candidates = jingle_iceudp_get_remote_candidates(JINGLE_ICEUDP(transport)); |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
329 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
330 for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
331 JingleIceUdpCandidate *candidate = candidates->data; |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
332 PurpleMediaCandidate *new_candidate = purple_media_candidate_new( |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
333 candidate->foundation, candidate->component, |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
334 !strcmp(candidate->type, "host") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
335 PURPLE_MEDIA_CANDIDATE_TYPE_HOST : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
336 !strcmp(candidate->type, "srflx") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
337 PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
338 !strcmp(candidate->type, "prflx") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
339 PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX : |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
340 !strcmp(candidate->type, "relay") ? |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
341 PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
342 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, |
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
343 candidate->ip, candidate->port); |
26406
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
344 g_object_set(new_candidate, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
345 "base-ip", candidate->reladdr, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
346 "base-port", candidate->relport, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
347 "username", candidate->username, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
348 "password", candidate->password, |
2d332d327a0e
Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26404
diff
changeset
|
349 "priority", candidate->priority, NULL); |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
350 ret = g_list_append(ret, new_candidate); |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
351 } |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
352 |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
353 return ret; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
354 } else { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
355 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
356 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
357 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
358 |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
359 static void jingle_rtp_ready(JingleSession *session); |
26311
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
360 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
361 static void |
26299
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
362 jingle_rtp_candidates_prepared_cb(PurpleMedia *media, |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
363 gchar *sid, gchar *name, JingleSession *session) |
26298
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
364 { |
26299
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
365 JingleContent *content = jingle_session_find_content( |
26302
95794e9acf71
Use new find_content wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26300
diff
changeset
|
366 session, sid, NULL); |
26299
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
367 JingleTransport *oldtransport, *transport; |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
368 GList *candidates; |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
369 |
26298
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
370 purple_debug_info("jingle-rtp", "jingle_rtp_candidates_prepared_cb\n"); |
26299
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
371 |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
372 if (content == NULL) { |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
373 purple_debug_error("jingle-rtp", |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
374 "jingle_rtp_candidates_prepared_cb: " |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
375 "Can't find session %s\n", sid); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
376 return; |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
377 } |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
378 |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
379 oldtransport = jingle_content_get_transport(content); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
380 candidates = purple_media_get_local_candidates(media, sid, name); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
381 transport = JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport( |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
382 session, JINGLE_IS_RAWUDP(oldtransport) ? |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
383 JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP, |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
384 0, candidates)); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
385 |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
386 g_list_free(candidates); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
387 g_object_unref(oldtransport); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
388 |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
389 jingle_content_set_pending_transport(content, transport); |
d784e9ea7f50
Implement jingle_rtp_candidates_prepared_cb.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26298
diff
changeset
|
390 jingle_content_accept_transport(content); |
26311
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
391 |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
392 jingle_rtp_ready(session); |
26298
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
393 } |
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
394 |
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
395 static void |
26059
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
396 jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
397 JingleSession *session) |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
398 { |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
399 purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
400 "session_id: %s jingle_session: %p\n", sid, session); |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
401 jingle_rtp_ready(session); |
26059
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
402 } |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
403 |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
404 static void |
26021
f7cf50180e1d
Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26017
diff
changeset
|
405 jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
406 { |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
407 JingleContent *content = jingle_session_find_content( |
26302
95794e9acf71
Use new find_content wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26300
diff
changeset
|
408 session, sid, NULL); |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
409 JingleTransport *transport; |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
410 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
411 purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n"); |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
412 |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
413 if (content == NULL) { |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
414 purple_debug_error("jingle-rtp", |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
415 "jingle_rtp_new_candidate_cb: " |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
416 "Can't find session %s\n", sid); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
417 return; |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
418 } |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
419 |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
420 transport = jingle_content_get_transport(content); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
421 |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
422 if (JINGLE_IS_ICEUDP(transport)) |
26297
045be0c868a6
Silence two warnings.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
423 jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
424 jingle_rtp_candidate_to_iceudp( |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
425 session, 1, candidate)); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
426 else if (JINGLE_IS_RAWUDP(transport)) |
26297
045be0c868a6
Silence two warnings.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
427 jingle_rawudp_add_local_candidate(JINGLE_RAWUDP(transport), |
26296
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
428 jingle_rtp_candidate_to_rawudp( |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
429 session, 1, candidate)); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
430 |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
431 g_object_unref(transport); |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
432 |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
433 jabber_iq_send(jingle_session_to_packet(session, |
55c77c8e75cf
Send any additional candidates found after session-initiate or
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26290
diff
changeset
|
434 JINGLE_TRANSPORT_INFO)); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
435 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
436 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
437 static void |
26472
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26406
diff
changeset
|
438 jingle_rtp_initiate_ack_cb(JabberStream *js, const char *from, |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26406
diff
changeset
|
439 JabberIqType type, const char *id, |
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26406
diff
changeset
|
440 xmlnode *packet, gpointer data) |
26105
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
441 { |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
442 JingleSession *session = data; |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
443 |
26472
3c684403ea10
Fix merge for ./jingle/
Paul Aurich <paul@darkrain42.org>
parents:
26406
diff
changeset
|
444 if (type == JABBER_IQ_ERROR || xmlnode_get_child(packet, "error")) { |
26105
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
445 purple_media_end(jingle_rtp_get_media(session), NULL, NULL); |
26106
9cda61a15698
Free the session as well on error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26105
diff
changeset
|
446 g_object_unref(session); |
26105
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
447 return; |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
448 } |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
449 } |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
450 |
836f2e0b3b22
Wait to send transport-info until the session-initiate ack is received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26098
diff
changeset
|
451 static void |
26329
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26321
diff
changeset
|
452 jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
24993
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24992
diff
changeset
|
453 gchar *sid, gchar *name, JingleSession *session) |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24992
diff
changeset
|
454 { |
26329
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26321
diff
changeset
|
455 purple_debug_info("jingle-rtp", "state-changed: state %d " |
27712
813f2eb3fdc8
Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents:
26524
diff
changeset
|
456 "id: %s name: %s\n", state, sid ? sid : "(null)", |
813f2eb3fdc8
Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents:
26524
diff
changeset
|
457 name ? name : "(null)"); |
26321
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
458 } |
24994
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24993
diff
changeset
|
459 |
26321
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
460 static void |
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
461 jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
26366
4e1286e76f1f
Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26365
diff
changeset
|
462 gchar *sid, gchar *name, gboolean local, |
4e1286e76f1f
Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26365
diff
changeset
|
463 JingleSession *session) |
26321
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
464 { |
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
465 purple_debug_info("jingle-rtp", "stream-info: type %d " |
27712
813f2eb3fdc8
Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents:
26524
diff
changeset
|
466 "id: %s name: %s\n", type, sid ? sid : "(null)", |
813f2eb3fdc8
Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents:
26524
diff
changeset
|
467 name ? name : "(null)"); |
26524
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
468 |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
469 g_return_if_fail(JINGLE_IS_SESSION(session)); |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
470 |
26321
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
471 if (type == PURPLE_MEDIA_INFO_HANGUP) { |
26284
4f47eeaa1414
Add functions for more easily creating session-terminate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26124
diff
changeset
|
472 jabber_iq_send(jingle_session_terminate_packet( |
4f47eeaa1414
Add functions for more easily creating session-terminate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26124
diff
changeset
|
473 session, "success")); |
24994
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24993
diff
changeset
|
474 g_object_unref(session); |
26321
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
475 } else if (type == PURPLE_MEDIA_INFO_REJECT) { |
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
476 jabber_iq_send(jingle_session_terminate_packet( |
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
477 session, "decline")); |
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
478 g_object_unref(session); |
27835
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27712
diff
changeset
|
479 } else if (type == PURPLE_MEDIA_INFO_ACCEPT && |
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27712
diff
changeset
|
480 jingle_session_is_initiator(session) == FALSE) { |
584fa66dfb31
Remove the "accepted" signal from PurpleMedia as it was redundant.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27712
diff
changeset
|
481 jingle_rtp_ready(session); |
24994
50309309bc4d
Use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24993
diff
changeset
|
482 } |
24993
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24992
diff
changeset
|
483 } |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24992
diff
changeset
|
484 |
26311
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
485 static void |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
486 jingle_rtp_ready(JingleSession *session) |
26311
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
487 { |
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
488 PurpleMedia *media = jingle_rtp_get_media(session); |
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
489 |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
490 if (purple_media_candidates_prepared(media, NULL, NULL) && |
26311
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
491 purple_media_codecs_ready(media, NULL) && |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
492 (jingle_session_is_initiator(session) == TRUE || |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
493 purple_media_accepted(media, NULL, NULL))) { |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
494 if (jingle_session_is_initiator(session)) { |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
495 JabberIq *iq = jingle_session_to_packet( |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
496 session, JINGLE_SESSION_INITIATE); |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
497 jabber_iq_set_callback(iq, |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
498 jingle_rtp_initiate_ack_cb, session); |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
499 jabber_iq_send(iq); |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
500 } else { |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
501 jabber_iq_send(jingle_session_to_packet(session, |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
502 JINGLE_SESSION_ACCEPT)); |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
503 } |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
504 |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
505 g_signal_handlers_disconnect_by_func(G_OBJECT(media), |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
506 G_CALLBACK(jingle_rtp_candidates_prepared_cb), |
26311
0083c73e004b
Move sending session-initiate out of the ready-new callback.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26308
diff
changeset
|
507 session); |
26317
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
508 g_signal_handlers_disconnect_by_func(G_OBJECT(media), |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
509 G_CALLBACK(jingle_rtp_codecs_changed_cb), |
85c571d11417
Stop sending multiple session-initiate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26313
diff
changeset
|
510 session); |
26313
96ffb196d18d
Move sending session-accept out of the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26311
diff
changeset
|
511 g_signal_connect(G_OBJECT(media), "new-candidate", |
96ffb196d18d
Move sending session-accept out of the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26311
diff
changeset
|
512 G_CALLBACK(jingle_rtp_new_candidate_cb), |
96ffb196d18d
Move sending session-accept out of the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26311
diff
changeset
|
513 session); |
96ffb196d18d
Move sending session-accept out of the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26311
diff
changeset
|
514 } |
96ffb196d18d
Move sending session-accept out of the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26311
diff
changeset
|
515 } |
96ffb196d18d
Move sending session-accept out of the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26311
diff
changeset
|
516 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
517 static PurpleMedia * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
518 jingle_rtp_create_media(JingleContent *content) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
519 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
520 JingleSession *session = jingle_content_get_session(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
521 JabberStream *js = jingle_session_get_js(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
522 gchar *remote_jid = jingle_session_get_remote_jid(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
523 |
26524
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
524 PurpleMedia *media = purple_media_manager_create_media( |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
525 purple_media_manager_get(), |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
526 purple_connection_get_account(js->gc), |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
527 "fsrtpconference", remote_jid, |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
528 jingle_session_is_initiator(session)); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
529 g_free(remote_jid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
530 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
531 if (!media) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
532 purple_debug_error("jingle-rtp", "Couldn't create media session\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
533 return NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
534 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
535 |
26124
f10034e0321b
Get rid of the medias variable in JabberStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26119
diff
changeset
|
536 purple_media_set_prpl_data(media, session); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
537 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
538 /* connect callbacks */ |
26298
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
539 g_signal_connect(G_OBJECT(media), "candidates-prepared", |
b892b3cb9dbc
Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26296
diff
changeset
|
540 G_CALLBACK(jingle_rtp_candidates_prepared_cb), session); |
26059
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
541 g_signal_connect(G_OBJECT(media), "codecs-changed", |
1ff5304f6e9d
Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
542 G_CALLBACK(jingle_rtp_codecs_changed_cb), session); |
24993
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24992
diff
changeset
|
543 g_signal_connect(G_OBJECT(media), "state-changed", |
7d2e06b29f88
Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24992
diff
changeset
|
544 G_CALLBACK(jingle_rtp_state_changed_cb), session); |
26321
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
545 g_signal_connect(G_OBJECT(media), "stream-info", |
2c9fb8ac325b
Use stream-info instead of state-changed for hangup and reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26317
diff
changeset
|
546 G_CALLBACK(jingle_rtp_stream_info_cb), session); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
547 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
548 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
549 return media; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
550 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
551 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
552 static gboolean |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
553 jingle_rtp_init_media(JingleContent *content) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
554 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
555 JingleSession *session = jingle_content_get_session(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
556 PurpleMedia *media = jingle_rtp_get_media(session); |
26384
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
557 gchar *creator; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
558 gchar *media_type; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
559 gchar *remote_jid; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
560 gchar *senders; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
561 gchar *name; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
562 const gchar *transmitter; |
26017
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
563 gboolean is_audio; |
26384
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
564 gboolean is_creator; |
26017
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
565 PurpleMediaSessionType type; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
566 JingleTransport *transport; |
26080
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26060
diff
changeset
|
567 GParameter *params = NULL; |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26060
diff
changeset
|
568 guint num_params; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
569 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
570 /* maybe this create ought to just be in initiate and handle initiate */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
571 if (media == NULL) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
572 media = jingle_rtp_create_media(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
573 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
574 if (media == NULL) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
575 return FALSE; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
576 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
577 name = jingle_content_get_name(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
578 media_type = jingle_rtp_get_media_type(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
579 remote_jid = jingle_session_get_remote_jid(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
580 senders = jingle_content_get_senders(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
581 transport = jingle_content_get_transport(content); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
582 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
583 if (JINGLE_IS_RAWUDP(transport)) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
584 transmitter = "rawudp"; |
24966
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
585 else if (JINGLE_IS_ICEUDP(transport)) |
bee5ab815291
Added a Jingle ice-udp transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24961
diff
changeset
|
586 transmitter = "nice"; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
587 else |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
588 transmitter = "notransmitter"; |
26290
44684f0d2e42
Plug some memory leaks related to transports.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26287
diff
changeset
|
589 g_object_unref(transport); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
590 |
26017
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
591 is_audio = !strcmp(media_type, "audio"); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
592 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
593 if (!strcmp(senders, "both")) |
26017
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
594 type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
595 : PURPLE_MEDIA_VIDEO; |
27884
f5580e1ca4b1
Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents:
27835
diff
changeset
|
596 else if ((strcmp(senders, "initiator") == 0) == |
f5580e1ca4b1
Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents:
27835
diff
changeset
|
597 jingle_session_is_initiator(session)) |
26017
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
598 type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
599 : PURPLE_MEDIA_SEND_VIDEO; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
600 else |
26017
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
601 type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO |
b6457b2a8e14
Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26009
diff
changeset
|
602 : PURPLE_MEDIA_RECV_VIDEO; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
603 |
26080
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26060
diff
changeset
|
604 params = |
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26060
diff
changeset
|
605 jingle_get_params(jingle_session_get_js(session), &num_params); |
26384
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
606 |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
607 creator = jingle_content_get_creator(content); |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
608 if (!strcmp(creator, "initiator")) |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
609 is_creator = jingle_session_is_initiator(session); |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
610 else |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
611 is_creator = !jingle_session_is_initiator(session); |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
612 g_free(creator); |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26371
diff
changeset
|
613 |
28046
0bf7defe41fd
More gracefully handle stream creation errors with Jingle calls.
maiku@pidgin.im
parents:
27884
diff
changeset
|
614 if(!purple_media_add_stream(media, name, remote_jid, |
0bf7defe41fd
More gracefully handle stream creation errors with Jingle calls.
maiku@pidgin.im
parents:
27884
diff
changeset
|
615 type, is_creator, transmitter, num_params, params)) { |
0bf7defe41fd
More gracefully handle stream creation errors with Jingle calls.
maiku@pidgin.im
parents:
27884
diff
changeset
|
616 purple_media_end(media, NULL, NULL); |
0bf7defe41fd
More gracefully handle stream creation errors with Jingle calls.
maiku@pidgin.im
parents:
27884
diff
changeset
|
617 return FALSE; |
0bf7defe41fd
More gracefully handle stream creation errors with Jingle calls.
maiku@pidgin.im
parents:
27884
diff
changeset
|
618 } |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
619 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
620 g_free(name); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
621 g_free(media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
622 g_free(remote_jid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
623 g_free(senders); |
26080
88f183f7dfc7
Add automatic discovery of GTalk STUN servers when using a Gtalk account
Marcus Lundblad <ml@update.uu.se>
parents:
26060
diff
changeset
|
624 g_free(params); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
625 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
626 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
627 return TRUE; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
628 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
629 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
630 static GList * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
631 jingle_rtp_parse_codecs(xmlnode *description) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
632 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
633 GList *codecs = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
634 xmlnode *codec_element = NULL; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
635 const char *encoding_name,*id, *clock_rate; |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
636 PurpleMediaCodec *codec; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
637 const gchar *media = xmlnode_get_attrib(description, "media"); |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
638 PurpleMediaSessionType type = |
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
639 !strcmp(media, "video") ? PURPLE_MEDIA_VIDEO : |
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
640 !strcmp(media, "audio") ? PURPLE_MEDIA_AUDIO : 0; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
641 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
642 for (codec_element = xmlnode_get_child(description, "payload-type") ; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
643 codec_element ; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
644 codec_element = xmlnode_get_next_twin(codec_element)) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
645 xmlnode *param; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
646 gchar *codec_str; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
647 encoding_name = xmlnode_get_attrib(codec_element, "name"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
648 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
649 id = xmlnode_get_attrib(codec_element, "id"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
650 clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
651 |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
652 codec = purple_media_codec_new(atoi(id), encoding_name, |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
653 type, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
654 clock_rate ? atoi(clock_rate) : 0); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
655 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
656 for (param = xmlnode_get_child(codec_element, "parameter"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
657 param; param = xmlnode_get_next_twin(param)) { |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
658 purple_media_codec_add_optional_parameter(codec, |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
659 xmlnode_get_attrib(param, "name"), |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
660 xmlnode_get_attrib(param, "value")); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
661 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
662 |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
663 codec_str = purple_media_codec_to_string(codec); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
664 purple_debug_info("jingle-rtp", "received codec: %s\n", codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
665 g_free(codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
666 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
667 codecs = g_list_append(codecs, codec); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
668 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
669 return codecs; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
670 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
671 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
672 static JingleContent * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
673 jingle_rtp_parse_internal(xmlnode *rtp) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
674 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
675 JingleContent *content = parent_class->parse(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
676 xmlnode *description = xmlnode_get_child(rtp, "description"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
677 const gchar *media_type = xmlnode_get_attrib(description, "media"); |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
678 const gchar *ssrc = xmlnode_get_attrib(description, "ssrc"); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
679 purple_debug_info("jingle-rtp", "rtp parse\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
680 g_object_set(content, "media-type", media_type, NULL); |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
681 if (ssrc != NULL) |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
682 g_object_set(content, "ssrc", ssrc, NULL); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
683 return content; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
684 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
685 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
686 static void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
687 jingle_rtp_add_payloads(xmlnode *description, GList *codecs) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
688 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
689 for (; codecs ; codecs = codecs->next) { |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
690 PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data; |
26404
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
691 GList *iter = purple_media_codec_get_optional_parameters(codec); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
692 gchar *id, *name, *clockrate, *channels; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
693 gchar *codec_str; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
694 xmlnode *payload = xmlnode_new_child(description, "payload-type"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
695 |
26404
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
696 id = g_strdup_printf("%d", |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
697 purple_media_codec_get_id(codec)); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
698 name = purple_media_codec_get_encoding_name(codec); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
699 clockrate = g_strdup_printf("%d", |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
700 purple_media_codec_get_clock_rate(codec)); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
701 channels = g_strdup_printf("%d", |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
702 purple_media_codec_get_channels(codec)); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
703 |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
704 xmlnode_set_attrib(payload, "name", name); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
705 xmlnode_set_attrib(payload, "id", id); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
706 xmlnode_set_attrib(payload, "clockrate", clockrate); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
707 xmlnode_set_attrib(payload, "channels", channels); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
708 |
26404
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
709 g_free(channels); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
710 g_free(clockrate); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
711 g_free(name); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
712 g_free(id); |
217574ec2a34
Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26403
diff
changeset
|
713 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
714 for (; iter; iter = g_list_next(iter)) { |
26403
f0de2405c2f1
Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26384
diff
changeset
|
715 PurpleKeyValuePair *mparam = iter->data; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
716 xmlnode *param = xmlnode_new_child(payload, "parameter"); |
26403
f0de2405c2f1
Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26384
diff
changeset
|
717 xmlnode_set_attrib(param, "name", mparam->key); |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
718 xmlnode_set_attrib(param, "value", mparam->value); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
719 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
720 |
26024
ac4d7695dbc7
Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26021
diff
changeset
|
721 codec_str = purple_media_codec_to_string(codec); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
722 purple_debug_info("jingle", "adding codec: %s\n", codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
723 g_free(codec_str); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
724 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
725 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
726 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
727 static xmlnode * |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
728 jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
729 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
730 xmlnode *node = parent_class->to_xml(rtp, content, action); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
731 xmlnode *description = xmlnode_get_child(node, "description"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
732 if (description != NULL) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
733 JingleSession *session = jingle_content_get_session(rtp); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
734 PurpleMedia *media = jingle_rtp_get_media(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
735 gchar *media_type = jingle_rtp_get_media_type(rtp); |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
736 gchar *ssrc = jingle_rtp_get_ssrc(rtp); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
737 gchar *name = jingle_content_get_name(rtp); |
24960
a5f1804fcb4b
Combine get_*_codecs functions to mirror Farsight 2.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24956
diff
changeset
|
738 GList *codecs = purple_media_get_codecs(media, name); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
739 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
740 xmlnode_set_attrib(description, "media", media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
741 |
26285
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
742 if (ssrc != NULL) |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
743 xmlnode_set_attrib(description, "ssrc", ssrc); |
b1c4fcc5b814
Add ssrc property to JingleRtp.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26284
diff
changeset
|
744 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
745 g_free(media_type); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
746 g_free(name); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
747 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
748 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
749 jingle_rtp_add_payloads(description, codecs); |
26308 | 750 purple_media_codec_list_free(codecs); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
751 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
752 return node; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
753 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
754 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
755 static void |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
756 jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
757 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
758 switch (action) { |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
759 case JINGLE_SESSION_ACCEPT: |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
760 case JINGLE_SESSION_INITIATE: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
761 JingleSession *session = jingle_content_get_session(content); |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
762 JingleTransport *transport = jingle_transport_parse( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
763 xmlnode_get_child(xmlcontent, "transport")); |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
764 xmlnode *description = xmlnode_get_child(xmlcontent, "description"); |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
765 GList *candidates = jingle_rtp_transport_to_candidates(transport); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
766 GList *codecs = jingle_rtp_parse_codecs(description); |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
767 gchar *name = jingle_content_get_name(content); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
768 gchar *remote_jid = |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
769 jingle_session_get_remote_jid(session); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
770 PurpleMedia *media; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
771 |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
772 if (action == JINGLE_SESSION_INITIATE && |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
773 jingle_rtp_init_media(content) == FALSE) { |
24956
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24954
diff
changeset
|
774 /* XXX: send error */ |
26284
4f47eeaa1414
Add functions for more easily creating session-terminate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26124
diff
changeset
|
775 jabber_iq_send(jingle_session_terminate_packet( |
4f47eeaa1414
Add functions for more easily creating session-terminate packets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26124
diff
changeset
|
776 session, "general-error")); |
24956
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24954
diff
changeset
|
777 g_object_unref(session); |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24954
diff
changeset
|
778 break; |
b83c83143a69
Fix crash when remote client reconnects and tries to restart the media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24954
diff
changeset
|
779 } |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
780 |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
781 media = jingle_rtp_get_media(session); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
782 purple_media_set_remote_codecs(media, |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
783 name, remote_jid, codecs); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
784 purple_media_add_remote_candidates(media, |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
785 name, remote_jid, candidates); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
786 |
26371
12c7db418c3e
Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26369
diff
changeset
|
787 if (action == JINGLE_SESSION_ACCEPT) |
12c7db418c3e
Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26369
diff
changeset
|
788 purple_media_stream_info(media, |
12c7db418c3e
Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26369
diff
changeset
|
789 PURPLE_MEDIA_INFO_ACCEPT, |
12c7db418c3e
Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26369
diff
changeset
|
790 name, remote_jid, FALSE); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
791 |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
792 g_free(remote_jid); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
793 g_free(name); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
794 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
795 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
796 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
797 case JINGLE_SESSION_TERMINATE: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
798 JingleSession *session = jingle_content_get_session(content); |
24992
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24991
diff
changeset
|
799 PurpleMedia *media = jingle_rtp_get_media(session); |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24991
diff
changeset
|
800 |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24991
diff
changeset
|
801 if (media != NULL) { |
26058
ac56e5707a72
Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26040
diff
changeset
|
802 purple_media_end(media, NULL, NULL); |
24992
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24991
diff
changeset
|
803 } |
d881fc5d907f
Remove PurpleMedias from JabberStream's list when a media session ends.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24991
diff
changeset
|
804 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
805 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
806 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
807 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
808 case JINGLE_TRANSPORT_INFO: { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
809 JingleSession *session = jingle_content_get_session(content); |
24954
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
810 JingleTransport *transport = jingle_transport_parse( |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
811 xmlnode_get_child(xmlcontent, "transport")); |
365eb0b68d5f
Update Jingle raw-udp to latest spec version.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24949
diff
changeset
|
812 GList *candidates = jingle_rtp_transport_to_candidates(transport); |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
813 gchar *name = jingle_content_get_name(content); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
814 gchar *remote_jid = |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
815 jingle_session_get_remote_jid(session); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
816 |
26287
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
817 purple_media_add_remote_candidates( |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
818 jingle_rtp_get_media(session), |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
819 name, remote_jid, candidates); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
820 |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
821 g_free(remote_jid); |
26cf297796a5
Update Jingle Ice-Udp according to the XEP.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26285
diff
changeset
|
822 g_free(name); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
823 g_object_unref(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
824 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
825 } |
28530 | 826 case JINGLE_DESCRIPTION_INFO: { |
827 JingleSession *session = | |
828 jingle_content_get_session(content); | |
829 xmlnode *description = xmlnode_get_child( | |
830 xmlcontent, "description"); | |
831 GList *codecs, *iter, *iter2, *remote_codecs = | |
832 jingle_rtp_parse_codecs(description); | |
833 gchar *name = jingle_content_get_name(content); | |
834 gchar *remote_jid = | |
835 jingle_session_get_remote_jid(session); | |
836 PurpleMedia *media; | |
837 | |
838 media = jingle_rtp_get_media(session); | |
839 | |
840 /* | |
841 * This may have problems if description-info is | |
842 * received without the optional parameters for a | |
843 * codec with configuration info (such as THEORA | |
844 * or H264). The local configuration info may be | |
845 * set for the remote codec. | |
846 * | |
847 * As of 2.6.3 there's no API to support getting | |
848 * the remote codecs specifically, just the | |
849 * intersection. Another option may be to cache | |
850 * the remote codecs received in initiate/accept. | |
851 */ | |
852 codecs = purple_media_get_codecs(media, name); | |
853 | |
854 for (iter = codecs; iter; iter = g_list_next(iter)) { | |
855 guint id; | |
856 | |
857 id = purple_media_codec_get_id(iter->data); | |
858 iter2 = remote_codecs; | |
859 | |
860 for (; iter2; iter2 = g_list_next(iter2)) { | |
861 if (purple_media_codec_get_id( | |
862 iter2->data) != id) | |
863 continue; | |
864 | |
865 g_object_unref(iter->data); | |
866 iter->data = iter2->data; | |
867 remote_codecs = g_list_delete_link( | |
868 remote_codecs, iter2); | |
869 break; | |
870 } | |
871 } | |
872 | |
873 codecs = g_list_concat(codecs, remote_codecs); | |
874 | |
875 purple_media_set_remote_codecs(media, | |
876 name, remote_jid, codecs); | |
877 | |
878 purple_media_codec_list_free (codecs); | |
879 g_free(remote_jid); | |
880 g_free(name); | |
881 g_object_unref(session); | |
882 break; | |
883 } | |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
884 default: |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
885 break; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
886 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
887 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
888 |
26365
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
889 gboolean |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
890 jingle_rtp_initiate_media(JabberStream *js, const gchar *who, |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
891 PurpleMediaSessionType type) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
892 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
893 /* create content negotiation */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
894 JingleSession *session; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
895 JingleContent *content; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
896 JingleTransport *transport; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
897 JabberBuddy *jb; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
898 JabberBuddyResource *jbr; |
24970
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
899 const gchar *transport_type; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
900 |
26432
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
901 gchar *resource = NULL, *me = NULL, *sid = NULL; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
902 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
903 /* construct JID to send to */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
904 jb = jabber_buddy_find(js, who, FALSE); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
905 if (!jb) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
906 purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); |
26365
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
907 return FALSE; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
908 } |
26432
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
909 |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
910 resource = jabber_get_resource(who); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
911 jbr = jabber_buddy_find_resource(jb, resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
912 g_free(resource); |
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
913 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
914 if (!jbr) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
915 purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
916 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
917 |
24970
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
918 if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
919 transport_type = JINGLE_TRANSPORT_ICEUDP; |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
920 } else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_RAWUDP)) { |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
921 transport_type = JINGLE_TRANSPORT_RAWUDP; |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
922 } else { |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
923 purple_debug_error("jingle-rtp", "Resource doesn't support " |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
924 "the same transport types\n"); |
26365
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
925 return FALSE; |
24970
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
926 } |
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
927 |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
928 /* set ourselves as initiator */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
929 me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
930 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
931 sid = jabber_get_next_id(js); |
26432
0adf41b3de79
Add a resource selector when initiating media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
932 session = jingle_session_create(js, sid, me, who, TRUE); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
933 g_free(sid); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
934 |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
935 |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
936 if (type & PURPLE_MEDIA_AUDIO) { |
24970
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
937 transport = jingle_transport_create(transport_type); |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
938 content = jingle_content_create(JINGLE_APP_RTP, "initiator", |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
939 "session", "audio-session", "both", transport); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
940 jingle_session_add_content(session, content); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
941 JINGLE_RTP(content)->priv->media_type = g_strdup("audio"); |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
942 jingle_rtp_init_media(content); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
943 } |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
944 if (type & PURPLE_MEDIA_VIDEO) { |
24970
99055b8db16b
Choose the transport type according to the responder's caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24966
diff
changeset
|
945 transport = jingle_transport_create(transport_type); |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
946 content = jingle_content_create(JINGLE_APP_RTP, "initiator", |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
947 "session", "video-session", "both", transport); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
948 jingle_session_add_content(session, content); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
949 JINGLE_RTP(content)->priv->media_type = g_strdup("video"); |
24949
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
950 jingle_rtp_init_media(content); |
1a2d446cb8a0
Fix support for audio and video (at the same time) sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24947
diff
changeset
|
951 } |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
952 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
953 g_free(me); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
954 |
26365
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
955 if (jingle_rtp_get_media(session) == NULL) { |
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
956 return FALSE; |
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
957 } |
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
958 |
34eb898478b4
Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26329
diff
changeset
|
959 return TRUE; |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
960 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
961 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
962 void |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
963 jingle_rtp_terminate_session(JabberStream *js, const gchar *who) |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
964 { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
965 JingleSession *session; |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
966 /* XXX: This may cause file transfers and xml sessions to stop as well */ |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
967 session = jingle_session_find_by_jid(js, who); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
968 |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
969 if (session) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
970 PurpleMedia *media = jingle_rtp_get_media(session); |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
971 if (media) { |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
972 purple_debug_info("jingle-rtp", "hanging up media\n"); |
26369
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26366
diff
changeset
|
973 purple_media_stream_info(media, |
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26366
diff
changeset
|
974 PURPLE_MEDIA_INFO_HANGUP, |
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26366
diff
changeset
|
975 NULL, NULL, TRUE); |
24947
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
976 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
977 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
978 } |
7252e3d0c627
Add files I missed committing before and remove a few unnecessary functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
diff
changeset
|
979 |
26009
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24998
diff
changeset
|
980 #endif /* USE_VV */ |
59188d904773
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24998
diff
changeset
|
981 |