From f93b9df83dda45af00d92b5a9745d8d3325afdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 8 Jul 2009 17:24:19 +0200 Subject: [PATCH] gio: Make sure to flush the output stream if it shouldn't be closed Otherwise there might still be unwritten data after the element has stopped. --- ext/gio/gstgiobasesink.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ext/gio/gstgiobasesink.c b/ext/gio/gstgiobasesink.c index 7ddd970628..2b16909b2a 100644 --- a/ext/gio/gstgiobasesink.c +++ b/ext/gio/gstgiobasesink.c @@ -159,6 +159,19 @@ gst_gio_base_sink_stop (GstBaseSink * base_sink) g_object_unref (sink->stream); sink->stream = NULL; } else { + success = g_output_stream_flush (sink->stream, sink->cancel, &err); + + if (!success && !gst_gio_error (sink, "g_output_stream_flush", &err, NULL)) { + GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL), + ("gio_output_stream_flush failed: %s", err->message)); + g_clear_error (&err); + } else if (!success) { + GST_ELEMENT_WARNING (sink, RESOURCE, CLOSE, (NULL), + ("g_output_stream_flush failed")); + } else { + GST_DEBUG_OBJECT (sink, "g_outut_stream_flush succeeded"); + } + g_object_unref (sink->stream); sink->stream = NULL; }