gst/selector/gstinputselector.c: Add lots of debugging.

Original commit message from CVS:
* gst/selector/gstinputselector.c: (gst_selector_pad_event),
(gst_selector_pad_bufferalloc), (gst_selector_pad_chain),
(gst_input_selector_class_init),
(gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_push_pending_stop):
Add lots of debugging.
Fix time member in the newsegment event.
This commit is contained in:
Wim Taymans 2008-03-14 17:22:21 +00:00
parent 48d66c2c1f
commit 665be109b1
2 changed files with 52 additions and 12 deletions

View file

@ -1,3 +1,14 @@
2008-03-14 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/selector/gstinputselector.c: (gst_selector_pad_event),
(gst_selector_pad_bufferalloc), (gst_selector_pad_chain),
(gst_input_selector_class_init),
(gst_input_selector_set_active_pad),
(gst_input_selector_set_property),
(gst_input_selector_push_pending_stop):
Add lots of debugging.
Fix time member in the newsegment event.
2008-03-13 Wim Taymans <wim.taymans@collabora.co.uk> 2008-03-13 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/selector/gstinputselector.c: (gst_selector_pad_class_init), * gst/selector/gstinputselector.c: (gst_selector_pad_class_init),

View file

@ -331,7 +331,7 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format, gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
&start, &stop, &time); &start, &stop, &time);
GST_DEBUG_OBJECT (sel, GST_DEBUG_OBJECT (pad,
"configured NEWSEGMENT update %d, rate %lf, applied rate %lf, " "configured NEWSEGMENT update %d, rate %lf, applied rate %lf, "
"format %d, " "format %d, "
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %" "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
@ -356,12 +356,13 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
if (tags) if (tags)
tags = gst_tag_list_copy (tags); tags = gst_tag_list_copy (tags);
selpad->tags = tags; selpad->tags = tags;
GST_DEBUG_OBJECT (sel, "received tags %" GST_PTR_FORMAT, selpad->tags); GST_DEBUG_OBJECT (pad, "received tags %" GST_PTR_FORMAT, selpad->tags);
GST_OBJECT_UNLOCK (selpad); GST_OBJECT_UNLOCK (selpad);
break; break;
} }
case GST_EVENT_EOS: case GST_EVENT_EOS:
selpad->eos = TRUE; selpad->eos = TRUE;
GST_DEBUG_OBJECT (pad, "received EOS");
/* don't forward eos in select_all mode until all sink pads have eos */ /* don't forward eos in select_all mode until all sink pads have eos */
if (sel->select_all && !gst_input_selector_check_eos (GST_ELEMENT (sel))) { if (sel->select_all && !gst_input_selector_check_eos (GST_ELEMENT (sel))) {
forward = FALSE; forward = FALSE;
@ -370,9 +371,10 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
default: default:
break; break;
} }
if (forward) if (forward) {
GST_DEBUG_OBJECT (pad, "forwarding event");
res = gst_pad_push_event (sel->srcpad, event); res = gst_pad_push_event (sel->srcpad, event);
else } else
gst_event_unref (event); gst_event_unref (event);
gst_object_unref (sel); gst_object_unref (sel);
@ -408,6 +410,8 @@ gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (pad, "received alloc");
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad); active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
/* Fallback allocation for buffers from pads except the selected one */ /* Fallback allocation for buffers from pads except the selected one */
@ -476,6 +480,8 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
if (gst_input_selector_wait (sel, pad)) if (gst_input_selector_wait (sel, pad))
goto ignore; goto ignore;
GST_DEBUG_OBJECT (pad, "chain, getting active pad");
active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad); active_sinkpad = gst_input_selector_activate_sinkpad (sel, pad);
end_time = GST_BUFFER_TIMESTAMP (buf); end_time = GST_BUFFER_TIMESTAMP (buf);
@ -483,7 +489,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
duration = GST_BUFFER_DURATION (buf); duration = GST_BUFFER_DURATION (buf);
if (GST_CLOCK_TIME_IS_VALID (duration)) if (GST_CLOCK_TIME_IS_VALID (duration))
end_time += duration; end_time += duration;
GST_DEBUG_OBJECT (sel, "received end time %" GST_TIME_FORMAT, GST_DEBUG_OBJECT (pad, "received end time %" GST_TIME_FORMAT,
GST_TIME_ARGS (end_time)); GST_TIME_ARGS (end_time));
gst_segment_set_last_stop (seg, seg->format, end_time); gst_segment_set_last_stop (seg, seg->format, end_time);
} }
@ -496,6 +502,14 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
/* if we have a pending segment, push it out now */ /* if we have a pending segment, push it out now */
if (selpad->segment_pending) { if (selpad->segment_pending) {
GST_DEBUG_OBJECT (pad,
"pushing NEWSEGMENT update %d, rate %lf, applied rate %lf, "
"format %d, "
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
G_GINT64_FORMAT, FALSE, seg->rate, seg->applied_rate, seg->format,
seg->start, seg->stop, seg->time);
gst_pad_push_event (sel->srcpad, gst_event_new_new_segment_full (FALSE, gst_pad_push_event (sel->srcpad, gst_event_new_new_segment_full (FALSE,
seg->rate, seg->applied_rate, seg->format, seg->start, seg->stop, seg->rate, seg->applied_rate, seg->format, seg->start, seg->stop,
seg->time)); seg->time));
@ -504,7 +518,7 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
} }
/* forward */ /* forward */
GST_DEBUG_OBJECT (sel, "Forwarding buffer %p from pad %s:%s", buf, GST_DEBUG_OBJECT (pad, "Forwarding buffer %p from pad %s:%s", buf,
GST_DEBUG_PAD_NAME (pad)); GST_DEBUG_PAD_NAME (pad));
res = gst_pad_push (sel->srcpad, buf); res = gst_pad_push (sel->srcpad, buf);
done: done:
@ -513,8 +527,7 @@ done:
/* dropped buffers */ /* dropped buffers */
ignore: ignore:
{ {
GST_DEBUG_OBJECT (sel, "Ignoring buffer %p from pad %s:%s", GST_DEBUG_OBJECT (pad, "Ignoring buffer %p", buf);
buf, GST_DEBUG_PAD_NAME (pad));
gst_buffer_unref (buf); gst_buffer_unref (buf);
res = GST_FLOW_OK; res = GST_FLOW_OK;
goto done; goto done;
@ -672,6 +685,7 @@ gst_input_selector_class_init (GstInputSelectorClass * klass)
gstelement_class->change_state = gst_input_selector_change_state; gstelement_class->change_state = gst_input_selector_change_state;
klass->block = GST_DEBUG_FUNCPTR (gst_input_selector_block); klass->block = GST_DEBUG_FUNCPTR (gst_input_selector_block);
/* note the underscore because switch is a keyword otherwise */
klass->switch_ = GST_DEBUG_FUNCPTR (gst_input_selector_switch); klass->switch_ = GST_DEBUG_FUNCPTR (gst_input_selector_switch);
} }
@ -756,11 +770,15 @@ gst_input_selector_set_active_pad (GstInputSelector * self,
segment has been pushed before. */ segment has been pushed before. */
memcpy (&self->pending_stop_segment, &old->segment, memcpy (&self->pending_stop_segment, &old->segment,
sizeof (self->pending_stop_segment)); sizeof (self->pending_stop_segment));
GST_DEBUG_OBJECT (self, "setting stop_time to %" G_GINT64_FORMAT,
stop_time);
gst_segment_set_stop (&self->pending_stop_segment, stop_time); gst_segment_set_stop (&self->pending_stop_segment, stop_time);
self->pending_stop = TRUE; self->pending_stop = TRUE;
} }
if (new && new->active && start_time >= 0) { if (new && new->active && start_time >= 0) {
GST_DEBUG_OBJECT (self, "setting start_time to %" G_GINT64_FORMAT,
start_time);
/* schedule a new segment push */ /* schedule a new segment push */
gst_segment_set_start (&new->segment, start_time); gst_segment_set_start (&new->segment, start_time);
new->segment_pending = TRUE; new->segment_pending = TRUE;
@ -783,9 +801,15 @@ gst_input_selector_set_property (GObject * object, guint prop_id,
switch (prop_id) { switch (prop_id) {
case PROP_ACTIVE_PAD: case PROP_ACTIVE_PAD:
gst_input_selector_set_active_pad (sel, {
g_value_get_object (value), GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE); GstPad *pad;
pad = g_value_get_object (value);
gst_input_selector_set_active_pad (sel, pad,
GST_CLOCK_TIME_NONE, GST_CLOCK_TIME_NONE);
break; break;
}
case PROP_SELECT_ALL: case PROP_SELECT_ALL:
sel->select_all = g_value_get_boolean (value); sel->select_all = g_value_get_boolean (value);
break; break;
@ -1035,10 +1059,15 @@ gst_input_selector_push_pending_stop (GstInputSelector * self)
if (G_UNLIKELY (self->pending_stop)) { if (G_UNLIKELY (self->pending_stop)) {
GstSegment *seg = &self->pending_stop_segment; GstSegment *seg = &self->pending_stop_segment;
GST_DEBUG_OBJECT (self, "pushing pending stop"); GST_DEBUG_OBJECT (self,
"pushing NEWSEGMENT update %d, rate %lf, applied rate %lf, "
"format %d, "
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
G_GINT64_FORMAT, TRUE, seg->rate, seg->applied_rate, seg->format,
seg->start, seg->stop, seg->time);
event = gst_event_new_new_segment_full (TRUE, seg->rate, event = gst_event_new_new_segment_full (TRUE, seg->rate,
seg->applied_rate, seg->format, seg->start, seg->stop, seg->stop); seg->applied_rate, seg->format, seg->start, seg->stop, seg->time);
self->pending_stop = FALSE; self->pending_stop = FALSE;
} }