mpegts: Handle "empty" PMT gracefully

Some streams have 2 PMT sections in a single TS packet. The first one is "valid"
but doesn't contain/define any streams. That causes an unrecoverable issue when
we try to activate the 2nd (valid) PMT.

Instead of doing that, pre-emptively refuse to process PMT without any streams
present within. We still do post that section on the bus to inform applications.

Fixes #1181

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2310>
This commit is contained in:
Edward Hervey 2022-04-27 15:24:50 +02:00 committed by GStreamer Marge Bot
parent 853963ba21
commit 10f72da504

View file

@ -1190,6 +1190,12 @@ mpegts_base_apply_pmt (MpegTSBase * base, GstMpegtsSection * section)
return TRUE;
}
/* Don't attempt to handle pmt without any streams */
if (G_UNLIKELY (pmt->streams->len == 0)) {
GST_WARNING ("Skipping PMT without any entries");
return TRUE;
}
program_number = section->subtable_extension;
GST_DEBUG ("Applying PMT (program_number:%d, pid:0x%04x)",
program_number, section->pid);