More incsched progress. Should be able to get itereration going again tomorrow.

Original commit message from CVS:
More incsched progress.  Should be able to get itereration going again
tomorrow.
This commit is contained in:
Erik Walthinsen 2001-02-18 10:00:04 +00:00
parent df32997396
commit 0871fad29b
4 changed files with 26 additions and 8 deletions

View file

@ -364,6 +364,7 @@ gst_bin_change_state (GstElement *element)
// g_return_val_if_fail(bin->numchildren != 0, GST_STATE_FAILURE); // g_return_val_if_fail(bin->numchildren != 0, GST_STATE_FAILURE);
/*
switch (GST_STATE_TRANSITION (element)) { switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY: case GST_STATE_NULL_TO_READY:
{ {
@ -379,6 +380,7 @@ gst_bin_change_state (GstElement *element)
default: default:
break; break;
} }
*/
// g_print("-->\n"); // g_print("-->\n");
children = bin->children; children = bin->children;
@ -771,6 +773,7 @@ gst_bin_create_plan_func (GstBin *bin)
gst_element_set_manager (GST_ELEMENT (bin), manager); gst_element_set_manager (GST_ELEMENT (bin), manager);
*/ */
/*
// perform the first recursive pass of plan generation // perform the first recursive pass of plan generation
// we set the manager of every element but those who manage themselves // we set the manager of every element but those who manage themselves
// the need for cothreads is also determined recursively // the need for cothreads is also determined recursively
@ -831,6 +834,7 @@ gst_bin_create_plan_func (GstBin *bin)
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin)); GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin));
return; return;
} }
*/
/* /*
// clear previous plan state // clear previous plan state
@ -882,6 +886,7 @@ gst_bin_create_plan_func (GstBin *bin)
} while (pending); } while (pending);
*/ */
/*
GST_DEBUG (0,"have %d elements to manage, implementing plan\n",bin->num_managed_elements); GST_DEBUG (0,"have %d elements to manage, implementing plan\n",bin->num_managed_elements);
gst_bin_schedule(bin); gst_bin_schedule(bin);
@ -889,6 +894,7 @@ gst_bin_create_plan_func (GstBin *bin)
GST_DEBUG (0, "gstbin \"%s\", eos providers:%d\n", GST_DEBUG (0, "gstbin \"%s\", eos providers:%d\n",
GST_ELEMENT_NAME (bin), GST_ELEMENT_NAME (bin),
bin->num_eos_providers); bin->num_eos_providers);
*/
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin)); GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin));
} }

View file

