asfdemux: FILE headers are mandatory in the header

As per the specification, also avoids ending up trying to play a
file with plenty of un-initialized values.

https://bugzilla.gnome.org/show_bug.cgi?id=774846
This commit is contained in:
Edward Hervey 2016-11-22 16:56:04 +01:00 committed by Edward Hervey
parent cc04255e94
commit e7ff86665a
2 changed files with 10 additions and 1 deletions

View file

@ -3575,7 +3575,7 @@ gst_asf_demux_process_header (GstASFDemux * demux, guint8 * data, guint64 size)
unknown = gst_asf_demux_get_uint8 (&data, &size);
GST_INFO_OBJECT (demux, "object is a header with %u parts", num_objects);
demux->saw_file_header = FALSE;
/* Loop through the header's objects, processing those */
for (i = 0; i < num_objects; ++i) {
GST_INFO_OBJECT (demux, "reading header part %u", i);
@ -3585,6 +3585,11 @@ gst_asf_demux_process_header (GstASFDemux * demux, guint8 * data, guint64 size)
break;
}
}
if (!demux->saw_file_header) {
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
("Header does not have mandatory FILE section"));
return GST_FLOW_ERROR;
}
return ret;
@ -3665,6 +3670,8 @@ gst_asf_demux_process_file (GstASFDemux * demux, guint8 * data, guint64 size)
packets_count);
GST_INFO ("preroll = %" G_GUINT64_FORMAT, demux->preroll);
demux->saw_file_header = TRUE;
return GST_FLOW_OK;
/* ERRORS */

View file

@ -240,6 +240,8 @@ struct _GstASFDemux {
/* parsing 3D */
GstASF3DMode asf_3D_mode;
gboolean saw_file_header;
};
struct _GstASFDemuxClass {