diff --git a/plugins/elements/gstelements_private.c b/plugins/elements/gstelements_private.c index b9a5517dc5..98a67056e7 100644 --- a/plugins/elements/gstelements_private.c +++ b/plugins/elements/gstelements_private.c @@ -167,7 +167,7 @@ gst_writev (gint fd, const struct iovec *iov, gint iovcnt, gsize total_bytes) * cases, and it's not clear how that can be reconciled with the * possibility of short writes, so in any case we might want to * simplify this later or just remove it. */ - if (total_bytes <= FDSINK_MAX_MALLOC_SIZE) { + if (iovcnt > 1 && total_bytes <= FDSINK_MAX_MALLOC_SIZE) { gchar *mem, *p; if (total_bytes <= FDSINK_MAX_ALLOCA_SIZE) @@ -440,7 +440,7 @@ gst_writev_buffer (GstObject * sink, gint fd, GstPoll * fdset, } GstFlowReturn -gst_write_mem (GstObject * sink, gint fd, GstPoll * fdset, +gst_writev_mem (GstObject * sink, gint fd, GstPoll * fdset, const guint8 * data, guint size, guint64 * bytes_written, guint64 skip, gint max_transient_error_timeout, guint64 current_position, @@ -475,6 +475,10 @@ gst_write_mem (GstObject * sink, gint fd, GstPoll * fdset, if (bytes_written) *bytes_written += bytes_written_local; + /* All done, no need for bookkeeping */ + if (bytes_written_local == left) + break; + /* skip partially written vector data */ if (bytes_written_local < left) { vec.iov_len -= bytes_written_local; diff --git a/plugins/elements/gstelements_private.h b/plugins/elements/gstelements_private.h index 98f694257f..0352943c76 100644 --- a/plugins/elements/gstelements_private.h +++ b/plugins/elements/gstelements_private.h @@ -48,7 +48,7 @@ GstFlowReturn gst_writev_buffer_list (GstObject * sink, gint fd, GstPoll * fdse gboolean * flushing); G_GNUC_INTERNAL -GstFlowReturn gst_write_mem (GstObject * sink, gint fd, GstPoll * fdset, +GstFlowReturn gst_writev_mem (GstObject * sink, gint fd, GstPoll * fdset, const guint8 *data, guint size, guint64 * bytes_written, guint64 skip, gint max_transient_error_timeout, guint64 current_position,