+2004-07-08 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
+
+ * gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
+ extra debugging
+ * gst/gstevent.h:
+ * gst/gstinfo.c: (gst_debug_log_default):
+ print time nicely. add thread pointer until someone figures out
+ a completely portable way of getting at thread id's.
+ * gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
+ (_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
+ (gst_pad_call_chain_function):
+ extra debugging
+ * gst/schedulers/gstoptimalscheduler.c:
+ (get_group_schedule_function), (loop_group_schedule_function),
+ (gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
+ (pad_clear_queued), (gst_opt_scheduler_iterate):
+ rename BUFPEN and friends to DATAPEN since that's what they are.
+
2004-07-07 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
ident = GST_SPIDER_IDENTITY (gst_pad_get_parent (pad));
if (GST_IS_EVENT (buf)) {
+ GST_DEBUG_OBJECT (ident, "spider identity received event %p", buf);
/* start hack for current event stuff here */
/* check for unlinked elements and send them the EOS event, too */
if (GST_EVENT_TYPE (GST_EVENT (buf)) == GST_EVENT_EOS) {
list = g_list_next (list);
if (conn->current != (GstElement *) conn->src) {
- GST_DEBUG ("sending EOS to unconnected element %s from %s",
- GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident));
- gst_pad_push (conn->src->src,
- GST_DATA (GST_BUFFER (gst_event_new (GST_EVENT_EOS))));
+ GstEvent *event;
+
+ event = gst_event_new (GST_EVENT_EOS);
+ GST_DEBUG_OBJECT (ident,
+ "sending EOS event %p to unconnected element %s from %s",
+ event, GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident));
+ gst_pad_push (conn->src->src, GST_DATA (event));
gst_element_set_eos (GST_ELEMENT (conn->src));
}
}
}
/* end hack for current event stuff here */
+ GST_DEBUG_OBJECT (ident,
+ "calling default handler for event %p on pad %s:%s",
+ buf, GST_DEBUG_PAD_NAME (pad));
gst_pad_event_default (pad, GST_EVENT (buf));
return;
GST_EVENT_TS_OFFSET = 13,
GST_EVENT_INTERRUPT = 14,
GST_EVENT_NAVIGATION = 15,
- GST_EVENT_TAG = 16
+ GST_EVENT_TAG = 16
} GstEventType;
#define GST_EVENT_ANY GST_EVENT_NAVIGATION
obj = object ? gst_debug_print_object (object) : g_strdup ("");
g_get_current_time (&now);
- g_printerr ("%s (%10ld:%06ld) %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
- gst_debug_level_get_name (level),
- now.tv_sec, now.tv_usec,
- color, gst_debug_category_get_name (category), clear,
- pidcolor, pid, clear,
+ g_printerr ("%s (%p - %" GST_TIME_FORMAT
+ ") %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
+ gst_debug_level_get_name (level), g_thread_self (),
+ GST_TIME_ARGS (GST_TIMEVAL_TO_TIME (now)), color,
+ gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
color, file, line, function, obj, clear, gst_debug_message_get (message));
g_free (color);
GST_DEBUG_CATEGORY_STATIC (debug_dataflow);
#define DEBUG_DATA(obj,data,notice) G_STMT_START{\
if (GST_IS_EVENT (data)) { \
- GST_CAT_DEBUG_OBJECT (debug_dataflow, obj, "%s event %p (type %d)", notice, data, \
- GST_EVENT_TYPE (data)); \
+ GST_CAT_DEBUG_OBJECT (debug_dataflow, obj, "%s event %p (type %d, refcount %d)", notice, data, \
+ GST_EVENT_TYPE (data), GST_DATA_REFCOUNT_VALUE (data)); \
} else { \
GST_CAT_LOG_OBJECT (debug_dataflow, obj, "%s buffer %p (size %u, refcount %d)", notice, data, \
GST_BUFFER_SIZE (data), GST_BUFFER_REFCOUNT_VALUE (data)); \
if (link) {
if (link->temp_store) {
GST_CAT_INFO (GST_CAT_PADS,
- "deleting cached buffer from bufpen of pad %s:%s",
+ "deleting cached data %p from bufpen of pad %s:%s", link->temp_store,
GST_DEBUG_PAD_NAME (realpad));
gst_data_unref (link->temp_store);
link->temp_store = NULL;
if (oldlink) {
GST_DEBUG ("copying stuff from oldlink");
link->temp_store = oldlink->temp_store;
+ GST_DEBUG ("moving old data temp store %p", link->temp_store);
link->engaged = oldlink->engaged;
oldlink->temp_store = NULL;
gst_pad_link_free (oldlink);
event = gst_event_new_discontinuous (TRUE,
GST_FORMAT_TIME, timestamp, event_type, offset, GST_FORMAT_UNDEFINED);
GST_CAT_WARNING (GST_CAT_SCHEDULING,
- "needed to invent a DISCONT (time %" G_GUINT64_FORMAT
- ") for %s:%s => %s:%s", timestamp,
+ "needed to invent a DISCONT %p (time %" G_GUINT64_FORMAT
+ ") for %s:%s => %s:%s", event, timestamp,
GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad));
} else {
event = gst_event_new_discontinuous (TRUE,
event_type, offset, GST_FORMAT_UNDEFINED);
GST_CAT_WARNING (GST_CAT_SCHEDULING,
- "needed to invent a DISCONT (no time) for %s:%s => %s:%s",
+ "needed to invent a DISCONT %p (no time) for %s:%s => %s:%s", event,
GST_DEBUG_PAD_NAME (GST_PAD_PEER (pad)), GST_DEBUG_PAD_NAME (pad));
}
if (link->temp_store) {
g_assert (link->engaged);
+ GST_DEBUG ("moving temp_store %p to data", link->temp_store);
data = link->temp_store;
link->temp_store = NULL;
} else {
if (!link->engaged) {
g_assert (link->temp_store == NULL);
if (GST_IS_BUFFER (data)) {
+ GST_DEBUG ("moving data buffer %p back to temp_store", data);
link->temp_store = data;
link->engaged = TRUE;
data = _invent_event (pad, GST_BUFFER (data));
GST_EVENT_DISCONT_NEW_MEDIA (data)) {
link->engaged = TRUE;
GST_CAT_LOG (GST_CAT_SCHEDULING,
- "link engaged by discont event for pad %s:%s",
+ "link engaged by discont event %p for pad %s:%s", data,
GST_DEBUG_PAD_NAME (pad));
}
}
+ GST_DEBUG ("calling gst_probe_dispatcher_dispatch on data %p", data);
if (!gst_probe_dispatcher_dispatch (&peer->probedisp, &data))
goto restart;
DEBUG_DATA (pad, data, "gst_pad_pull returned");
/* for all of the internally-linked pads that are actually linked */
if (GST_PAD_IS_LINKED (eventpad)) {
if (GST_PAD_DIRECTION (eventpad) == GST_PAD_SRC) {
- /* increase the refcount */
+ /* for each pad we send to, we should ref the event; it's up
+ * to downstream to unref again when handled. */
+ GST_LOG_OBJECT (pad, "Reffing and sending event %p to %s:%s", event,
+ GST_DEBUG_PAD_NAME (eventpad));
gst_event_ref (event);
gst_pad_push (eventpad, GST_DATA (event));
} else {
GstPad *peerpad = GST_PAD (GST_RPAD_PEER (eventpad));
- /* we only send the event on one pad, multi-sinkpad elements
+ /* we only send the event on one pad, multi-sinkpad elements
* should implement a handler */
g_list_free (orig);
+ GST_LOG_OBJECT (pad, "sending event %p to one sink pad %s:%s", event,
+ GST_DEBUG_PAD_NAME (eventpad));
return gst_pad_send_event (peerpad, event);
}
}
}
+ /* we handled the incoming event so we unref once */
+ GST_LOG_OBJECT (pad, "handled event %p, unreffing", event);
gst_event_unref (event);
g_list_free (orig);
return (GST_PAD_DIRECTION (pad) == GST_PAD_SINK);
if (!link->engaged) {
g_assert (link->temp_store == NULL);
if (GST_IS_BUFFER (data)) {
+ GST_DEBUG ("moving data buffer %p back to temp_store", data);
link->temp_store = data;
link->engaged = TRUE;
CALL_CHAINFUNC (pad, _invent_event (pad, GST_BUFFER (data)));
GST_EVENT_DISCONT_NEW_MEDIA (data)) {
link->engaged = TRUE;
GST_CAT_LOG (GST_CAT_SCHEDULING,
- "link engaged by discont event for pad %s:%s",
+ "link engaged by discont event %p for pad %s:%s", data,
GST_DEBUG_PAD_NAME (pad));
}
}
#define GST_ELEMENT_SCHED_CONTEXT(elem) ((GstOptSchedulerCtx*) (GST_ELEMENT (elem)->sched_private))
#define GST_ELEMENT_SCHED_GROUP(elem) (GST_ELEMENT_SCHED_CONTEXT (elem)->group)
/* need this first macro to not run into lvalue casts */
-#define GST_PAD_BUFPEN(pad) (GST_REAL_PAD(pad)->sched_private)
-#define GST_PAD_BUFLIST(pad) ((GList*) GST_PAD_BUFPEN(pad))
+#define GST_PAD_DATAPEN(pad) (GST_REAL_PAD(pad)->sched_private)
+#define GST_PAD_DATALIST(pad) ((GList*) GST_PAD_DATAPEN(pad))
#define GST_ELEMENT_COTHREAD_STOPPING GST_ELEMENT_SCHEDULER_PRIVATE1
#define GST_ELEMENT_IS_COTHREAD_STOPPING(element) GST_FLAG_IS_SET((element), GST_ELEMENT_COTHREAD_STOPPING)
}
/* sorts the group list so that terminal sinks come first -- prevents pileup of
- * buffers in bufpens */
+ * datas in datapens */
static void
sort_chain (GstOptSchedulerChain * chain)
{
data = gst_pad_call_get_function (pad);
if (data) {
if (GST_EVENT_IS_INTERRUPT (data)) {
+ GST_DEBUG ("unreffing interrupt event %p", data);
gst_event_unref (GST_EVENT (data));
break;
}
else
group_error_handler (group);
- GST_LOG ("loopfunc ended of element %s in group %p",
+ GST_LOG ("returned from loopfunc of element %s in group %p",
GST_ELEMENT_NAME (entry), group);
group->flags &= ~GST_OPT_SCHEDULER_GROUP_RUNNING;
/* this function is called when the first element of a chain-loop or a loop-loop
* link performs a push to the loop element. We then schedule the
- * group with the loop-based element until the bufpen is empty */
+ * group with the loop-based element until the datapen is empty */
static void
gst_opt_scheduler_loop_wrapper (GstPad * sinkpad, GstData * data)
{
GST_LOG ("chain handler for loop-based pad %" GST_PTR_FORMAT, sinkpad);
#ifdef USE_COTHREADS
- if (GST_PAD_BUFLIST (peer)) {
+ if (GST_PAD_DATALIST (peer)) {
g_warning ("deadlock detected, disabling group %p", group);
group_error_handler (group);
} else {
- GST_LOG ("queueing data %p on %s:%s's bufpen", data,
+ GST_LOG ("queueing data %p on %s:%s's datapen", data,
GST_DEBUG_PAD_NAME (peer));
- GST_PAD_BUFPEN (peer) = g_list_append (GST_PAD_BUFLIST (peer), data);
+ GST_PAD_DATAPEN (peer) = g_list_append (GST_PAD_DATALIST (peer), data);
schedule_group (group);
}
#else
- GST_LOG ("queueing data %p on %s:%s's bufpen", data,
+ GST_LOG ("queueing data %p on %s:%s's datapen", data,
GST_DEBUG_PAD_NAME (peer));
- GST_PAD_BUFPEN (peer) = g_list_append (GST_PAD_BUFLIST (peer), data);
+ GST_PAD_DATAPEN (peer) = g_list_append (GST_PAD_DATALIST (peer), data);
if (!(group->flags & GST_OPT_SCHEDULER_GROUP_RUNNING)) {
GST_LOG ("adding group %p to runqueue", group);
if (!g_list_find (osched->runqueue, group)) {
}
#endif
- GST_LOG ("%d buffers left on %s:%s's bufpen after chain handler",
- g_list_length (GST_PAD_BUFLIST (peer)), GST_DEBUG_PAD_NAME (peer));
+ GST_LOG ("%d datas left on %s:%s's datapen after chain handler",
+ g_list_length (GST_PAD_DATALIST (peer)), GST_DEBUG_PAD_NAME (peer));
}
/* this function is called by a loop based element that performs a
- * pull on a sinkpad. We schedule the peer group until the bufpen
- * is filled with the buffer so that this function can return */
+ * pull on a sinkpad. We schedule the peer group until the datapen
+ * is filled with the data so that this function can return */
static GstData *
gst_opt_scheduler_get_wrapper (GstPad * srcpad)
{
GST_LOG ("get handler for %" GST_PTR_FORMAT, srcpad);
- /* first try to grab a queued buffer */
- if (GST_PAD_BUFLIST (srcpad)) {
- data = GST_PAD_BUFLIST (srcpad)->data;
- GST_PAD_BUFPEN (srcpad) = g_list_remove (GST_PAD_BUFLIST (srcpad), data);
+ /* first try to grab a queued data */
+ if (GST_PAD_DATALIST (srcpad)) {
+ data = GST_PAD_DATALIST (srcpad)->data;
+ GST_PAD_DATAPEN (srcpad) = g_list_remove (GST_PAD_DATALIST (srcpad), data);
GST_LOG ("returning popped queued data %p", data);
disabled = FALSE;
do {
- GST_LOG ("scheduling upstream group %p to fill bufpen", group);
+ GST_LOG ("scheduling upstream group %p to fill datapen", group);
#ifdef USE_COTHREADS
schedule_group (group);
#else
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
#endif
- /* if the scheduler interrupted, make sure we send an INTERRUPTED event to the
- * loop based element */
+ /* if the scheduler interrupted, make sure we send an INTERRUPTED event
+ * to the loop based element */
if (osched->state == GST_OPT_SCHEDULER_STATE_INTERRUPTED) {
GST_INFO ("scheduler interrupted, return interrupt event");
data = GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
} else {
- if (GST_PAD_BUFLIST (srcpad)) {
- data = GST_PAD_BUFLIST (srcpad)->data;
- GST_PAD_BUFPEN (srcpad) =
- g_list_remove (GST_PAD_BUFLIST (srcpad), data);
+ if (GST_PAD_DATALIST (srcpad)) {
+ data = GST_PAD_DATALIST (srcpad)->data;
+ GST_PAD_DATAPEN (srcpad) =
+ g_list_remove (GST_PAD_DATALIST (srcpad), data);
} else if (disabled) {
- /* no buffer in queue and peer group was disabled */
+ /* no data in queue and peer group was disabled */
data = GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
}
while (data == NULL);
GST_LOG ("get handler, returning data %p, queue length %d",
- data, g_list_length (GST_PAD_BUFLIST (srcpad)));
+ data, g_list_length (GST_PAD_DATALIST (srcpad)));
return data;
}
static void
pad_clear_queued (GstPad * srcpad, gpointer user_data)
{
- GList *buflist = GST_PAD_BUFLIST (srcpad);
+ GList *datalist = GST_PAD_DATALIST (srcpad);
- if (buflist) {
- GST_LOG ("need to clear some buffers");
- g_list_foreach (buflist, (GFunc) gst_data_unref, NULL);
- g_list_free (buflist);
- GST_PAD_BUFPEN (srcpad) = NULL;
+ if (datalist) {
+ GST_LOG ("need to clear some datas");
+ g_list_foreach (datalist, (GFunc) gst_data_unref, NULL);
+ g_list_free (datalist);
+ GST_PAD_DATAPEN (srcpad) = NULL;
}
}
GST_LOG ("scheduling chain %p", chain);
schedule_chain (chain);
scheduled = TRUE;
+ GST_LOG ("scheduled chain %p", chain);
} else {
GST_LOG ("not scheduling disabled chain %p", chain);
}