diff options
author | Olivier Crete <olivier.crete@collabora.co.uk> | 2008-07-04 22:02:43 +0000 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2009-03-03 14:34:06 -0500 |
commit | c57073ea3d4a25e2a0295d9e192eb609fd601000 (patch) | |
tree | 96749183f260f02d58bf1f18154828142423e0a9 /ext | |
parent | 7b80bac3ab0b3eb9f2e5a05594ef0153b26a8ad4 (diff) | |
download | gst-plugins-bad-c57073ea3d4a25e2a0295d9e192eb609fd601000.tar.gz gst-plugins-bad-c57073ea3d4a25e2a0295d9e192eb609fd601000.tar.bz2 gst-plugins-bad-c57073ea3d4a25e2a0295d9e192eb609fd601000.zip |
[MOVED FROM GST-P-FARSIGHT] Add proper locking to mimdec
20080704220243-3e2dc-71c157d82999dfb41bd62b4064b1887ab22e84c1.gz
Diffstat (limited to 'ext')
-rw-r--r-- | ext/mimic/gstmimdec.c | 9 | ||||
-rw-r--r-- | ext/mimic/gstmimdec.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/ext/mimic/gstmimdec.c b/ext/mimic/gstmimdec.c index fa70af78..eeb95621 100644 --- a/ext/mimic/gstmimdec.c +++ b/ext/mimic/gstmimdec.c @@ -164,6 +164,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in) buf = GST_BUFFER (in); gst_adapter_push (mimdec->adapter, buf); + GST_OBJECT_LOCK (mimdec); + if (!GST_CLOCK_TIME_IS_VALID (mimdec->gst_timestamp)) mimdec->gst_timestamp = GST_BUFFER_TIMESTAMP (in); @@ -245,7 +247,9 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in) event = gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0, -1, 0); + GST_OBJECT_UNLOCK (mimdec); result = gst_pad_push_event (mimdec->srcpad, event); + GST_OBJECT_LOCK (mimdec); if (!result) { GST_WARNING_OBJECT (mimdec, "gst_pad_push_event failed"); @@ -298,13 +302,16 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in) "height", G_TYPE_INT, height, NULL); gst_buffer_set_caps (out_buf, caps); gst_caps_unref (caps); + GST_OBJECT_UNLOCK (mimdec); res = gst_pad_push (mimdec->srcpad, out_buf); + GST_OBJECT_LOCK (mimdec); gst_adapter_flush (mimdec->adapter, mimdec->payload_size); mimdec->have_header = FALSE; } out: + GST_OBJECT_UNLOCK (mimdec); gst_object_unref (mimdec); return res; @@ -319,6 +326,7 @@ gst_mimdec_change_state (GstElement *element, GstStateChange transition) case GST_STATE_CHANGE_READY_TO_NULL: mimdec = GST_MIMDEC (element); if (mimdec->dec != NULL) { + GST_OBJECT_LOCK (element); mimic_close (mimdec->dec); mimdec->dec = NULL; mimdec->buffer_size = -1; @@ -327,6 +335,7 @@ gst_mimdec_change_state (GstElement *element, GstStateChange transition) mimdec->gst_timestamp = GST_CLOCK_TIME_NONE; mimdec->current_ts = -1; mimdec->last_ts = -1; + GST_OBJECT_UNLOCK (element); } break; default: diff --git a/ext/mimic/gstmimdec.h b/ext/mimic/gstmimdec.h index c9b77997..2cc4a487 100644 --- a/ext/mimic/gstmimdec.h +++ b/ext/mimic/gstmimdec.h @@ -48,8 +48,11 @@ struct _GstMimDec GstElement element; GstPad *sinkpad, *srcpad; + + /* Protected by stream lock */ GstAdapter *adapter; + /* Protected by object lock */ MimCtx *dec; gint buffer_size; |