[farsight2/master] Use sending property in multicast filter
Olivier Crête
olivier.crete at collabora.co.uk
Thu Feb 5 06:32:07 PST 2009
---
transmitters/multicast/fs-multicast-transmitter.c | 44 +++++++++++++++-----
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/transmitters/multicast/fs-multicast-transmitter.c b/transmitters/multicast/fs-multicast-transmitter.c
index 136c2e8..5b77889 100644
--- a/transmitters/multicast/fs-multicast-transmitter.c
+++ b/transmitters/multicast/fs-multicast-transmitter.c
@@ -485,7 +485,7 @@ struct _UdpSock {
GstPad *udpsrc_requested_pad;
GstElement *udpsink;
- GstElement *udpsink_filter;
+ GstElement *udpsink_recvonly_filter;
GstPad *udpsink_requested_pad;
gchar *local_ip;
@@ -904,9 +904,13 @@ fs_multicast_transmitter_get_udpsock (FsMulticastTransmitter *trans,
if (!udpsock->udpsrc)
goto error;
+ udpsock->udpsink_recvonly_filter = fs_transmitter_get_recvonly_filter (
+ FS_TRANSMITTER (trans), udpsock->component_id);
+
udpsock->udpsink = _create_sinksource ("multiudpsink",
- GST_BIN (trans->priv->gst_sink), udpsock->tee, NULL, udpsock->fd,
- GST_PAD_SINK, &udpsock->udpsink_requested_pad, error);
+ GST_BIN (trans->priv->gst_sink), udpsock->tee,
+ udpsock->udpsink_recvonly_filter,
+ udpsock->fd, GST_PAD_SINK, &udpsock->udpsink_requested_pad, error);
if (!udpsock->udpsink)
goto error;
@@ -931,6 +935,13 @@ fs_multicast_transmitter_get_udpsock (FsMulticastTransmitter *trans,
g_list_prepend (trans->priv->udpsocks[component_id], udpsock);
g_mutex_unlock (trans->priv->mutex);
+ if (udpsock->udpsink_recvonly_filter)
+ g_signal_emit_by_name (udpsock->udpsink, "add", udpsock->multicast_ip,
+ udpsock->port);
+
+ if (sending)
+ fs_multicast_transmitter_udpsock_inc_sending (udpsock);
+
return udpsock;
error:
@@ -1032,16 +1043,17 @@ fs_multicast_transmitter_put_udpsock (FsMulticastTransmitter *trans,
GST_ERROR ("Could not remove udpsink element from transmitter source");
}
- if (udpsock->udpsink_filter)
+ if (udpsock->udpsink_recvonly_filter)
{
GstStateChangeReturn ret;
- gst_element_set_locked_state (udpsock->udpsink_filter, TRUE);
- ret = gst_element_set_state (udpsock->udpsink_filter, GST_STATE_NULL);
+ gst_element_set_locked_state (udpsock->udpsink_recvonly_filter, TRUE);
+ ret = gst_element_set_state (udpsock->udpsink_recvonly_filter,
+ GST_STATE_NULL);
if (ret != GST_STATE_CHANGE_SUCCESS)
GST_ERROR ("Error changing state of udpsink filter: %s",
gst_element_state_change_return_get_name (ret));
if (!gst_bin_remove (GST_BIN (trans->priv->gst_sink),
- udpsock->udpsink_filter))
+ udpsock->udpsink_recvonly_filter))
GST_ERROR ("Could not remove sink filter element from transmitter sink");
}
@@ -1058,16 +1070,26 @@ void
fs_multicast_transmitter_udpsock_inc_sending (UdpSock *udpsock)
{
if (g_atomic_int_exchange_and_add (&udpsock->sendcount, 1) == 0)
- g_signal_emit_by_name (udpsock->udpsink, "add", udpsock->multicast_ip,
- udpsock->port);
+ {
+ if (udpsock->udpsink_recvonly_filter)
+ g_object_set (udpsock->udpsink_recvonly_filter, "sending", TRUE, NULL);
+ else
+ g_signal_emit_by_name (udpsock->udpsink, "add", udpsock->multicast_ip,
+ udpsock->port);
+ }
}
void
fs_multicast_transmitter_udpsock_dec_sending (UdpSock *udpsock)
{
if (g_atomic_int_dec_and_test (&udpsock->sendcount))
- g_signal_emit_by_name (udpsock->udpsink, "remove", udpsock->multicast_ip,
- udpsock->port);
+ {
+ if (udpsock->udpsink_recvonly_filter)
+ g_object_set (udpsock->udpsink_recvonly_filter, "sending", FALSE, NULL);
+ else
+ g_signal_emit_by_name (udpsock->udpsink, "remove", udpsock->multicast_ip,
+ udpsock->port);
+ }
}
static GType
--
1.5.6.5
More information about the farsight-commits
mailing list