asfdemux: Be more lenient towards malformed header

VLC counts METADATA as 1 even if the specification states you must not.
This leads to asfdemux failing since there are no bytes left when asfdemux
tries to extract the "last" header.

Do not fail hard in this case and try to proceed when everything else went
fine.
So at least gst-discoverer will see what's in the file.

Closes #3684

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7216>
This commit is contained in:
Sebastian Gross 2024-07-22 09:29:52 +02:00 committed by Backport Bot
parent b831478e53
commit 406e8f3fe3

View file

@ -3712,6 +3712,16 @@ gst_asf_demux_process_header (GstASFDemux * demux, guint8 * data, guint64 size)
demux->saw_file_header = FALSE;
/* Loop through the header's objects, processing those */
for (i = 0; i < num_objects; ++i) {
/* Do not try to process non existent header and accept the num_objects was
* too high (as VLC counts METADATA object even if it shouldn't) and proceed
* normally */
if (size == 0) {
GST_WARNING_OBJECT (demux, "No bytes left for header part %u: Skipping",
i);
break;
}
GST_INFO_OBJECT (demux, "reading header part %u", i);
ret = gst_asf_demux_process_object (demux, &data, &size);
if (ret != GST_FLOW_OK) {