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
This commit is contained in:
Aurélien Zanelli 2016-02-22 11:01:40 +01:00 committed by Sebastian Dröge
parent 8657987f8f
commit 84e441d268

View file

@ -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;