2006-11-03 Wim Taymans <wim@fluendo.com>
+ Patch by: Mark Nauwelaerts <manauw at skynet dot be>
+
+ * gst/gstpad.c: (gst_pad_init), (pre_activate),
+ (gst_pad_set_blocked_async), (gst_pad_acceptcaps_default),
+ (gst_pad_accept_caps), (handle_pad_block), (gst_pad_push_event):
+ Some small cleanups. Improve debugging.
+ * gst/gstpad.h:
+ Signal all waiting threads with a broadcast instead of just one.
+ Fixes #369942.
+
+2006-11-03 Wim Taymans <wim@fluendo.com>
+
* plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd),
(gst_fd_src_create):
Add some debugging.
pad->do_buffer_signals = 0;
pad->do_event_signals = 0;
+#if 0
+ GST_PAD_SET_FLUSHING (pad);
+#else
/* FIXME, should be set flushing initially, see #339326 */
GST_PAD_UNSET_FLUSHING (pad);
+#endif
pad->preroll_lock = g_mutex_new ();
pad->preroll_cond = g_cond_new ();
GST_DEBUG_OBJECT (pad, "setting ACTIVATE_MODE NONE, set flushing");
GST_PAD_SET_FLUSHING (pad);
/* unlock blocked pads so element can resume and stop */
- GST_PAD_BLOCK_SIGNAL (pad);
+ GST_PAD_BLOCK_BROADCAST (pad);
GST_OBJECT_UNLOCK (pad);
break;
}
pad->block_callback = callback;
pad->block_data = user_data;
- if (callback) {
- GST_PAD_BLOCK_SIGNAL (pad);
- } else {
- GST_PAD_BLOCK_SIGNAL (pad);
+ GST_PAD_BLOCK_BROADCAST (pad);
+ if (!callback) {
+ /* no callback, wait for the unblock to happen */
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "waiting for unblock");
GST_PAD_BLOCK_WAIT (pad);
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "unblocked");
gboolean result = FALSE;
allowed = gst_pad_get_caps (pad);
- if (allowed) {
- intersect = gst_caps_intersect (allowed, caps);
+ if (!allowed)
+ goto nothing_allowed;
- result = !gst_caps_is_empty (intersect);
+ intersect = gst_caps_intersect (allowed, caps);
- gst_caps_unref (allowed);
- gst_caps_unref (intersect);
- }
+ result = !gst_caps_is_empty (intersect);
+ if (!result)
+ GST_DEBUG_OBJECT (pad, "intersection gave empty caps");
+
+ gst_caps_unref (allowed);
+ gst_caps_unref (intersect);
return result;
+
+ /* ERRORS */
+nothing_allowed:
+ {
+ GST_DEBUG_OBJECT (pad, "no caps allowed on the pad");
+ return FALSE;
+ }
}
/**
if (G_LIKELY (acceptfunc)) {
/* we can call the function */
result = acceptfunc (pad, caps);
+ GST_DEBUG_OBJECT (pad, "acceptfunc returned %d", result);
} else {
/* Only null if the element explicitly unset it */
result = gst_pad_acceptcaps_default (pad, caps);
+ GST_DEBUG_OBJECT (pad, "default acceptcaps returned %d", result);
}
return result;
is_same_caps:
{
+ GST_DEBUG_OBJECT (pad, "pad had same caps");
GST_OBJECT_UNLOCK (pad);
return TRUE;
}
} else {
/* no callback, signal the thread that is doing a GCond wait
* if any. */
- GST_PAD_BLOCK_SIGNAL (pad);
+ GST_PAD_BLOCK_BROADCAST (pad);
}
/* OBJECT_LOCK could have been released when we did the callback, which
GST_OBJECT_LOCK (pad);
} else {
/* we need to signal the thread waiting on the GCond */
- GST_PAD_BLOCK_SIGNAL (pad);
+ GST_PAD_BLOCK_BROADCAST (pad);
}
gst_object_unref (pad);
* will typically unblock the STREAMING thread blocked on a pad. */
GST_LOG_OBJECT (pad, "Pad is blocked, not forwarding flush-start, "
"doing block signal.");
- GST_PAD_BLOCK_SIGNAL (pad);
+ GST_PAD_BLOCK_BROADCAST (pad);
goto flushed;
}
break;