[farsight2/master] Move handling of the sending property to the component object
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:21:59 PST 2008
---
transmitters/rawudp/fs-rawudp-component.c | 24 ++++++++++++++--
transmitters/rawudp/fs-rawudp-stream-transmitter.c | 29 +++----------------
2 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/transmitters/rawudp/fs-rawudp-component.c b/transmitters/rawudp/fs-rawudp-component.c
index 4484521..54b9852 100644
--- a/transmitters/rawudp/fs-rawudp-component.c
+++ b/transmitters/rawudp/fs-rawudp-component.c
@@ -314,9 +314,27 @@ fs_rawudp_component_set_property (GObject *object,
self->priv->component = g_value_get_uint (value);
break;
case PROP_SENDING:
- FS_RAWUDP_COMPONENT_LOCK (self);
- self->priv->sending = g_value_get_boolean (value);
- FS_RAWUDP_COMPONENT_UNLOCK (self);
+ {
+ gboolean sending, old_sending;
+ FsCandidate *candidate = NULL;
+ FS_RAWUDP_COMPONENT_LOCK (self);
+ old_sending = self->priv->sending;
+ sending = self->priv->sending = g_value_get_boolean (value);
+ if (self->priv->remote_candidate)
+ candidate = fs_candidate_copy (self->priv->remote_candidate);
+ FS_RAWUDP_COMPONENT_UNLOCK (self);
+
+ if (sending != old_sending && candidate)
+ {
+ if (sending)
+ fs_rawudp_transmitter_udpport_add_dest (self->priv->udpport,
+ candidate->ip, candidate->port);
+ else
+ fs_rawudp_transmitter_udpport_remove_dest (self->priv->udpport,
+ candidate->ip, candidate->port);
+ fs_candidate_destroy (candidate);
+ }
+ }
break;
case PROP_STUN_IP:
g_free (self->priv->stun_ip);
diff --git a/transmitters/rawudp/fs-rawudp-stream-transmitter.c b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
index e7558b2..2342122 100644
--- a/transmitters/rawudp/fs-rawudp-stream-transmitter.c
+++ b/transmitters/rawudp/fs-rawudp-stream-transmitter.c
@@ -373,8 +373,7 @@ fs_rawudp_stream_transmitter_finalize (GObject *object)
{
if (self->priv->remote_candidate[c])
{
- if (self->priv->udpports && self->priv->udpports[c] &&
- self->priv->sending)
+ if (self->priv->udpports && self->priv->udpports[c])
fs_candidate_destroy (self->priv->remote_candidate[c]);
}
}
@@ -476,32 +475,14 @@ fs_rawudp_stream_transmitter_set_property (GObject *object,
{
case PROP_SENDING:
{
- gboolean old_sending = self->priv->sending;
gint c;
self->priv->sending = g_value_get_boolean (value);
- if (self->priv->sending != old_sending)
- {
- if (self->priv->sending)
- {
-
- for (c = 1; c <= self->priv->transmitter->components; c++)
- if (self->priv->remote_candidate[c])
- fs_rawudp_transmitter_udpport_add_dest (
- self->priv->udpports[c],
- self->priv->remote_candidate[c]->ip,
- self->priv->remote_candidate[c]->port);
- } else {
-
- for (c = 1; c <= self->priv->transmitter->components; c++)
- if (self->priv->remote_candidate[c])
- fs_rawudp_transmitter_udpport_remove_dest (
- self->priv->udpports[c],
- self->priv->remote_candidate[c]->ip,
- self->priv->remote_candidate[c]->port);
- }
- }
+ for (c = 1; c <= self->priv->transmitter->components; c++)
+ if (self->priv->component[c])
+ g_object_set_property (self->priv->component[c],
+ "sending", value);
}
break;
case PROP_PREFERRED_LOCAL_CANDIDATES:
--
1.5.6.5
More information about the farsight-commits
mailing list