Commit 038e540a authored by Jan Schmidt's avatar Jan Schmidt

plugins/elements/gsttee.c: Always prefer an actual return value from a src pad...

plugins/elements/gsttee.c: Always prefer an actual return value from a src pad in place of NOT_LINKED. This means we ...

Original commit message from CVS:
* plugins/elements/gsttee.c: (gst_tee_do_push),
(gst_tee_handle_buffer):
Always prefer an actual return value from a src
pad in place of NOT_LINKED. This means we return
WRONG_STATE when all src pads are WRONG_STATE
instead of NOT_LINKED.

Lock when replacing the last message to prevent
racing with the get_property method.

Add debug output
parent a25bb7be
2006-01-27 Jan Schmidt <thaytan@mad.scientist.com>
* plugins/elements/gsttee.c: (gst_tee_do_push),
(gst_tee_handle_buffer):
Always prefer an actual return value from a src
pad in place of NOT_LINKED. This means we return
WRONG_STATE when all src pads are WRONG_STATE
instead of NOT_LINKED.
Lock when replacing the last message to prevent
racing with the get_property method.
Add debug output
2006-01-27 Jan Schmidt <thaytan@mad.scientist.com>
* tests/check/Makefile.am:
......
......@@ -265,24 +265,32 @@ static gboolean
gst_tee_do_push (GstPad * pad, GValue * ret, PushData * data)
{
GstFlowReturn res;
GstTee *tee = data->tee;
if (G_UNLIKELY (!data->tee->silent)) {
GstTee *tee = data->tee;
GstBuffer *buf = data->buffer;
GST_OBJECT_LOCK (tee);
g_free (tee->last_message);
tee->last_message =
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (pad),
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
GST_OBJECT_UNLOCK (tee);
g_object_notify (G_OBJECT (tee), "last_message");
}
/* Push */
res = gst_pad_push (pad, gst_buffer_ref (data->buffer));
/* If it's fatal or OK we overwrite the previous value */
if (GST_FLOW_IS_FATAL (res) || (res == GST_FLOW_OK)) {
GST_LOG_OBJECT (tee, "Pushing buffer %p to %" GST_PTR_FORMAT
" yielded result=%d", data->buffer, pad, res);
/* If it's fatal or OK, or if ret is currently
* not-linked, we overwrite the previous value */
if (GST_FLOW_IS_FATAL (res) || (res == GST_FLOW_OK) ||
(g_value_get_enum (ret) == GST_FLOW_NOT_LINKED)) {
GST_LOG_OBJECT (tee, "Replacing ret val %d with %d",
g_value_get_enum (ret), res);
g_value_set_enum (ret, res);
}
......@@ -308,10 +316,16 @@ gst_tee_handle_buffer (GstTee * tee, GstBuffer * buffer)
data.tee = tee;
data.buffer = buffer;
GST_LOG_OBJECT (tee, "Starting to push buffer %p", buffer);
/* FIXME: Not sure how tee would handle RESEND buffer from some of the
* pads but not from others. */
res = gst_iterator_fold (iter, (GstIteratorFoldFunction) gst_tee_do_push,
&ret, &data);
gst_iterator_free (iter);
GST_LOG_OBJECT (tee, "Pushing buffer %p yielded result=%d", buffer,
g_value_get_enum (&ret));
gst_buffer_unref (buffer);
/* no need to unset gvalue */
......
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