pidgin.vv: 9a9b0ae2: Have XMPP use the new ready signal.
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Sun Jan 4 05:15:52 EST 2009
-----------------------------------------------------------------
Revision: 9a9b0ae29d4e49c5fff84493f664cf349f613fb1
Ancestor: 7cd30edeeca03101b81516378cd520048693f213
Author: maiku at soc.pidgin.im
Date: 2009-01-04T09:56:54
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/9a9b0ae29d4e49c5fff84493f664cf349f613fb1
Modified files:
libpurple/media.c libpurple/protocols/jabber/jingle/rtp.c
ChangeLog:
Have XMPP use the new ready signal.
-------------- next part --------------
============================================================
--- libpurple/media.c 9530edb942c8e3ec37f04db8889dc251aba03363
+++ libpurple/media.c 27ed5dd28560ad4eb9c118ce28f4202cda15a0d1
@@ -642,7 +642,8 @@ purple_media_emit_ready(PurpleMedia *med
GList *sessions;
gboolean conf_ready = TRUE;
- if ((session != NULL) && ((session->accepted == FALSE) ||
+ if ((session != NULL) && ((media->priv->initiator == FALSE &&
+ session->accepted == FALSE) ||
(purple_media_codecs_ready(media, session->id) == FALSE)))
return;
@@ -652,28 +653,31 @@ purple_media_emit_ready(PurpleMedia *med
PurpleMediaSession *session_data = sessions->data;
GList *streams = purple_media_get_streams(media,
session_data->id, NULL);
+ gboolean session_ready = TRUE;
- if ((session_data->accepted == FALSE) ||
+ if ((media->priv->initiator == FALSE &&
+ session_data->accepted == FALSE) ||
(purple_media_codecs_ready(
media, session_data->id) == FALSE))
conf_ready = FALSE;
for (; streams; streams = g_list_delete_link(streams, streams)) {
PurpleMediaStream *stream = streams->data;
- if (stream->candidates_prepared == TRUE &&
- session_data == session)
+ if (stream->candidates_prepared == FALSE) {
+ session_ready = FALSE;
+ conf_ready = FALSE;
+ } else if (session_data == session)
g_signal_emit(media, purple_media_signals[READY_NEW],
0, session_data->id, stream->participant);
}
- if (session == session_data || session == NULL)
+ if (session_ready == TRUE &&
+ (session == session_data || session == NULL))
g_signal_emit(media, purple_media_signals[READY_NEW],
0, session_data->id, NULL);
}
if (conf_ready == TRUE) {
- g_list_free(sessions);
- } else {
g_signal_emit(media, purple_media_signals[READY_NEW],
0, NULL, NULL);
}
============================================================
--- libpurple/protocols/jabber/jingle/rtp.c a124e50fefff4f5c69ead9ba8d31a4d718b0313e
+++ libpurple/protocols/jabber/jingle/rtp.c 8f257da095ad6d24804647b49adce087e6fa6945
@@ -164,27 +164,6 @@ jingle_rtp_get_property (GObject *object
}
}
-static gboolean
-jingle_rtp_ready_to_initiate(JingleSession *session, PurpleMedia *media)
-{
- if (jingle_session_is_initiator(session)) {
- GList *iter = jingle_session_get_contents(session);
- for (; iter; iter = g_list_next(iter)) {
- JingleContent *content = iter->data;
- gchar *name = jingle_content_get_name(content);
- if (!JINGLE_IS_RTP(content)
- || JINGLE_RTP_GET_PRIVATE(content)->codecs_ready == FALSE
- || JINGLE_RTP_GET_PRIVATE(content)->candidates_ready == FALSE) {
- g_free(name);
- return FALSE;
- }
- g_free(name);
- }
- return TRUE;
- }
- return FALSE;
-}
-
gchar *
jingle_rtp_get_media_type(JingleContent *content)
{
@@ -328,12 +307,6 @@ jingle_rtp_candidates_prepared_cb(Purple
jingle_content_set_pending_transport(content, transport);
jingle_content_accept_transport(content);
-
- if (jingle_rtp_ready_to_initiate(session, media)) {
- jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE));
- if (JINGLE_IS_ICEUDP(transport))
- jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO));
- }
}
static void
@@ -343,31 +316,24 @@ static void
}
static void
-jingle_rtp_codecs_ready_cb(PurpleMedia *media, gchar *sid, JingleSession *session)
+jingle_rtp_ready_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session)
{
- JingleContent *content = jingle_session_find_content(session, sid, "initiator");
+ purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name);
- if (content == NULL)
- content = jingle_session_find_content(session, sid, "responder");
+ if (sid == NULL && name == NULL && jingle_session_is_initiator(session) == TRUE) {
+ GList *contents = jingle_session_get_contents(session);
- if (JINGLE_RTP_GET_PRIVATE(content)->codecs_ready == FALSE) {
- JINGLE_RTP_GET_PRIVATE(content)->codecs_ready =
- purple_media_codecs_ready(media, sid);
+ jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE));
- if (jingle_rtp_ready_to_initiate(session, media)) {
+ for (; contents; contents = g_list_next(contents)) {
+ JingleContent *content = (JingleContent *)contents->data;
JingleTransport *transport = jingle_content_get_transport(content);
- jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_INITIATE));
if (JINGLE_IS_ICEUDP(transport))
jabber_iq_send(jingle_session_to_packet(session, JINGLE_TRANSPORT_INFO));
}
}
}
-static void
-jingle_rtp_ready_new_cb(PurpleMedia *media, gchar *sid, gchar *name, JingleSession *session) {
- purple_debug_info("rtp", "ready-new: session: %s name: %s\n", sid, name);
-}
-
static PurpleMedia *
jingle_rtp_create_media(JingleContent *content)
{
@@ -407,10 +373,8 @@ jingle_rtp_create_media(JingleContent *c
G_CALLBACK(jingle_rtp_candidates_prepared_cb), session);
g_signal_connect(G_OBJECT(media), "candidate-pair",
G_CALLBACK(jingle_rtp_candidate_pair_established_cb), session);
- g_signal_connect(G_OBJECT(media), "codecs-ready",
- G_CALLBACK(jingle_rtp_codecs_ready_cb), session);
g_signal_connect(G_OBJECT(media), "ready-new",
- G_CALLBACK(jingle_rtp_ready_new_cb), session);
+ G_CALLBACK(jingle_rtp_ready_cb), session);
g_object_unref(session);
return media;
More information about the Commits
mailing list