gst_writev: Respect UIO_MAXIOV limit for the iov array
authorJan Schmidt <jan@centricular.com>
Thu, 11 Jun 2015 15:15:19 +0000 (01:15 +1000)
committerJan Schmidt <jan@centricular.com>
Thu, 11 Jun 2015 15:17:24 +0000 (01:17 +1000)
If we receive more than UIO_MAXIOV (1024 typically) buffers
in a single writev call, fall back to consolidating them
into one output buffer or multiple write calls.

This could be made more optimal, but let's wait until it's
ever a bottleneck for someone

plugins/elements/gstelements_private.c

index fe6d663..fdc1370 100644 (file)
@@ -105,7 +105,7 @@ gst_writev (gint fd, const struct iovec *iov, gint iovcnt, gsize total_bytes)
   gssize written;
 
 #ifdef HAVE_SYS_UIO_H
-  if (TRUE) {
+  if (iovcnt <= UIO_MAXIOV) {
     do {
       written = writev (fd, iov, iovcnt);
     } while (written < 0 && errno == EINTR);