summaryrefslogtreecommitdiff
path: root/transmitters
diff options
context:
space:
mode:
authorJakub Adam <jakub.adam@ktknet.cz>2014-10-20 15:03:28 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2014-11-13 18:32:25 -0500
commit3e36909e396d389348a62181585cd20f43929937 (patch)
tree69742b671210a06c92b953ed1c7e949b80c8c0af /transmitters
parent75e249e8d9aa95e414145933aecb6b4f6614096f (diff)
downloadfarstream-3e36909e396d389348a62181585cd20f43929937.tar.gz
nicestreamtransmitter: expose port range setting from libnice
Diffstat (limited to 'transmitters')
-rw-r--r--transmitters/nice/fs-nice-stream-transmitter.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c
index a76f7f71..f0bd566e 100644
--- a/transmitters/nice/fs-nice-stream-transmitter.c
+++ b/transmitters/nice/fs-nice-stream-transmitter.c
@@ -66,6 +66,8 @@ enum
PROP_COMPATIBILITY_MODE,
PROP_ASSOCIATE_ON_SOURCE,
PROP_RELAY_INFO,
+ PROP_MIN_PORT,
+ PROP_MAX_PORT,
PROP_DEBUG
};
@@ -77,6 +79,9 @@ struct _FsNiceStreamTransmitterPrivate
guint stream_id;
+ guint min_port;
+ guint max_port;
+
gchar *stun_ip;
guint stun_port;
@@ -361,6 +366,27 @@ fs_nice_stream_transmitter_class_init (FsNiceStreamTransmitterClass *klass)
FALSE,
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_MIN_PORT,
+ g_param_spec_uint (
+ "min-port",
+ "Minimal listen port",
+ "Minimal port number for allocating host candidates."
+ " 0 means use any port",
+ 0, 65535,
+ 0,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_MAX_PORT,
+ g_param_spec_uint (
+ "max-port",
+ "Maximal listen port",
+ "Maximal port number for allocating host candidates."
+ " It should apply that min-port < max-port; otherwise, any port is"
+ " used, just as when the value is 0",
+ 0, 65535,
+ 0,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
}
static void
@@ -574,6 +600,12 @@ fs_nice_stream_transmitter_set_property (GObject *object,
case PROP_RELAY_INFO:
self->priv->relay_info = g_value_dup_boxed (value);
break;
+ case PROP_MIN_PORT:
+ self->priv->min_port = g_value_get_uint (value);
+ break;
+ case PROP_MAX_PORT:
+ self->priv->max_port = g_value_get_uint (value);
+ break;
case PROP_DEBUG:
if (g_value_get_boolean (value)) {
nice_debug_enable (TRUE);
@@ -1390,6 +1422,17 @@ fs_nice_stream_transmitter_build (FsNiceStreamTransmitter *self,
}
}
+ /* Set a port range if it has been specified. */
+ if (self->priv->min_port && (self->priv->min_port < self->priv->max_port))
+ {
+ gint c;
+ for (c = 1; c <= self->priv->transmitter->components; c++)
+ {
+ nice_agent_set_port_range (self->priv->agent->agent,
+ self->priv->stream_id, c, self->priv->min_port, self->priv->max_port);
+ }
+ }
+
self->priv->state_changed_handler_id = g_signal_connect_object (agent->agent,
"component-state-changed", G_CALLBACK (agent_state_changed), self, 0);
self->priv->gathering_done_handler_id = g_signal_connect_object (agent->agent,