mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
filesink/fdsink: Write 1 iovec directly without copying if there's no writev() support
This commit is contained in:
parent
c15f1b2bec
commit
93ffec7b2e
2 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue