diff options
Diffstat (limited to 'transmitters')
-rw-r--r-- | transmitters/nice/fs-nice-stream-transmitter.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/transmitters/nice/fs-nice-stream-transmitter.c b/transmitters/nice/fs-nice-stream-transmitter.c index 82bba32b..791d17ac 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); @@ -1387,6 +1419,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, @@ -1697,7 +1740,6 @@ agent_new_candidate (NiceAgent *agent, } else { - FS_NICE_STREAM_TRANSMITTER_UNLOCK (self); GST_WARNING ("Could not find local candidate with foundation %s" " for component %d in stream %d", foundation, component_id, stream_id); @@ -1851,7 +1893,7 @@ known_buffer_have_buffer_handler (GstPad *pad, GstPadProbeInfo *info, GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER (info); if (!g_atomic_int_get (&self->priv->associate_on_source)) - return TRUE; + return GST_PAD_PROBE_OK; component_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (pad), "component-id")); @@ -1859,5 +1901,5 @@ known_buffer_have_buffer_handler (GstPad *pad, GstPadProbeInfo *info, g_signal_emit_by_name (self, "known-source-packet-received", component_id, buffer); - return TRUE; + return GST_PAD_PROBE_OK; } |