qtmux: Fix assertion on caps update

GstQTMuxPad.configured_caps should be protected since it's
updated from streaming thread and accessed in aggregate thread

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4048>
This commit is contained in:
Seungha Yang 2023-02-22 22:18:48 +09:00 committed by Tim-Philipp Müller
parent 9ae84e3d08
commit 3553194926

View file

@ -5785,15 +5785,17 @@ static gboolean
gst_qt_mux_can_renegotiate (GstQTMux * qtmux, GstPad * pad, GstCaps * caps)
{
GstQTMuxPad *qtmuxpad = GST_QT_MUX_PAD_CAST (pad);
gboolean ret = TRUE;
/* does not go well to renegotiate stream mid-way, unless
* the old caps are a subset of the new one (this means upstream
* added more info to the caps, as both should be 'fixed' caps) */
GST_OBJECT_LOCK (qtmux);
if (!qtmuxpad->configured_caps) {
GST_DEBUG_OBJECT (qtmux, "pad %s accepted caps %" GST_PTR_FORMAT,
GST_PAD_NAME (pad), caps);
return TRUE;
goto out;
}
g_assert (caps != NULL);
@ -5802,14 +5804,18 @@ gst_qt_mux_can_renegotiate (GstQTMux * qtmux, GstPad * pad, GstCaps * caps)
GST_WARNING_OBJECT (qtmux,
"pad %s refused renegotiation to %" GST_PTR_FORMAT " from %"
GST_PTR_FORMAT, GST_PAD_NAME (pad), caps, qtmuxpad->configured_caps);
return FALSE;
ret = FALSE;
goto out;
}
GST_DEBUG_OBJECT (qtmux,
"pad %s accepted renegotiation to %" GST_PTR_FORMAT " from %"
GST_PTR_FORMAT, GST_PAD_NAME (pad), caps, qtmuxpad->configured_caps);
return TRUE;
out:
GST_OBJECT_UNLOCK (qtmux);
return ret;
}
static gboolean
@ -6971,8 +6977,10 @@ gst_qt_mux_sink_event (GstAggregator * agg, GstAggregatorPad * agg_pad,
GST_OBJECT_UNLOCK (qtmux);
}
GST_OBJECT_LOCK (qtmux);
if (ret)
gst_caps_replace (&qtmux_pad->configured_caps, caps);
GST_OBJECT_UNLOCK (qtmux);
gst_event_unref (event);
event = NULL;