diff options
author | Jarkko Palviainen <jarkko.palviainen at sesca.com> | 2009-08-31 12:13:07 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-08-31 12:13:07 +0200 |
commit | e2518fedbe8f6eb9cf1cf456381a5e350e2c4001 (patch) | |
tree | af41603f10b6a07b6581378598f1e44558c1fcfa /gst/udp/gstmultiudpsink.c | |
parent | 6a53d0a2c983bfeac2f02c9ef9cd3ff155f4e4fd (diff) |
udp: split out TTL and loop options
Split setting the TTL and loop parameters in 2 methods as they are not related.
Fix setting the TTL correctly for multicast streams.
See #588245
Diffstat (limited to 'gst/udp/gstmultiudpsink.c')
-rw-r--r-- | gst/udp/gstmultiudpsink.c | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index a6afc9ae..6b5ca4d4 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -723,14 +723,26 @@ gst_multiudpsink_init_send (GstMultiUDPSink * sink) sink->bytes_to_serve = 0; sink->bytes_served = 0; - gst_udp_set_loop_ttl (sink->sock, sink->loop, sink->ttl); gst_multiudpsink_setup_qos_dscp (sink); - /* look for multicast clients and join multicast groups appropriately */ + /* look for multicast clients and join multicast groups appropriately + set also ttl and multicast loopback delivery appropriately */ for (clients = sink->clients; clients; clients = g_list_next (clients)) { client = (GstUDPClient *) clients->data; - if (sink->auto_multicast && gst_udp_is_multicast (&client->theiraddr)) - gst_udp_join_group (*(client->sock), &client->theiraddr, NULL); + if (gst_udp_is_multicast (&client->theiraddr)) { + if (sink->auto_multicast) { + if (gst_udp_join_group (*(client->sock), &client->theiraddr, NULL) + != 0) + goto join_group_failed; + } + if (gst_udp_set_loop (sink->sock, sink->loop) != 0) + goto loop_failed; + if (gst_udp_set_ttl (sink->sock, sink->ttl, TRUE) != 0) + goto ttl_failed; + } else { + if (gst_udp_set_ttl (sink->sock, sink->ttl, FALSE) != 0) + goto ttl_failed; + } } return TRUE; @@ -749,6 +761,29 @@ no_broadcast: g_strerror (errno))); return FALSE; } +join_group_failed: + { + CLOSE_IF_REQUESTED (sink); + GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL), + ("Could not join multicast group (%d): %s", errno, g_strerror (errno))); + return FALSE; + } +ttl_failed: + { + CLOSE_IF_REQUESTED (sink); + GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL), + ("Could not set TTL socket option (%d): %s", errno, + g_strerror (errno))); + return FALSE; + } +loop_failed: + { + CLOSE_IF_REQUESTED (sink); + GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, (NULL), + ("Could not set loopback socket option (%d): %s", errno, + g_strerror (errno))); + return FALSE; + } } static void |