[gst-devel] Opt scheduler modifications in recent days

Andy Wingo wingo at pobox.com
Tue Oct 7 05:05:04 CEST 2003


Hi,

The opt scheduler patches of about a week ago (on HEAD) caused some
problems. sinesrc ! int2float ! float2int ! osssink was not working
because the scheduler would recurse and call float2int's loop function
again (while it was already pulling from one of its sink pads). Thomas
suggested me to try his patch instead of Iain's, and it seems to work
for me.

I'm attaching a patch to gstoptscheduler.c against revision 1.51 of the
file. It's Thomas's patch, but applied against HEAD (the 0.6 patch has
some rejected chunks).

I'm also attaching a patch to int2float which should fix problems there,
but I can't test it at the moment. Want to give that a shot, Iain?

regards,

wingo.
-------------- next part --------------
--- ../../../../gstoptimalscheduler.c?rev=1.51	2003-10-06 16:21:39.000000000 +0200
+++ gstoptimalscheduler.c	2003-10-06 18:16:26.000000000 +0200
@@ -188,7 +188,9 @@
 /* some group operations */
 static GstOptSchedulerGroup* 	ref_group 			(GstOptSchedulerGroup *group);
 #ifndef USE_COTHREADS
+/*
 static GstOptSchedulerGroup* 	ref_group_by_count 		(GstOptSchedulerGroup *group, gint count);
+*/
 #endif
 static GstOptSchedulerGroup* 	unref_group 			(GstOptSchedulerGroup *group);
 static void 			destroy_group 			(GstOptSchedulerGroup *group);
@@ -594,6 +596,7 @@
 }
 
 #ifndef USE_COTHREADS
+/* remove me
 static GstOptSchedulerGroup*
 ref_group_by_count (GstOptSchedulerGroup *group, gint count)
 {
@@ -604,6 +607,7 @@
 
   return group;
 }
+*/
 #endif
 
 static GstOptSchedulerGroup*
@@ -911,8 +915,11 @@
       schedule_group (group);
 #else
       osched->recursion = 0;
-      ref_group (group);
-      osched->runqueue = g_list_append (osched->runqueue, group);
+      if (!g_list_find (osched->runqueue, group))
+      {
+        ref_group (group);
+        osched->runqueue = g_list_append (osched->runqueue, group);
+      }
       gst_opt_scheduler_schedule_run_queue (osched);
 #endif
 
@@ -1035,9 +1042,12 @@
 #else
   GST_PAD_BUFLIST (GST_RPAD_PEER (sinkpad)) = g_list_append (GST_PAD_BUFLIST (GST_RPAD_PEER (sinkpad)), buffer);
   if (!(group->flags & GST_OPT_SCHEDULER_GROUP_RUNNING)) {
-    ref_group (group);
     GST_LOG ("adding %p to runqueue", group);
-    osched->runqueue = g_list_append (osched->runqueue, group);
+    if (!g_list_find (osched->runqueue, group))
+    {
+      ref_group (group);
+      osched->runqueue = g_list_append (osched->runqueue, group);
+    }
   }
 #endif
   
@@ -1080,9 +1090,14 @@
     schedule_group (group);
 #else
     if (!(group->flags & GST_OPT_SCHEDULER_GROUP_RUNNING)) {
-      ref_group_by_count (group, 2);
+      ref_group (group);
+
+      if (!g_list_find (osched->runqueue, group))
+      {
+        ref_group (group);
+        osched->runqueue = g_list_append (osched->runqueue, group);
+      }
 
-      osched->runqueue = g_list_append (osched->runqueue, group);
       GST_LOG_OBJECT (osched, "recursing into scheduler group %p", group);
       gst_opt_scheduler_schedule_run_queue (osched);
       GST_LOG_OBJECT (osched, "return from recurse group %p", group);
-------------- next part --------------
--- gstint2float.c
+++ gstint2float.c
@@ -328,7 +328,7 @@
     /* we are guaranteed that if some frames are left over, they can't fill a
        whole buffer */
     data_in = (gint16*)GST_BUFFER_DATA (this->in_buffer);
-    data_in += GST_BUFFER_SIZE (this->in_buffer) - channels * to_process;
+    data_in += GST_BUFFER_SIZE (this->in_buffer) / sizeof (gint16) - channels * to_process;
     for (i=0; i<this->numsrcpads; i++) {
       for (j=0; j<to_process; j++)
         data_out[i][j] = ((gfloat)data_in[(j*channels) + (i%channels)]) / 32767.0;


More information about the gstreamer-devel mailing list