mpegtsmux: Fixup program array indices after stream removal
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Thu, 20 May 2021 08:09:57 +0000 (10:09 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 20 May 2021 13:35:06 +0000 (13:35 +0000)
commit0312887452e25c75124f38126c2bd704d88caaa9
treece687d316c32fc3e8c5629dcd130d13c2f420bb2
parent360a1951585a6f41e8ca02ed5dfaf085fd6a104e
mpegtsmux: Fixup program array indices after stream removal

Each stream stores the `program_array_index` of its position in its
program's `streams` array. When we remove a stream from this array, we
need to correct the `program_array_index` of all streams that were
backshifted by the removal.

Also extract the removal into a new function and add some more safety
checks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2266>
gst/mpegtsmux/tsmux/tsmux.c