diff options
-rw-r--r-- | gst/gio/gstgiobasesink.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/gst/gio/gstgiobasesink.c b/gst/gio/gstgiobasesink.c index 6a8f5b191..cbd400492 100644 --- a/gst/gio/gstgiobasesink.c +++ b/gst/gio/gstgiobasesink.c @@ -263,7 +263,7 @@ static GstFlowReturn gst_gio_base_sink_render (GstBaseSink * base_sink, GstBuffer * buffer) { GstGioBaseSink *sink = GST_GIO_BASE_SINK (base_sink); - gssize written; + gsize written; GstMapInfo map; gboolean success; GError *err = NULL; @@ -276,23 +276,11 @@ gst_gio_base_sink_render (GstBaseSink * base_sink, GstBuffer * buffer) "writing %" G_GSIZE_FORMAT " bytes to offset %" G_GUINT64_FORMAT, map.size, sink->position); - written = - g_output_stream_write (sink->stream, map.data, map.size, sink->cancel, - &err); + success = + g_output_stream_write_all (sink->stream, map.data, map.size, &written, + sink->cancel, &err); gst_buffer_unmap (buffer, &map); - success = (written >= 0); - - if (G_UNLIKELY (success && written < map.size)) { - /* FIXME: Can this happen? Should we handle it gracefully? gnomevfssink - * doesn't... */ - GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, (NULL), - ("Could not write to stream: (short write, only %" - G_GSSIZE_FORMAT " bytes of %" G_GSIZE_FORMAT " bytes written)", - written, map.size)); - return GST_FLOW_ERROR; - } - if (success) { sink->position += written; return GST_FLOW_OK; @@ -300,7 +288,7 @@ gst_gio_base_sink_render (GstBaseSink * base_sink, GstBuffer * buffer) } else { GstFlowReturn ret; - if (!gst_gio_error (sink, "g_output_stream_write", &err, &ret)) { + if (!gst_gio_error (sink, "g_output_stream_write_all", &err, &ret)) { if (GST_GIO_ERROR_MATCHES (err, NO_SPACE)) { GST_ELEMENT_ERROR (sink, RESOURCE, NO_SPACE_LEFT, (NULL), ("Could not write to stream: %s", err->message)); |