diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2020-08-31 16:01:32 +0300 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-08-31 17:19:14 +0300 |
commit | 2d08d16002205040bbaaf589f2294b886ee0e6d2 (patch) | |
tree | cc3e4cd9a5b39026a3a002d88102bcef3d5e426b /gst | |
parent | 01594d19b8dfac38226910d1b10231c26133c7f9 (diff) |
flvmux: Avoid crash when best pad gets flushed
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.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/711>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/flv/gstflvmux.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c index 8b9e73283..b691712c3 100644 --- a/gst/flv/gstflvmux.c +++ b/gst/flv/gstflvmux.c @@ -2005,6 +2005,15 @@ gst_flv_mux_aggregate (GstAggregator * aggregator, gboolean timeout) best = gst_flv_mux_find_best_pad (aggregator, &ts, timeout); } + if (best) { + buffer = gst_aggregator_pad_pop_buffer (GST_AGGREGATOR_PAD (best)); + if (!buffer) { + /* We might have gotten a flush event after we picked the pad */ + gst_object_unref (best); + return GST_AGGREGATOR_FLOW_NEED_DATA; + } + } + if (mux->new_tags && mux->streamable) { GstBuffer *buf = gst_flv_mux_create_metadata (mux); if (buf) @@ -2013,8 +2022,6 @@ gst_flv_mux_aggregate (GstAggregator * aggregator, gboolean timeout) } if (best) { - buffer = gst_aggregator_pad_pop_buffer (GST_AGGREGATOR_PAD (best)); - g_assert (buffer); best->dts = gst_flv_mux_segment_to_running_time (&GST_AGGREGATOR_PAD (best)->segment, GST_BUFFER_DTS_OR_PTS (buffer)); |