diff options
author | Jakub Adam <jakub.adam@ktknet.cz> | 2014-04-22 14:26:49 +0200 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2014-10-09 17:57:33 -0400 |
commit | 3cd69d66c849df4541cf0974c8429623dc103cbb (patch) | |
tree | 957aab1472c1ec9c90d443309fcb82ff51c742cd | |
parent | 2cb3e163f153434b6e386d1fe80efcc6e70eb738 (diff) | |
download | farstream-3cd69d66c849df4541cf0974c8429623dc103cbb.tar.gz |
Add ICE-TCP candidates
Also to the nice transmitter
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | farstream/fs-candidate.h | 15 | ||||
-rw-r--r-- | tests/check/transmitter/nice.c | 19 | ||||
-rw-r--r-- | transmitters/nice/fs-nice-stream-transmitter.c | 32 |
5 files changed, 32 insertions, 38 deletions
@@ -18,7 +18,7 @@ Build time: - gstreamer 1.4.0 - gst-plugins-base 1.4.0 - glib 2.32 - - libnice 0.1.3 + - libnice 0.1.8 - gobject-introspection 0.10.1 For UPnP support: diff --git a/configure.ac b/configure.ac index beabb24e..19e4f61f 100644 --- a/configure.ac +++ b/configure.ac @@ -167,7 +167,7 @@ AC_ARG_WITH(transmitter-plugins, [FS_TRANSMITTER_PLUGINS_SELECTED=$FS_TRANSMITTER_PLUGINS_ALL]) -NICE_REQUIRED=0.1.3 +NICE_REQUIRED=0.1.8 PKG_CHECK_MODULES(NICE, \ nice >= $NICE_REQUIRED,, AC_MSG_ERROR([Need libnice >= $NICE_REQUIRED])) diff --git a/farstream/fs-candidate.h b/farstream/fs-candidate.h index b8ad723f..5abedb93 100644 --- a/farstream/fs-candidate.h +++ b/farstream/fs-candidate.h @@ -59,14 +59,25 @@ typedef enum /** * FsNetworkProtocol: * @FS_NETWORK_PROTOCOL_UDP: A UDP based protocol - * @FS_NETWORK_PROTOCOL_TCP: A TCP based protocol + * @FS_NETWORK_PROTOCOL_TCP: A TCP based protocol, will listen for + * incoming connections + * @FS_NETWORK_PROTOCOL_TCP_PASSIVE: A TCP based protocol, will listen for + * incoming connections + * @FS_NETWORK_PROTOCOL_TCP_ACTIVE: A TCP based protocol, will attempt to + * open an outbound connection + * @FS_NETWORK_PROTOCOL_TCP_SO: A TCP based protocol, will listen for + * incoming connections and attempt an outbound connection at the same time + * as the peer (Simultanuous-Open) * * An enum for the base IP protocol */ typedef enum { FS_NETWORK_PROTOCOL_UDP, - FS_NETWORK_PROTOCOL_TCP + FS_NETWORK_PROTOCOL_TCP, + FS_NETWORK_PROTOCOL_TCP_PASSIVE = FS_NETWORK_PROTOCOL_TCP, + FS_NETWORK_PROTOCOL_TCP_ACTIVE, + FS_NETWORK_PROTOCOL_TCP_SO, } FsNetworkProtocol; /** diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c index a085996e..4b5c67e9 100644 --- a/tests/check/transmitter/nice.c +++ b/tests/check/transmitter/nice.c @@ -65,9 +65,8 @@ _new_local_candidate (FsStreamTransmitter *st, FsCandidate *candidate, ts_fail_if (candidate == NULL, "Passed NULL candidate"); ts_fail_unless (candidate->ip != NULL, "Null IP in candidate"); - ts_fail_if (candidate->port == 0, "Candidate has port 0"); - ts_fail_unless (candidate->proto == FS_NETWORK_PROTOCOL_UDP, - "Protocol is not UDP"); + ts_fail_if (candidate->port == 0 && + candidate->proto != FS_NETWORK_PROTOCOL_TCP_ACTIVE); ts_fail_if (candidate->foundation == NULL, "Candidate doenst have a foundation"); ts_fail_if (candidate->component_id == 0, "Component id is 0"); @@ -125,6 +124,8 @@ set_the_candidates (gpointer user_data) next = g_list_next (item); + if (cand->proto != FS_NETWORK_PROTOCOL_UDP) + continue; if (cand->type != FS_CANDIDATE_TYPE_HOST) continue; if (cand->component_id != 1) @@ -702,18 +703,6 @@ GST_START_TEST (test_nicetransmitter_invalid_arguments) error->domain == FS_ERROR && error->code == FS_ERROR_INVALID_ARGUMENTS); g_clear_error (&error); - - /* invalid proto */ - g_value_take_boxed (¶ms[0].value, g_list_append (NULL, - fs_candidate_new (NULL, 0, FS_CANDIDATE_TYPE_HOST, - FS_NETWORK_PROTOCOL_TCP, "127.0.0.1", 0))); - - st = fs_transmitter_new_stream_transmitter (trans, p, 1, params, &error); - ts_fail_unless (st == NULL); - ts_fail_unless (error && - error->domain == FS_ERROR && - error->code == FS_ERROR_INVALID_ARGUMENTS); - g_clear_error (&error); g_value_unset (¶ms[0].value); params[0].name = "relay-info"; diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c index 4d3dd832..82bba32b 100644 --- a/transmitters/nice/fs-nice-stream-transmitter.c +++ b/transmitters/nice/fs-nice-stream-transmitter.c @@ -614,6 +614,12 @@ fs_network_protocol_to_nice_candidate_protocol (FsNetworkProtocol proto) { case FS_NETWORK_PROTOCOL_UDP: return NICE_CANDIDATE_TRANSPORT_UDP; + case FS_NETWORK_PROTOCOL_TCP_ACTIVE: + return NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE; + case FS_NETWORK_PROTOCOL_TCP_PASSIVE: + return NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE; + case FS_NETWORK_PROTOCOL_TCP_SO: + return NICE_CANDIDATE_TRANSPORT_TCP_SO; default: GST_WARNING ("Invalid Fs network protocol type %u", proto); return NICE_CANDIDATE_TRANSPORT_UDP; @@ -926,14 +932,6 @@ fs_nice_stream_transmitter_force_remote_candidates ( goto out; } - if (candidate->proto != FS_NETWORK_PROTOCOL_UDP) - { - g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS, - "Only UDP candidates can be set"); - res = FALSE; - goto out; - } - if (done[candidate->component_id-1]) { g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS, @@ -995,9 +993,15 @@ nice_candidate_transport_to_fs_network_protocol (NiceCandidateTransport trans) { case NICE_CANDIDATE_TRANSPORT_UDP: return FS_NETWORK_PROTOCOL_UDP; + case NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE: + return FS_NETWORK_PROTOCOL_TCP_PASSIVE; + case NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE: + return FS_NETWORK_PROTOCOL_TCP_ACTIVE; + case NICE_CANDIDATE_TRANSPORT_TCP_SO: + return FS_NETWORK_PROTOCOL_TCP_SO; default: GST_WARNING ("Invalid Nice network transport type %u", trans); - return FS_NETWORK_PROTOCOL_TCP; + return FS_NETWORK_PROTOCOL_UDP; } } @@ -1180,13 +1184,6 @@ fs_nice_stream_transmitter_build (FsNiceStreamTransmitter *self, "You can only set preferred candidates of type host"); return FALSE; } - - if (cand->proto != FS_NETWORK_PROTOCOL_UDP) - { - g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS, - "Only UDP preferred candidates can be set"); - return FALSE; - } } /* Now if we have a relayinfo, lets verify that its ok */ @@ -1655,9 +1652,6 @@ agent_new_candidate (NiceAgent *agent, { NiceCandidate *candidate = item->data; - if (candidate->transport != NICE_CANDIDATE_TRANSPORT_UDP) - continue; - if (!strcmp (candidate->foundation, foundation)) { fscandidate = nice_candidate_to_fs_candidate (agent, candidate, TRUE); |