+2005-04-28 Wim Taymans <wim@fluendo.com>
+
+ * gst/base/gstbasesink.c: (gst_basesink_base_init),
+ (gst_basesink_pad_getcaps), (gst_basesink_init),
+ (gst_basesink_do_sync):
+ * gst/gstclock.c: (gst_clock_entry_new):
+ * gst/gstevent.c: (gst_event_discont_get_value):
+ * gst/gstpipeline.c: (pipeline_bus_handler),
+ (gst_pipeline_change_state):
+ * gst/gstsystemclock.c: (gst_system_clock_id_wait_unlocked):
+ Better debugging of clocking info.
+ Allow NULL values when getting discont values.
+
2005-04-27 Wim Taymans <wim@fluendo.com>
* check/gst/gstobject.c: (START_TEST), (gst_object_suite):
if (bclass->get_times)
bclass->get_times (basesink, buffer, &start, &end);
+ GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT
+ ", end: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (end));
+
if (GST_CLOCK_TIME_IS_VALID (start)) {
/* save clock id so that we can unlock it if needed */
GST_LOCK (basesink);
#ifndef GST_DISABLE_TRACE
gst_alloc_trace_new (_gst_clock_entry_trace, entry);
#endif
- GST_CAT_DEBUG (GST_CAT_CLOCK, "created entry %p", entry);
+ GST_CAT_DEBUG (GST_CAT_CLOCK, "created entry %p, time %" GST_TIME_FORMAT,
+ entry, GST_TIME_ARGS (time));
gst_atomic_int_set (&entry->refcount, 1);
entry->clock = clock;
gint i, n;
g_return_val_if_fail (event != NULL, FALSE);
- g_return_val_if_fail (start_value != NULL, FALSE);
- g_return_val_if_fail (end_value != NULL, FALSE);
n = GST_EVENT_DISCONT_OFFSET_LEN (event);
for (i = 0; i < n; i++) {
if (GST_EVENT_DISCONT_OFFSET (event, i).format == format) {
- *start_value = GST_EVENT_DISCONT_OFFSET (event, i).start_value;
- *end_value = GST_EVENT_DISCONT_OFFSET (event, i).end_value;
+ if (start_value)
+ *start_value = GST_EVENT_DISCONT_OFFSET (event, i).start_value;
+ if (end_value)
+ *end_value = GST_EVENT_DISCONT_OFFSET (event, i).end_value;
return TRUE;
}
}
element->base_time = start_time -
pipeline->stream_time + pipeline->delay;
GST_DEBUG ("stream_time=%" GST_TIME_FORMAT ", start_time=%"
- GST_TIME_FORMAT, GST_TIME_ARGS (pipeline->stream_time),
- GST_TIME_ARGS (start_time));
+ GST_TIME_FORMAT ", base time %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (pipeline->stream_time),
+ GST_TIME_ARGS (start_time), GST_TIME_ARGS (element->base_time));
} else {
element->base_time = 0;
GST_DEBUG ("no clock, using base time of 0");
break;
case GST_STATE_PLAYING_TO_PAUSED:
if (element->clock) {
- pipeline->stream_time = gst_clock_get_time (element->clock) -
- element->base_time;
+ GstClockTime now;
+
+ now = gst_clock_get_time (element->clock);
+ pipeline->stream_time = now - element->base_time;
+ GST_DEBUG ("stream_time=%" GST_TIME_FORMAT ", now=%" GST_TIME_FORMAT
+ ", base time %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (pipeline->stream_time),
+ GST_TIME_ARGS (now), GST_TIME_ARGS (element->base_time));
}
- GST_DEBUG ("stream_time=%" GST_TIME_FORMAT,
- GST_TIME_ARGS (pipeline->stream_time));
break;
case GST_STATE_PAUSED_TO_READY:
break;
static GstClockReturn
gst_system_clock_id_wait_unlocked (GstClock * clock, GstClockEntry * entry)
{
- GstClockTime real, current, target;
+ GstClockTime entryt, real, now, target;
GstClockTimeDiff diff;
/* need to call the overridden method */
real = GST_CLOCK_GET_CLASS (clock)->get_internal_time (clock);
- target = GST_CLOCK_ENTRY_TIME (entry);
+ entryt = GST_CLOCK_ENTRY_TIME (entry);
- current = gst_clock_adjust_unlocked (clock, real);
- diff = target - current;
+ now = gst_clock_adjust_unlocked (clock, real);
+ diff = entryt - now;
target = gst_system_clock_get_internal_time (clock) + diff;
GST_CAT_DEBUG (GST_CAT_CLOCK, "entry %p"
" target %" GST_TIME_FORMAT
+ " entry %" GST_TIME_FORMAT
" now %" GST_TIME_FORMAT
" real %" GST_TIME_FORMAT
" diff %" G_GINT64_FORMAT,
entry,
GST_TIME_ARGS (target),
- GST_TIME_ARGS (current), GST_TIME_ARGS (real), diff);
+ GST_TIME_ARGS (entryt), GST_TIME_ARGS (now), GST_TIME_ARGS (real), diff);
if (diff > 0) {
GTimeVal tv;
if (bclass->get_times)
bclass->get_times (basesink, buffer, &start, &end);
+ GST_DEBUG_OBJECT (basesink, "got times start: %" GST_TIME_FORMAT
+ ", end: %" GST_TIME_FORMAT, GST_TIME_ARGS (start), GST_TIME_ARGS (end));
+
if (GST_CLOCK_TIME_IS_VALID (start)) {
/* save clock id so that we can unlock it if needed */
GST_LOCK (basesink);