matroska-mux: Warn on late caps arrival

As well as warning when caps change after the headers
were already written, make sure to warn if the *first* caos
arrive late too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/656>
This commit is contained in:
Jan Schmidt 2020-07-01 16:13:27 +10:00
parent e589a950c3
commit ed5e935fb7

View file

@ -977,6 +977,11 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
goto refuse_caps;
}
gst_caps_unref (old_caps);
} else if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER) {
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
("Caps on pad %" GST_PTR_FORMAT
" arrived late. Headers were already written", pad));
goto refuse_caps;
}
/* find context */
@ -1834,6 +1839,11 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
goto refuse_caps;
}
gst_caps_unref (old_caps);
} else if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER) {
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
("Caps on pad %" GST_PTR_FORMAT
" arrived late. Headers were already written", pad));
goto refuse_caps;
}
/* find context */
@ -2270,6 +2280,11 @@ gst_matroska_mux_subtitle_pad_setcaps (GstPad * pad, GstCaps * caps)
goto refuse_caps;
}
gst_caps_unref (old_caps);
} else if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER) {
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
("Caps on pad %" GST_PTR_FORMAT
" arrived late. Headers were already written", pad));
goto refuse_caps;
}
/* find context */
@ -2779,6 +2794,8 @@ gst_matroska_mux_track_header (GstMatroskaMux * mux,
break;
}
GST_DEBUG_OBJECT (mux, "Wrote track header. Codec %s", context->codec_id);
gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_CODECID, context->codec_id);
if (context->codec_priv)
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECPRIVATE,