mpegtsparse: Don't assert the packet_size when filling for EOS

If the packetizer got reset for any reason (failure to find PCR?) then
the packet_size can be zero here even though we already enqueued some
packets.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1038>
This commit is contained in:
Jan Alexander Steffens (heftig) 2021-09-24 11:53:56 +02:00 committed by GStreamer Marge Bot
parent b099ba649e
commit 0596da1966

View file

@ -423,9 +423,12 @@ push_event (MpegTSBase * base, GstEvent * event)
prepare_src_pad (base, parse);
}
if (G_UNLIKELY (GST_EVENT_TYPE (event) == GST_EVENT_EOS)) {
gsize packet_size = base->packetizer->packet_size;
parse->is_eos = TRUE;
if (parse->alignment > 0 && parse->ts_adapter.packets_in_adapter > 0
if (packet_size > 0 && parse->alignment > 0 &&
parse->ts_adapter.packets_in_adapter > 0
&& parse->ts_adapter.packets_in_adapter < parse->alignment) {
GstBuffer *buf;
GstMapInfo map;
@ -433,7 +436,6 @@ push_event (MpegTSBase * base, GstEvent * event)
gint missing_packets =
parse->alignment - parse->ts_adapter.packets_in_adapter;
gint i = missing_packets;
gsize packet_size = base->packetizer->packet_size;
GST_DEBUG_OBJECT (parse, "Adding %d dummy packets", missing_packets);
@ -441,8 +443,6 @@ push_event (MpegTSBase * base, GstEvent * event)
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
data = map.data;
g_assert (packet_size > 0);
for (; i > 0; i--) {
gint offset;