diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2020-07-07 13:33:53 +0200 |
---|---|---|
committer | Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com> | 2020-07-07 14:05:04 +0200 |
commit | cba9ba9b38de559de82b54bf66fef0a7f4c1af94 (patch) | |
tree | 48c10df900c7c803cca27c133279949a7e09a783 /gst | |
parent | 9e977832c1761e3ad002fdfe14a9c3881a60bd45 (diff) | |
download | gstreamer-plugins-bad-cba9ba9b38de559de82b54bf66fef0a7f4c1af94.tar.gz |
mpegtsmux: Avoid crash releasing pad with NULL prog
If we release a pad while the muxer is running which has never been used
for aggregation (thus it does not have an assigned program), `prog` is
NULL.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1411>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mpegtsmux/gstbasetsmux.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gst/mpegtsmux/gstbasetsmux.c b/gst/mpegtsmux/gstbasetsmux.c index 7f219fa6c..462cf0ef0 100644 --- a/gst/mpegtsmux/gstbasetsmux.c +++ b/gst/mpegtsmux/gstbasetsmux.c @@ -1292,13 +1292,15 @@ gst_base_ts_mux_release_pad (GstElement * element, GstPad * pad) GstBaseTsMuxPad *ts_pad = GST_BASE_TS_MUX_PAD (pad); gint pid = ts_pad->pid; - if (ts_pad->prog->pcr_stream == ts_pad->stream) { - tsmux_stream_pcr_unref (ts_pad->prog->pcr_stream); - ts_pad->prog->pcr_stream = NULL; - } - if (tsmux_remove_stream (mux->tsmux, pid, ts_pad->prog)) { - g_hash_table_remove (mux->programs, GINT_TO_POINTER (ts_pad->prog_id)); + if (ts_pad->prog) { + if (ts_pad->prog->pcr_stream == ts_pad->stream) { + tsmux_program_set_pcr_stream (ts_pad->prog, NULL); + } + if (tsmux_remove_stream (mux->tsmux, pid, ts_pad->prog)) { + g_hash_table_remove (mux->programs, GINT_TO_POINTER (ts_pad->prog_id)); + } } + tsmux_resend_pat (mux->tsmux); tsmux_resend_si (mux->tsmux); |