mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
mimdec: Remove object lock usage, stream lock is enough
This commit is contained in:
parent
59547d6eed
commit
791710a92f
2 changed files with 2 additions and 18 deletions
|
@ -172,7 +172,6 @@ gst_mim_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
|
|
||||||
gst_adapter_push (mimdec->adapter, buf);
|
gst_adapter_push (mimdec->adapter, buf);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (mimdec);
|
|
||||||
|
|
||||||
/* do we have enough bytes to read a header */
|
/* do we have enough bytes to read a header */
|
||||||
while (gst_adapter_available (mimdec->adapter) >= 24) {
|
while (gst_adapter_available (mimdec->adapter) >= 24) {
|
||||||
|
@ -252,11 +251,11 @@ gst_mim_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
current_ts * GST_MSECOND, -1, 0);
|
current_ts * GST_MSECOND, -1, 0);
|
||||||
}
|
}
|
||||||
mimdec->need_newsegment = FALSE;
|
mimdec->need_newsegment = FALSE;
|
||||||
GST_OBJECT_UNLOCK (mimdec);
|
|
||||||
if (event)
|
if (event)
|
||||||
result = gst_pad_push_event (mimdec->srcpad, event);
|
result = gst_pad_push_event (mimdec->srcpad, event);
|
||||||
event = NULL;
|
event = NULL;
|
||||||
GST_OBJECT_LOCK (mimdec);
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
GST_WARNING_OBJECT (mimdec, "gst_pad_push_event failed");
|
GST_WARNING_OBJECT (mimdec, "gst_pad_push_event failed");
|
||||||
res = GST_FLOW_ERROR;
|
res = GST_FLOW_ERROR;
|
||||||
|
@ -300,15 +299,12 @@ gst_mim_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
"width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
|
"width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
|
||||||
gst_buffer_set_caps (out_buf, caps);
|
gst_buffer_set_caps (out_buf, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
GST_OBJECT_UNLOCK (mimdec);
|
|
||||||
res = gst_pad_push (mimdec->srcpad, out_buf);
|
res = gst_pad_push (mimdec->srcpad, out_buf);
|
||||||
GST_OBJECT_LOCK (mimdec);
|
|
||||||
|
|
||||||
gst_adapter_flush (mimdec->adapter, payload_size);
|
gst_adapter_flush (mimdec->adapter, payload_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
GST_OBJECT_UNLOCK (mimdec);
|
|
||||||
gst_object_unref (mimdec);
|
gst_object_unref (mimdec);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -333,9 +329,7 @@ gst_mim_dec_change_state (GstElement * element, GstStateChange transition)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
GST_OBJECT_LOCK (element);
|
|
||||||
mimdec->need_newsegment = TRUE;
|
mimdec->need_newsegment = TRUE;
|
||||||
GST_OBJECT_UNLOCK (element);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -349,13 +343,11 @@ gst_mim_dec_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
GST_OBJECT_LOCK (element);
|
|
||||||
if (mimdec->dec != NULL) {
|
if (mimdec->dec != NULL) {
|
||||||
mimic_close (mimdec->dec);
|
mimic_close (mimdec->dec);
|
||||||
mimdec->dec = NULL;
|
mimdec->dec = NULL;
|
||||||
mimdec->buffer_size = -1;
|
mimdec->buffer_size = -1;
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (element);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -392,16 +384,12 @@ gst_mim_dec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
if (rate <= 0.0)
|
if (rate <= 0.0)
|
||||||
goto newseg_wrong_rate;
|
goto newseg_wrong_rate;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (mimdec);
|
|
||||||
mimdec->need_newsegment = FALSE;
|
mimdec->need_newsegment = FALSE;
|
||||||
GST_OBJECT_UNLOCK (mimdec);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
GST_OBJECT_LOCK (mimdec);
|
|
||||||
mimdec->need_newsegment = TRUE;
|
mimdec->need_newsegment = TRUE;
|
||||||
GST_OBJECT_UNLOCK (mimdec);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -49,12 +49,8 @@ struct _GstMimDec
|
||||||
|
|
||||||
/* Protected by stream lock */
|
/* Protected by stream lock */
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
|
|
||||||
/* Protected by object lock */
|
|
||||||
MimCtx *dec;
|
MimCtx *dec;
|
||||||
|
|
||||||
gint buffer_size;
|
gint buffer_size;
|
||||||
|
|
||||||
gboolean need_newsegment;
|
gboolean need_newsegment;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue