matroskamux: Error out if we start writing data with some pads not having a codec id yet

This can only happen if a) upstream somehow gets around the CAPS event failing
or b) there never being any CAPS event.

The following code assumes that all pads have a codec-id.

https://bugzilla.gnome.org/show_bug.cgi?id=768509
This commit is contained in:
Sebastian Dröge 2016-07-07 18:23:07 +03:00
parent cc636760b6
commit dbb8ec4639

View file

@ -2881,7 +2881,7 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
thepad = collect_pad->collect.pad;
if (gst_pad_is_linked (thepad) && gst_pad_is_active (thepad) &&
collect_pad->track->codec_id != 0) {
collect_pad->track->codec_id != NULL) {
collect_pad->track->num = tracknum++;
child = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKENTRY);
gst_matroska_mux_track_header (mux, collect_pad->track);
@ -3544,12 +3544,11 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad,
}
/* for dirac we have to queue up everything up to a picture unit */
if (!g_strcmp0 (collect_pad->track->codec_id,
GST_MATROSKA_CODEC_ID_VIDEO_DIRAC)) {
if (!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_DIRAC)) {
buf = gst_matroska_mux_handle_dirac_packet (mux, collect_pad, buf);
if (!buf)
return GST_FLOW_OK;
} else if (!g_strcmp0 (collect_pad->track->codec_id,
} else if (!strcmp (collect_pad->track->codec_id,
GST_MATROSKA_CODEC_ID_VIDEO_PRORES)) {
/* Remove the 'Frame container atom' header' */
buf = gst_buffer_make_writable (buf);
@ -3820,6 +3819,12 @@ gst_matroska_mux_handle_buffer (GstCollectPads * pads, GstCollectData * data,
goto exit;
}
if (best->track->codec_id == NULL) {
GST_ERROR_OBJECT (best->collect.pad, "No codec-id for pad");
ret = GST_FLOW_NOT_NEGOTIATED;
goto exit;
}
/* if we have a best stream, should also have a buffer */
g_assert (buf);