From 631c5a95de1fde091cd2b4a1e8969a7c7860e5cd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 22 Mar 2007 11:19:32 +0000 Subject: [PATCH] libs/gst/base/gstbasesrc.c: Handle errors from the clock sync better, only UNSCHEDULED indicates a Original commit message from CVS: * libs/gst/base/gstbasesrc.c: (gst_base_src_get_range): Handle errors from the clock sync better, only UNSCHEDULED indicates a WRONG_STATE and can silently pause the task. All other cases should error out. --- ChangeLog | 7 +++++++ libs/gst/base/gstbasesrc.c | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75c9e832cf..65f0038f2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-22 Wim Taymans + + * libs/gst/base/gstbasesrc.c: (gst_base_src_get_range): + Handle errors from the clock sync better, only UNSCHEDULED indicates a + WRONG_STATE and can silently pause the task. All other cases should + error out. + 2007-03-22 Wim Taymans Patch by: diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index cbb0d073ff..e5fb626c9f 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -1400,21 +1400,33 @@ gst_base_src_get_range (GstBaseSrc * src, guint64 offset, guint length, status = gst_base_src_do_sync (src, *buf); switch (status) { case GST_CLOCK_EARLY: + /* the buffer is too late. We currently don't drop the buffer. */ GST_DEBUG_OBJECT (src, "buffer too late!, returning anyway"); break; case GST_CLOCK_OK: + /* buffer synchronised properly */ GST_DEBUG_OBJECT (src, "buffer ok"); break; - default: + case GST_CLOCK_UNSCHEDULED: /* this case is triggered when we were waiting for the clock and * it got unlocked because we did a state change. We return * WRONG_STATE in this case to stop the dataflow also get rid of the * produced buffer. */ - GST_DEBUG_OBJECT (src, "clock returned %d, not returning", status); + GST_DEBUG_OBJECT (src, + "clock was unscheduled (%d), returning WRONG_STATE", status); gst_buffer_unref (*buf); *buf = NULL; ret = GST_FLOW_WRONG_STATE; break; + default: + /* all other result values are unexpected and errors */ + GST_ELEMENT_ERROR (src, CORE, CLOCK, + (_("Internal clock error.")), + ("clock returned unexpected return value %d", status)); + gst_buffer_unref (*buf); + *buf = NULL; + ret = GST_FLOW_ERROR; + break; } done: return ret;