Commit aabe6fe0 authored by Wim Taymans's avatar Wim Taymans

gst/elements/: Protect last_message with lock.

Original commit message from CVS:
* gst/elements/gstfakesink.c: (gst_fake_sink_get_property),
(gst_fake_sink_event), (gst_fake_sink_preroll),
(gst_fake_sink_render), (gst_fake_sink_change_state):
* gst/elements/gstfakesrc.c: (gst_fake_src_event_handler),
(gst_fake_src_get_property), (gst_fake_src_create),
(gst_fake_src_stop):
* gst/elements/gstidentity.c: (gst_identity_stop):
Protect last_message with lock.
parent c07a5da2
2005-10-04 Wim Taymans <wim@fluendo.com>
* gst/elements/gstfakesink.c: (gst_fake_sink_get_property),
(gst_fake_sink_event), (gst_fake_sink_preroll),
(gst_fake_sink_render), (gst_fake_sink_change_state):
* gst/elements/gstfakesrc.c: (gst_fake_src_event_handler),
(gst_fake_src_get_property), (gst_fake_src_create),
(gst_fake_src_stop):
* gst/elements/gstidentity.c: (gst_identity_stop):
Protect last_message with lock.
2005-10-04 Edward Hervey <edward@fluendo.com>
* gst/gstformat.h:
......
......@@ -274,7 +274,9 @@ gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_boolean (value, sink->signal_handoffs);
break;
case PROP_LAST_MESSAGE:
GST_LOCK (sink);
g_value_set_string (value, sink->last_message);
GST_UNLOCK (sink);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_push);
......@@ -297,6 +299,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
if (!sink->silent) {
gchar *sstr;
GST_LOCK (sink);
g_free (sink->last_message);
if ((s = gst_event_get_structure (event)))
......@@ -308,6 +311,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
g_strdup_printf ("event ******* E (type: %d, %s) %p",
GST_EVENT_TYPE (event), sstr, event);
g_free (sstr);
GST_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
......@@ -321,9 +325,11 @@ gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
GstFakeSink *sink = GST_FAKE_SINK (bsink);
if (!sink->silent) {
GST_LOCK (sink);
g_free (sink->last_message);
sink->last_message = g_strdup_printf ("preroll ******* ");
GST_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
......@@ -336,6 +342,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GstFakeSink *sink = GST_FAKE_SINK (bsink);
if (!sink->silent) {
GST_LOCK (sink);
g_free (sink->last_message);
sink->last_message =
......@@ -346,6 +353,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT (buf)->flags, buf);
GST_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
......@@ -397,8 +405,10 @@ gst_fake_sink_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_NULL:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
goto error;
GST_LOCK (fakesink);
g_free (fakesink->last_message);
fakesink->last_message = NULL;
GST_UNLOCK (fakesink);
break;
default:
break;
......
......@@ -351,11 +351,13 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event)
src = GST_FAKE_SRC (basesrc);
if (!src->silent) {
GST_LOCK (src);
g_free (src->last_message);
src->last_message =
g_strdup_printf ("event ******* E (type: %d) %p",
GST_EVENT_TYPE (event), event);
GST_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
......@@ -506,7 +508,9 @@ gst_fake_src_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_boolean (value, src->dump);
break;
case PROP_LAST_MESSAGE:
GST_LOCK (src);
g_value_set_string (value, src->last_message);
GST_UNLOCK (src);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SRC (src)->can_activate_push);
......@@ -693,6 +697,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
GST_BUFFER_TIMESTAMP (buf) = time;
if (!src->silent) {
GST_LOCK (src);
g_free (src->last_message);
src->last_message =
......@@ -703,6 +708,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT (buf)->flags, buf);
GST_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
......@@ -741,12 +747,14 @@ gst_fake_src_stop (GstBaseSrc * basesrc)
src = GST_FAKE_SRC (basesrc);
GST_LOCK (src);
if (src->parent) {
gst_buffer_unref (src->parent);
src->parent = NULL;
}
g_free (src->last_message);
src->last_message = NULL;
GST_UNLOCK (src);
return TRUE;
}
......
......@@ -497,8 +497,10 @@ gst_identity_stop (GstBaseTransform * trans)
identity = GST_IDENTITY (trans);
GST_LOCK (identity);
g_free (identity->last_message);
identity->last_message = NULL;
GST_UNLOCK (identity);
return TRUE;
}
......@@ -274,6 +274,7 @@ gst_tee_do_push (GstPad * pad, GValue * ret, PushData * data)
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
g_value_set_enum (ret, res);
gst_object_unref (pad);
return (res == GST_FLOW_OK);
......
......@@ -274,7 +274,9 @@ gst_fake_sink_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_boolean (value, sink->signal_handoffs);
break;
case PROP_LAST_MESSAGE:
GST_LOCK (sink);
g_value_set_string (value, sink->last_message);
GST_UNLOCK (sink);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SINK (sink)->can_activate_push);
......@@ -297,6 +299,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
if (!sink->silent) {
gchar *sstr;
GST_LOCK (sink);
g_free (sink->last_message);
if ((s = gst_event_get_structure (event)))
......@@ -308,6 +311,7 @@ gst_fake_sink_event (GstBaseSink * bsink, GstEvent * event)
g_strdup_printf ("event ******* E (type: %d, %s) %p",
GST_EVENT_TYPE (event), sstr, event);
g_free (sstr);
GST_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
......@@ -321,9 +325,11 @@ gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer)
GstFakeSink *sink = GST_FAKE_SINK (bsink);
if (!sink->silent) {
GST_LOCK (sink);
g_free (sink->last_message);
sink->last_message = g_strdup_printf ("preroll ******* ");
GST_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
......@@ -336,6 +342,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GstFakeSink *sink = GST_FAKE_SINK (bsink);
if (!sink->silent) {
GST_LOCK (sink);
g_free (sink->last_message);
sink->last_message =
......@@ -346,6 +353,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT (buf)->flags, buf);
GST_UNLOCK (sink);
g_object_notify (G_OBJECT (sink), "last_message");
}
......@@ -397,8 +405,10 @@ gst_fake_sink_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_READY_TO_NULL:
if (fakesink->state_error == FAKE_SINK_STATE_ERROR_READY_NULL)
goto error;
GST_LOCK (fakesink);
g_free (fakesink->last_message);
fakesink->last_message = NULL;
GST_UNLOCK (fakesink);
break;
default:
break;
......
......@@ -351,11 +351,13 @@ gst_fake_src_event_handler (GstBaseSrc * basesrc, GstEvent * event)
src = GST_FAKE_SRC (basesrc);
if (!src->silent) {
GST_LOCK (src);
g_free (src->last_message);
src->last_message =
g_strdup_printf ("event ******* E (type: %d) %p",
GST_EVENT_TYPE (event), event);
GST_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
......@@ -506,7 +508,9 @@ gst_fake_src_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_boolean (value, src->dump);
break;
case PROP_LAST_MESSAGE:
GST_LOCK (src);
g_value_set_string (value, src->last_message);
GST_UNLOCK (src);
break;
case PROP_CAN_ACTIVATE_PUSH:
g_value_set_boolean (value, GST_BASE_SRC (src)->can_activate_push);
......@@ -693,6 +697,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
GST_BUFFER_TIMESTAMP (buf) = time;
if (!src->silent) {
GST_LOCK (src);
g_free (src->last_message);
src->last_message =
......@@ -703,6 +708,7 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_OFFSET (buf),
GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT (buf)->flags, buf);
GST_UNLOCK (src);
g_object_notify (G_OBJECT (src), "last_message");
}
......@@ -741,12 +747,14 @@ gst_fake_src_stop (GstBaseSrc * basesrc)
src = GST_FAKE_SRC (basesrc);
GST_LOCK (src);
if (src->parent) {
gst_buffer_unref (src->parent);
src->parent = NULL;
}
g_free (src->last_message);
src->last_message = NULL;
GST_UNLOCK (src);
return TRUE;
}
......
......@@ -497,8 +497,10 @@ gst_identity_stop (GstBaseTransform * trans)
identity = GST_IDENTITY (trans);
GST_LOCK (identity);
g_free (identity->last_message);
identity->last_message = NULL;
GST_UNLOCK (identity);
return TRUE;
}
......@@ -274,6 +274,7 @@ gst_tee_do_push (GstPad * pad, GValue * ret, PushData * data)
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
g_value_set_enum (ret, res);
gst_object_unref (pad);
return (res == GST_FLOW_OK);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment