From 84e441d2685cf223d348a95be0c5ba693bbf6624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Zanelli?= Date: Mon, 22 Feb 2016 11:01:40 +0100 Subject: multifilesink: close file on write error with next-file mode is set to buffer If we have an error during fwrite call, file stays open and thus next incoming buffer will trigger an assert when trying to opening a new file. This happens if we do not restart element, file is closed at stop, and if application handles the returned GST_FLOW_ERROR to keep bin alive. https://bugzilla.gnome.org/show_bug.cgi?id=762434 --- gst/multifile/gstmultifilesink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/multifile/gstmultifilesink.c b/gst/multifile/gstmultifilesink.c index c74c20bdd..5d2878662 100644 --- a/gst/multifile/gstmultifilesink.c +++ b/gst/multifile/gstmultifilesink.c @@ -627,8 +627,10 @@ gst_multi_file_sink_write_buffer (GstMultiFileSink * multifilesink, "Writing buffer data (%" G_GSIZE_FORMAT " bytes) to new file", map.size); ret = fwrite (map.data, map.size, 1, multifilesink->file); - if (ret != 1) + if (ret != 1) { + gst_multi_file_sink_close_file (multifilesink, NULL); goto stdio_write_error; + } gst_multi_file_sink_close_file (multifilesink, buffer); break; -- cgit v1.2.1