mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
appsrc: Always take the object lock when accessing the caps
Fixes bug #618625.
This commit is contained in:
parent
0c85f2c890
commit
f43216b9d7
1 changed files with 11 additions and 2 deletions
|
@ -939,8 +939,10 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
|
|||
GstAppSrc *appsrc = GST_APP_SRC_CAST (bsrc);
|
||||
GstAppSrcPrivate *priv = appsrc->priv;
|
||||
GstFlowReturn ret;
|
||||
GstCaps *caps;
|
||||
|
||||
GST_OBJECT_LOCK (appsrc);
|
||||
caps = priv->caps ? gst_caps_ref (priv->caps) : NULL;
|
||||
if (G_UNLIKELY (priv->size != bsrc->segment.duration &&
|
||||
bsrc->segment.format == GST_FORMAT_BYTES)) {
|
||||
GST_DEBUG_OBJECT (appsrc,
|
||||
|
@ -994,7 +996,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
|
|||
if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS)
|
||||
priv->offset += buf_size;
|
||||
*buf = gst_buffer_make_metadata_writable (*buf);
|
||||
gst_buffer_set_caps (*buf, priv->caps);
|
||||
gst_buffer_set_caps (*buf, caps);
|
||||
|
||||
/* signal that we removed an item */
|
||||
g_cond_broadcast (priv->cond);
|
||||
|
@ -1034,7 +1036,8 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
|
|||
g_cond_wait (priv->cond, priv->mutex);
|
||||
}
|
||||
g_mutex_unlock (priv->mutex);
|
||||
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
|
@ -1042,17 +1045,23 @@ flushing:
|
|||
{
|
||||
GST_DEBUG_OBJECT (appsrc, "we are flushing");
|
||||
g_mutex_unlock (priv->mutex);
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
return GST_FLOW_WRONG_STATE;
|
||||
}
|
||||
eos:
|
||||
{
|
||||
GST_DEBUG_OBJECT (appsrc, "we are EOS");
|
||||
g_mutex_unlock (priv->mutex);
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
return GST_FLOW_UNEXPECTED;
|
||||
}
|
||||
seek_error:
|
||||
{
|
||||
g_mutex_unlock (priv->mutex);
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
GST_ELEMENT_ERROR (appsrc, RESOURCE, READ, ("failed to seek"),
|
||||
GST_ERROR_SYSTEM);
|
||||
return GST_FLOW_ERROR;
|
||||
|
|
Loading…
Reference in a new issue