flvmux: Correct metadata handling in file and stream mode

In file mode, only push one onMetaData at the start of the stream.

In stream mode, always push complete onMetaData. They get replaced, not
merged.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/418
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-12-03 13:47:22 +01:00
parent 6fdb6ece6e
commit 06600b2cd9
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5

View file

@ -828,7 +828,7 @@ gst_flv_mux_create_number_script_value (const gchar * name, gdouble value)
}
static GstBuffer *
gst_flv_mux_create_metadata (GstFlvMux * mux, gboolean full)
gst_flv_mux_create_metadata (GstFlvMux * mux)
{
const GstTagList *tags;
GstBuffer *script_tag, *tmp;
@ -871,9 +871,6 @@ gst_flv_mux_create_metadata (GstFlvMux * mux, gboolean full)
GST_WRITE_UINT32_BE (data + 1, n_tags);
script_tag = gst_buffer_append (script_tag, tmp);
if (!full)
goto tags;
/* Some players expect the 'duration' to be always set. Fill it out later,
after querying the pads or after getting EOS */
if (!mux->streamable) {
@ -894,7 +891,6 @@ gst_flv_mux_create_metadata (GstFlvMux * mux, gboolean full)
GST_DEBUG_OBJECT (mux, "not preallocating index, streamable mode");
}
tags:
for (i = 0; tags && i < n_tags; i++) {
const gchar *tag_name = gst_tag_list_nth_tag_name (tags, i);
if (!strcmp (tag_name, GST_TAG_DURATION)) {
@ -932,9 +928,6 @@ tags:
}
}
if (!full)
goto end;
if (!mux->streamable && mux->duration == GST_CLOCK_TIME_NONE) {
GList *l;
guint64 dur;
@ -1115,8 +1108,6 @@ tags:
tags_written++;
}
end:
if (!tags_written) {
gst_buffer_unref (script_tag);
script_tag = NULL;
@ -1362,7 +1353,7 @@ gst_flv_mux_prepare_src_caps (GstFlvMux * mux, GstBuffer ** header_buf,
GList *l;
header = gst_flv_mux_create_header (mux);
metadata = gst_flv_mux_create_metadata (mux, TRUE);
metadata = gst_flv_mux_create_metadata (mux);
video_codec_data = NULL;
audio_codec_data = NULL;
@ -1858,8 +1849,8 @@ gst_flv_mux_aggregate (GstAggregator * aggregator, gboolean timeout)
best = gst_flv_mux_find_best_pad (aggregator, &ts);
}
if (mux->new_tags) {
GstBuffer *buf = gst_flv_mux_create_metadata (mux, FALSE);
if (mux->new_tags && mux->streamable) {
GstBuffer *buf = gst_flv_mux_create_metadata (mux);
if (buf)
gst_flv_mux_push (mux, buf);
mux->new_tags = FALSE;