@ -197,13 +197,14 @@ gst_bin_pullregionfunc_proxy (GstPad *pad,GstRegionType type,guint64 offset,guin
static void static void
gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) { gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
GList *elements; GList *elements;
GstElement *element; GstElement *element;
cothread_func wrapper_function; cothread_func wrapper_function;
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
printf("\n");
GST_DEBUG (0,"chain is using cothreads\n"); GST_DEBUG (0,"chain is using cothreads\n");
// first create thread context // first create thread context
@ -224,7 +225,7 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if the element has a loopfunc... // if the element has a loopfunc...
if (element->loopfunc != NULL) { if (element->loopfunc != NULL) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
GST_DEBUG (0,"\nelement '%s' is a loop-based\n",GST_ELEMENT_NAME(element)); GST_DEBUG (0,"element '%s' is a loop-based\n",GST_ELEMENT_NAME(element));
} else { } else {
// otherwise we need to decide what kind of cothread // otherwise we need to decide what kind of cothread
// if it's not DECOUPLED, we decide based on whether it's a source or not // if it's not DECOUPLED, we decide based on whether it's a source or not
@ -232,10 +233,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if it doesn't have any sinks, it must be a source (duh) // if it doesn't have any sinks, it must be a source (duh)
if (element->numsinkpads == 0) { if (element->numsinkpads == 0) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper);
GST_DEBUG (0,"\nelement '%s' is a source, using _src_wrapper\n",GST_ELEMENT_NAME(element)); GST_DEBUG (0,"element '%s' is a source, using _src_wrapper\n",GST_ELEMENT_NAME(element));
} else { } else {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper);
GST_DEBUG (0,"\nelement '%s' is a filter, using _chain_wrapper\n",GST_ELEMENT_NAME(element)); GST_DEBUG (0,"element '%s' is a filter, using _chain_wrapper\n",GST_ELEMENT_NAME(element));
} }
} }
} }
@ -249,7 +250,9 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if the element is DECOUPLED or outside the manager, we have to chain // if the element is DECOUPLED or outside the manager, we have to chain
if ((wrapper_function == NULL) || if ((wrapper_function == NULL) ||
(GST_ELEMENT (GST_PAD_PARENT (GST_PAD (GST_RPAD_PEER (pad))))->manager != GST_ELEMENT(bin))) { (GST_RPAD_PEER(pad) &&
(GST_ELEMENT (GST_PAD_PARENT (GST_PAD (GST_RPAD_PEER (pad))))->manager != GST_ELEMENT(bin)))
) {
// set the chain proxies // set the chain proxies
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) { if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
@ -835,7 +838,7 @@ gst_schedule_chain_new (GstSchedule *sched)
chain->elements = NULL; chain->elements = NULL;
chain->num_elements = 0; chain->num_elements = 0;
chain->entry = NULL; chain->entry = NULL;
chain->need_cothreads = TRUE; chain->cothreaded_elements = 0;
chain->schedule = FALSE; chain->schedule = FALSE;
sched->chains = g_list_prepend (sched->chains, chain); sched->chains = g_list_prepend (sched->chains, chain);
@ -862,7 +865,9 @@ gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain", GST_ELEMENT_NAME (element)); GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain", GST_ELEMENT_NAME (element));
chain->elements = g_list_prepend (chain->elements, element); chain->elements = g_list_prepend (chain->elements, element);
chain->num_elements++; chain->num_elements++;
// FIXME need to update chain schedule here, or not // FIXME need to update chain schedule here, or not
// gst_schedule_cothreaded_chain(chain->sched->parent,chain);
} }
void void
@ -898,6 +903,7 @@ gst_schedule_chain_elements (GstSchedule *sched, GstElement *element1, GstElemen
gst_schedule_chain_add_element (chain, element1); gst_schedule_chain_add_element (chain, element1);
gst_schedule_chain_add_element (chain, element2); gst_schedule_chain_add_element (chain, element2);
// FIXME chain changed here // FIXME chain changed here
gst_schedule_cothreaded_chain(chain->sched->parent,chain);
// otherwise if both have chains already, join them // otherwise if both have chains already, join them
} else if ((chain1 != NULL) && (chain2 != NULL)) { } else if ((chain1 != NULL) && (chain2 != NULL)) {
@ -906,6 +912,7 @@ gst_schedule_chain_elements (GstSchedule *sched, GstElement *element1, GstElemen
chain1->elements = g_list_concat (chain1->elements, g_list_copy(chain2->elements)); chain1->elements = g_list_concat (chain1->elements, g_list_copy(chain2->elements));
chain1->num_elements += chain2->num_elements; chain1->num_elements += chain2->num_elements;
// FIXME chain changed here // FIXME chain changed here
gst_schedule_cothreaded_chain(chain->sched->parent,chain);
gst_schedule_chain_destroy(chain2); gst_schedule_chain_destroy(chain2);
@ -918,6 +925,7 @@ gst_schedule_chain_elements (GstSchedule *sched, GstElement *element1, GstElemen
GST_INFO (GST_CAT_SCHEDULING, "adding element to existing chain"); GST_INFO (GST_CAT_SCHEDULING, "adding element to existing chain");
gst_schedule_chain_add_element (chain, element); gst_schedule_chain_add_element (chain, element);
// FIXME chain changed here // FIXME chain changed here
gst_schedule_cothreaded_chain(chain->sched->parent,chain);
} }
} }

View file

@ -89,7 +89,7 @@ struct _GstScheduleChain {
GstElement *entry; GstElement *entry;
gboolean need_cothreads; gint cothreaded_elements;
gboolean schedule; gboolean schedule;
}; };

View file

@ -37,6 +37,7 @@ int main(int argc,char *argv[]) {
gst_element_connect(src,"src",identity,"sink"); gst_element_connect(src,"src",identity,"sink");
gst_schedule_show(GST_ELEMENT_SCHED(thread)); gst_schedule_show(GST_ELEMENT_SCHED(thread));
//return;
g_print("\nDisconnecting src from identity:\n"); g_print("\nDisconnecting src from identity:\n");
gst_element_disconnect(src,"src",identity,"sink"); gst_element_disconnect(src,"src",identity,"sink");
gst_schedule_show(GST_ELEMENT_SCHED(thread)); gst_schedule_show(GST_ELEMENT_SCHED(thread));
@ -73,7 +74,10 @@ int main(int argc,char *argv[]) {
gst_element_connect(identity,"src",identity2,"sink"); gst_element_connect(identity,"src",identity2,"sink");
gst_schedule_show(GST_ELEMENT_SCHED(thread)); gst_schedule_show(GST_ELEMENT_SCHED(thread));
g_print("\nDisconnecting identity to identity2\n"); g_print("\nDisconnecting identity from identity2\n");
gst_element_disconnect(identity,"src",identity2,"sink"); gst_element_disconnect(identity,"src",identity2,"sink");
gst_schedule_show(GST_ELEMENT_SCHED(thread)); gst_schedule_show(GST_ELEMENT_SCHED(thread));
g_print("\n\nNow setting state from NULL to READY:\n");
gst_element_set_state(GST_ELEMENT(thread),GST_STATE_READY);
} }