Mercurial > pidgin
changeset 26004:2d76bee4a98c
Wait to send media until both sides have accepted.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Wed, 07 Jan 2009 08:28:17 +0000 |
parents | 9a8876493f3f |
children | 83704757fa36 |
files | libpurple/media.c |
diffstat | 1 files changed, 31 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/media.c Wed Jan 07 05:23:58 2009 +0000 +++ b/libpurple/media.c Wed Jan 07 08:28:17 2009 +0000 @@ -822,6 +822,21 @@ 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) { GList *sessions; + GList *streams; g_signal_emit(media, purple_media_signals[ACCEPTED], 0); @@ -865,6 +881,12 @@ 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 *media) { GList *sessions; + GList *streams; g_signal_emit(media, purple_media_signals[GOT_ACCEPT], 0); @@ -919,6 +942,12 @@ 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 @@ 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); } }