From: Wim T. <wt...@us...> - 2003-02-03 23:13:50
|
CVS Root: /cvsroot/gstreamer Module: gstreamer Changes by: wtay Date: Mon Feb 03 2003 15:13:49 PST Log message: Only inform scheduler when the element changes scheduling stategy. Modified files: gst : gstelement.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstelement.c.diff?r1=1.187&r2=1.188 ====Begin Diffs==== Index: gstelement.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/gstelement.c,v retrieving revision 1.187 retrieving revision 1.188 diff -u -d -r1.187 -r1.188 --- gstelement.c 2 Feb 2003 19:49:28 -0000 1.187 +++ gstelement.c 3 Feb 2003 23:13:36 -0000 1.188 @@ -2638,16 +2638,28 @@ gst_element_set_loop_function (GstElement *element, GstElementLoopFunction loop) { + gboolean need_notify = FALSE; + g_return_if_fail (GST_IS_ELEMENT (element)); + /* if the element changed from loop based to chain/get based + * or vice versa, we need to inform the scheduler about that */ + if ((element->loopfunc == NULL && loop != NULL) || + (element->loopfunc != NULL && loop == NULL)) + { + need_notify = TRUE; + } + /* set the loop function */ element->loopfunc = loop; - /* set the NEW_LOOPFUNC flag so everyone knows to go try again */ - GST_FLAG_SET (element, GST_ELEMENT_NEW_LOOPFUNC); + if (need_notify) { + /* set the NEW_LOOPFUNC flag so everyone knows to go try again */ + GST_FLAG_SET (element, GST_ELEMENT_NEW_LOOPFUNC); - if (GST_ELEMENT_SCHED (element)) { - gst_scheduler_scheduling_change (GST_ELEMENT_SCHED (element), element); + if (GST_ELEMENT_SCHED (element)) { + gst_scheduler_scheduling_change (GST_ELEMENT_SCHED (element), element); + } } } |