From e009dc7ef4eb08902863810a4dfd2540c21e45ff Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Tue, 12 Apr 2016 14:38:00 +0200 Subject: [PATCH] call-stream: ignore local candidates with TCP proto This patch fixes a bug where local candidates with protocol FS_NETWORK_PROTOCOL_TCP_ACTIVE are transmitted to Telepathy as UDP candidates, causing remotely the addition of more UDP candidates than strictly needed. We choose to drop TCP candidates entirely until the Telepathy spec is updated to have the three different kinds of TCP candidates. https://bugs.freedesktop.org/show_bug.cgi?id=93973 --- telepathy-farstream/call-stream.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/telepathy-farstream/call-stream.c b/telepathy-farstream/call-stream.c index bbec0c9..429abd2 100644 --- a/telepathy-farstream/call-stream.c +++ b/telepathy-farstream/call-stream.c @@ -1510,17 +1510,28 @@ cb_fs_new_local_candidate (TfCallStream *stream, FsCandidate *candidate) candidate->priority, candidate->username, candidate->password, candidate->ttl,candidate-> base_ip, candidate->base_port); + switch (candidate->proto) + { + case FS_NETWORK_PROTOCOL_UDP: + candidate_list = g_ptr_array_sized_new (1); + g_ptr_array_add (candidate_list, + fscandidate_to_tpcandidate (stream, candidate)); - candidate_list = g_ptr_array_sized_new (1); - g_ptr_array_add (candidate_list, - fscandidate_to_tpcandidate (stream, candidate)); - - /* Should also check for errors */ - tp_cli_call_stream_interface_media_call_add_candidates (stream->proxy, - -1, candidate_list, NULL, NULL, NULL, NULL); - + /* Should also check for errors */ + tp_cli_call_stream_interface_media_call_add_candidates (stream->proxy, + -1, candidate_list, NULL, NULL, NULL, NULL); - g_boxed_free (TP_ARRAY_TYPE_CANDIDATE_LIST, candidate_list); + g_boxed_free (TP_ARRAY_TYPE_CANDIDATE_LIST, candidate_list); + break; + case FS_NETWORK_PROTOCOL_TCP_PASSIVE: + case FS_NETWORK_PROTOCOL_TCP_ACTIVE: + case FS_NETWORK_PROTOCOL_TCP_SO: + g_debug ("Local candidate with TCP prototype is ignored"); + break; + default: + g_debug ("Local candidate with unknown prototype is ignored"); + break; + } } static void -- 2.5.5