summaryrefslogtreecommitdiffstats
path: root/gst/udp
diff options
context:
space:
mode:
authorPeter Kjellerstedt <pkj@axis.com>2008-11-28 15:10:50 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-11-28 15:10:50 +0000
commit3db0832748b7e2ba4d47ec2436f1d78d2b7ed1e1 (patch)
tree9dc7de1f07406e8ba1316c55e4f7fb35a2714e50 /gst/udp
parent24e30c883470beabbe88e84ead18ad0d24adc99a (diff)
gst/udp/gstmultiudpsink.c: Make gst_multiudpsink_render() ignore errors from sendto() instead of breaking streaming. ...
Original commit message from CVS: Patch by: Peter Kjellerstedt <pkj at axis com> * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_render): Make gst_multiudpsink_render() ignore errors from sendto() instead of breaking streaming. Emit a warning instead. Fixes #562572.
Diffstat (limited to 'gst/udp')
-rw-r--r--gst/udp/gstmultiudpsink.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c
index 95d15ab3..5b55b2ce 100644
--- a/gst/udp/gstmultiudpsink.c
+++ b/gst/udp/gstmultiudpsink.c
@@ -371,7 +371,7 @@ static GstFlowReturn
gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
{
GstMultiUDPSink *sink;
- gint ret, size, num = 0;
+ gint ret, size, num = 0, no_clients = 0;
guint8 *data;
GList *clients;
gint len;
@@ -392,26 +392,30 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
GstUDPClient *client;
client = (GstUDPClient *) clients->data;
- num++;
+ no_clients++;
GST_LOG_OBJECT (sink, "sending %d bytes to client %p", size, client);
while (TRUE) {
len = gst_udp_get_sockaddr_length (&client->theiraddr);
+
+ ret = sendto (*client->sock,
#ifdef G_OS_WIN32
- ret = sendto (*client->sock, (char *) data, size, 0,
+ (char *) data,
#else
- ret = sendto (*client->sock, data, size, 0,
+ data,
#endif
- (struct sockaddr *) &client->theiraddr, len);
+ size, 0, (struct sockaddr *) &client->theiraddr, len);
+
if (ret < 0) {
- /* we get a non-posix EPERM on Linux when a firewall rule blocks this
- * destination. We will simply ignore this. */
- if (errno == EPERM)
- break;
+ /* some error, just warn, it's likely recoverable and we don't want to
+ * break streaming. We break so that we stop retrying for this client. */
if (errno != EINTR && errno != EAGAIN) {
- goto send_error;
+ GST_WARNING_OBJECT (sink, "client %p gave error %d (%s)", errno,
+ g_strerror (errno));
+ break;
}
} else {
+ num++;
client->bytes_sent += ret;
client->packets_sent++;
sink->bytes_served += ret;
@@ -421,20 +425,10 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
}
g_mutex_unlock (sink->client_lock);
- GST_LOG_OBJECT (sink, "sent %d bytes to %d clients", size, num);
+ GST_LOG_OBJECT (sink, "sent %d bytes to %d (of %d) clients", size, num,
+ no_clients);
return GST_FLOW_OK;
-
- /* ERRORS */
-send_error:
- {
- /* if sendto returns an error, something is seriously wrong */
- g_mutex_unlock (sink->client_lock);
- GST_DEBUG_OBJECT (sink, "got send error %d: %s", errno, g_strerror (errno));
- GST_ELEMENT_ERROR (sink, STREAM, FAILED, (NULL),
- ("Got send error %d: %s", errno, g_strerror (errno)));
- return GST_FLOW_ERROR;
- }
}
static void