From 5e8a2fb8a49280d8d73d4334baf4fb2af9e71a7b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 15 Jan 2004 01:35:41 +0000 Subject: [PATCH] gst/autoplug/gstspideridentity.c: break infinite loop by just returning instead of looping Original commit message from CVS: 2004-01-15 Benjamin Otte * gst/autoplug/gstspideridentity.c: (gst_spider_identity_sink_loop_type_finding): break infinite loop by just returning instead of looping * gst/gstclock.c: (gst_clock_class_init), (gst_clock_set_property): set event time difference correctly. Set it to 1 second instead of 100ms to be more tolerant * gst/gstelement.c: (gst_element_set_time): add debugging output --- ChangeLog | 11 +++++++++++ gst/autoplug/gstspideridentity.c | 4 ++-- gst/gstclock.c | 8 ++++---- gst/gstelement.c | 6 +++++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 584f5b8627..6d47cb11dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-01-15 Benjamin Otte + + * gst/autoplug/gstspideridentity.c: + (gst_spider_identity_sink_loop_type_finding): + break infinite loop by just returning instead of looping + * gst/gstclock.c: (gst_clock_class_init), (gst_clock_set_property): + set event time difference correctly. Set it to 1 second instead + of 100ms to be more tolerant + * gst/gstelement.c: (gst_element_set_time): + add debugging output + 2004-01-14 Benjamin Otte * gst/gstqueue.c: (gst_queue_getcaps), (gst_queue_link): diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index cbc5aaada7..71e5ee3520 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -467,9 +467,9 @@ gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *ident) g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident)); data = gst_pad_pull (ident->sink); - while (!GST_IS_BUFFER (data)) { + if (!GST_IS_BUFFER (data)) { gst_spider_identity_chain (ident->sink, GST_BUFFER (data)); - data = gst_pad_pull (ident->sink); + return; } find.buffer = GST_BUFFER (data); diff --git a/gst/gstclock.c b/gst/gstclock.c index 3901262113..f8dbb20ca7 100644 --- a/gst/gstclock.c +++ b/gst/gstclock.c @@ -34,7 +34,7 @@ static GstAllocTrace *_gst_clock_entry_trace; #endif -#define DEFAULT_EVENT_DIFF (GST_SECOND / 10) +#define DEFAULT_EVENT_DIFF (GST_SECOND) #define DEFAULT_MAX_DIFF (2 * GST_SECOND) enum { @@ -386,10 +386,10 @@ gst_clock_class_init (GstClockClass *klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DIFF, g_param_spec_int64 ("max-diff", "Max diff", "The maximum amount of time to wait in nanoseconds", 0, G_MAXINT64, DEFAULT_MAX_DIFF, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DIFF, + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EVENT_DIFF, g_param_spec_uint64 ("event-diff", "event diff", "The amount of time that may elapse until 2 events are treated as happening at different times", - 0, G_MAXUINT64, DEFAULT_EVENT_DIFF, G_PARAM_READWRITE)); + 0, G_MAXUINT64, DEFAULT_EVENT_DIFF, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); } static void @@ -702,7 +702,7 @@ gst_clock_set_property (GObject *object, guint prop_id, break; case ARG_EVENT_DIFF: clock->max_event_diff = g_value_get_uint64 (value); - g_object_notify (object, "max-event-diff"); + g_object_notify (object, "event-diff"); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst/gstelement.c b/gst/gstelement.c index 24f1b67465..3d059bc9ad 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -878,6 +878,8 @@ gst_element_wait (GstElement *element, GstClockTime timestamp) void gst_element_set_time (GstElement *element, GstClockTime time) { + GstClockTime event_time; + g_return_if_fail (GST_IS_ELEMENT (element)); g_return_if_fail (GST_IS_CLOCK (element->clock)); g_return_if_fail (element->current_state >= GST_STATE_PAUSED); @@ -887,7 +889,9 @@ gst_element_set_time (GstElement *element, GstClockTime time) element->base_time = time; break; case GST_STATE_PLAYING: - element->base_time = gst_clock_get_time (element->clock) - time; + event_time = gst_clock_get_event_time (element->clock); + GST_LOG_OBJECT (element, "clock time %llu: setting element time to %llu", event_time, time); + element->base_time = event_time - time; break; default: g_assert_not_reached ();