From: Edward Hervey Date: Wed, 27 Apr 2022 13:24:50 +0000 (+0200) Subject: mpegts: Handle "empty" PMT gracefully X-Git-Tag: 1.22.0~1717 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=10f72da5040b74678c8f81723971127ee8bee04f;p=platform%2Fupstream%2Fgstreamer.git 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: --- diff --git a/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c b/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c index 5a0d309..2f9e88c 100644 --- a/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c +++ b/subprojects/gst-plugins-bad/gst/mpegtsdemux/mpegtsbase.c @@ -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);