mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
multifilesink: don't write stream header twice for first file
This commit is contained in:
parent
7112b93a97
commit
175f666293
1 changed files with 11 additions and 5 deletions
|
@ -512,6 +512,7 @@ gst_multi_file_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
gchar *filename;
|
||||
gboolean ret;
|
||||
GError *error = NULL;
|
||||
gboolean first_file = TRUE;
|
||||
|
||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
||||
|
||||
|
@ -561,9 +562,10 @@ gst_multi_file_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) &&
|
||||
GST_BUFFER_TIMESTAMP (buffer) >= multifilesink->next_segment &&
|
||||
!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
||||
if (multifilesink->file)
|
||||
if (multifilesink->file) {
|
||||
first_file = FALSE;
|
||||
gst_multi_file_sink_close_file (multifilesink, buffer);
|
||||
|
||||
}
|
||||
multifilesink->next_segment += 10 * GST_SECOND;
|
||||
}
|
||||
|
||||
|
@ -571,6 +573,7 @@ gst_multi_file_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
if (!gst_multi_file_sink_open_next_file (multifilesink))
|
||||
goto stdio_write_error;
|
||||
|
||||
if (!first_file)
|
||||
gst_multi_file_sink_write_stream_headers (multifilesink);
|
||||
}
|
||||
|
||||
|
@ -605,14 +608,17 @@ gst_multi_file_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
multifilesink->cur_file_size, new_size,
|
||||
multifilesink->max_file_size);
|
||||
|
||||
if (multifilesink->file != NULL)
|
||||
if (multifilesink->file != NULL) {
|
||||
first_file = FALSE;
|
||||
gst_multi_file_sink_close_file (multifilesink, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (multifilesink->file == NULL) {
|
||||
if (!gst_multi_file_sink_open_next_file (multifilesink))
|
||||
goto stdio_write_error;
|
||||
|
||||
if (!first_file)
|
||||
gst_multi_file_sink_write_stream_headers (multifilesink);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue