pidgin.vv: 26ba71d0: Wait to send media until both sides have...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Wed Jan 7 03:35:49 EST 2009


-----------------------------------------------------------------
Revision: 26ba71d01eb294168e972de93f911bf0f20b9851
Ancestor: 181ff55ac1096abc8dafa90d06d75c02fdc615c9
Author: maiku at soc.pidgin.im
Date: 2009-01-07T08:28:17
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/26ba71d01eb294168e972de93f911bf0f20b9851

Modified files:
        libpurple/media.c

ChangeLog: 

Wait to send media until both sides have accepted.

-------------- next part --------------
============================================================
--- libpurple/media.c	d5839256d5927a56d82f98bdb08a71961079e611
+++ libpurple/media.c	45a757f4cf82581bbdf35ebbb3e3b604cde197f3
@@ -822,6 +822,21 @@ purple_media_get_pipeline(PurpleMedia *m
 	return media->priv->pipeline;
 }
 
+static void
+purple_media_set_remote_candidates(PurpleMediaStream *stream)
+{
+	GError *err = NULL;
+
+	fs_stream_set_remote_candidates(stream->stream,
+			stream->remote_candidates, &err);
+
+	if (err) {
+		purple_debug_error("media", "Error adding remote"
+				" candidates: %s\n", err->message);
+		g_error_free(err);
+	}
+}
+
 void
 purple_media_error(PurpleMedia *media, const gchar *error, ...)
 {
@@ -854,6 +869,7 @@ purple_media_accept(PurpleMedia *media)
 purple_media_accept(PurpleMedia *media)
 {
 	GList *sessions;
+	GList *streams;
 
 	g_signal_emit(media, purple_media_signals[ACCEPTED], 0);
 
@@ -865,6 +881,12 @@ purple_media_accept(PurpleMedia *media)
 
 		purple_media_emit_ready(media, session, NULL);
 	}
+
+	streams = media->priv->streams;
+
+	for (; streams; streams = g_list_next(streams)) {
+		purple_media_set_remote_candidates(streams->data);
+	}
 }
 
 void
@@ -910,6 +932,7 @@ purple_media_got_accept(PurpleMedia *med
 purple_media_got_accept(PurpleMedia *media)
 {
 	GList *sessions;
+	GList *streams;
 
 	g_signal_emit(media, purple_media_signals[GOT_ACCEPT], 0);
 
@@ -919,6 +942,12 @@ purple_media_got_accept(PurpleMedia *med
 		PurpleMediaSession *session = sessions->data;
 		session->accepted = TRUE;
 	}
+
+	streams = media->priv->streams;
+
+	for (; streams; streams = g_list_next(streams)) {
+		purple_media_set_remote_candidates(streams->data);
+	}
 }
 
 GList*
@@ -1435,16 +1464,11 @@ purple_media_add_remote_candidates(Purpl
 				   const gchar *name, GList *remote_candidates)
 {
 	PurpleMediaStream *stream = purple_media_get_stream(media, sess_id, name);
-	GError *err = NULL;
 	stream->remote_candidates = g_list_concat(stream->remote_candidates,
 			fs_candidate_list_copy(remote_candidates));
 
-	fs_stream_set_remote_candidates(stream->stream, stream->remote_candidates, &err);
-
-	if (err) {
-		purple_debug_error("media", "Error adding remote candidates: %s\n",
-				   err->message);
-		g_error_free(err);
+	if (stream->session->accepted == TRUE) {
+		purple_media_set_remote_candidates(stream);
 	}
 }
 


More information about the Commits mailing list