mpegtsmux: Avoid crash when best pad gets flushed
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Mon, 31 Aug 2020 15:17:56 +0000 (17:17 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 19 Oct 2021 01:46:19 +0000 (01:46 +0000)
The 'best' pad might receive a flush event between us picking it and us
popping the buffer. In this case, the buffer will be missing.

Similar to https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/711

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1042>

subprojects/gst-plugins-bad/gst/mpegtsmux/gstbasetsmux.c

index e312ff0..844a4ea 100644 (file)
@@ -2294,6 +2294,10 @@ gst_base_ts_mux_aggregate (GstAggregator * agg, gboolean timeout)
     GstBuffer *buffer;
 
     buffer = gst_aggregator_pad_pop_buffer (GST_AGGREGATOR_PAD (best));
+    if (!buffer) {
+      /* We might have gotten a flush event after we picked the pad */
+      goto done;
+    }
 
     ret =
         gst_base_ts_mux_aggregate_buffer (GST_BASE_TS_MUX (agg),