comparison libpurple/media.c @ 28134:614a40c68b88

Wait to set remote candidates until the session has been accepted. This stops the accepting side from sending a bunch of connectivity packets and "fail" to connect before the user has accepted.
author maiku@pidgin.im
date Sun, 30 Aug 2009 03:08:27 +0000
parents f628e98e6dff
children bb06f05c7159 196e4c5b2043
comparison
equal deleted inserted replaced
28133:2858857f457b 28134:614a40c68b88
2276 PurpleMediaStream *stream = streams->data; 2276 PurpleMediaStream *stream = streams->data;
2277 g_object_set(G_OBJECT(stream->stream), "direction", 2277 g_object_set(G_OBJECT(stream->stream), "direction",
2278 purple_media_to_fs_stream_direction( 2278 purple_media_to_fs_stream_direction(
2279 stream->session->type), NULL); 2279 stream->session->type), NULL);
2280 stream->accepted = TRUE; 2280 stream->accepted = TRUE;
2281
2282 if (stream->remote_candidates != NULL) {
2283 GError *err = NULL;
2284 fs_stream_set_remote_candidates(stream->stream,
2285 stream->remote_candidates, &err);
2286
2287 if (err) {
2288 purple_debug_error("media", "Error adding remote"
2289 " candidates: %s\n", err->message);
2290 g_error_free(err);
2291 }
2292 }
2281 } 2293 }
2282 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE || 2294 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
2283 type == PURPLE_MEDIA_INFO_UNMUTE)) { 2295 type == PURPLE_MEDIA_INFO_UNMUTE)) {
2284 GList *sessions; 2296 GList *sessions;
2285 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE); 2297 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
2901 } 2913 }
2902 2914
2903 stream->remote_candidates = g_list_concat(stream->remote_candidates, 2915 stream->remote_candidates = g_list_concat(stream->remote_candidates,
2904 purple_media_candidate_list_to_fs(remote_candidates)); 2916 purple_media_candidate_list_to_fs(remote_candidates));
2905 2917
2906 fs_stream_set_remote_candidates(stream->stream, 2918 if (stream->accepted == TRUE) {
2907 stream->remote_candidates, &err); 2919 fs_stream_set_remote_candidates(stream->stream,
2908 2920 stream->remote_candidates, &err);
2909 if (err) { 2921
2910 purple_debug_error("media", "Error adding remote" 2922 if (err) {
2911 " candidates: %s\n", err->message); 2923 purple_debug_error("media", "Error adding remote"
2912 g_error_free(err); 2924 " candidates: %s\n", err->message);
2925 g_error_free(err);
2926 }
2913 } 2927 }
2914 #endif 2928 #endif
2915 } 2929 }
2916 2930
2917 #if 0 2931 #if 0