mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
gst/schedulers/gstoptimalscheduler.c
Original commit message from CVS: * gst/schedulers/gstoptimalscheduler.c (gst_opt_scheduler_pad_unlink): Fix bug that causes totem to crash on MPEG playback. My boolean arithmetic is a bit rusty.
This commit is contained in:
parent
7073ff35de
commit
84f49e604d
2 changed files with 259 additions and 240 deletions
|
@ -1,5 +1,9 @@
|
|||
2004-03-15 Johan Dahlin <johan@gnome.org>
|
||||
|
||||
* gst/schedulers/gstoptimalscheduler.c
|
||||
(gst_opt_scheduler_pad_unlink): Fix bug that causes totem to
|
||||
crash on MPEG playback. My boolean arithmetic is a bit rusty.
|
||||
|
||||
* tools/Makefile.am (EXTRA_DIST): Add gst-indent
|
||||
|
||||
2004-03-15 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
|
|
@ -66,7 +66,8 @@ typedef enum
|
|||
GST_OPT_SCHEDULER_STATE_ERROR,
|
||||
GST_OPT_SCHEDULER_STATE_RUNNING,
|
||||
GST_OPT_SCHEDULER_STATE_INTERRUPTED
|
||||
} GstOptSchedulerState;
|
||||
}
|
||||
GstOptSchedulerState;
|
||||
|
||||
struct _GstOptScheduler
|
||||
{
|
||||
|
@ -100,7 +101,8 @@ typedef enum
|
|||
GST_OPT_SCHEDULER_CHAIN_DIRTY = (1 << 1),
|
||||
GST_OPT_SCHEDULER_CHAIN_DISABLED = (1 << 2),
|
||||
GST_OPT_SCHEDULER_CHAIN_RUNNING = (1 << 3),
|
||||
} GstOptSchedulerChainFlags;
|
||||
}
|
||||
GstOptSchedulerChainFlags;
|
||||
|
||||
#define GST_OPT_SCHEDULER_CHAIN_DISABLE(chain) ((chain)->flags |= GST_OPT_SCHEDULER_CHAIN_DISABLED)
|
||||
#define GST_OPT_SCHEDULER_CHAIN_ENABLE(chain) ((chain)->flags &= ~GST_OPT_SCHEDULER_CHAIN_DISABLED)
|
||||
|
@ -132,13 +134,15 @@ typedef enum
|
|||
GST_OPT_SCHEDULER_GROUP_RUNNING = (1 << 4), /* this group is running */
|
||||
GST_OPT_SCHEDULER_GROUP_SCHEDULABLE = (1 << 5), /* this group is schedulable */
|
||||
GST_OPT_SCHEDULER_GROUP_VISITED = (1 << 6), /* this group is visited when finding links */
|
||||
} GstOptSchedulerGroupFlags;
|
||||
}
|
||||
GstOptSchedulerGroupFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GST_OPT_SCHEDULER_GROUP_GET = 1,
|
||||
GST_OPT_SCHEDULER_GROUP_LOOP = 2,
|
||||
} GstOptSchedulerGroupType;
|
||||
}
|
||||
GstOptSchedulerGroupType;
|
||||
|
||||
#define GST_OPT_SCHEDULER_GROUP_SET_FLAG(group,flag) ((group)->flags |= (flag))
|
||||
#define GST_OPT_SCHEDULER_GROUP_UNSET_FLAG(group,flag) ((group)->flags &= ~(flag))
|
||||
|
@ -272,7 +276,8 @@ typedef struct _GstOptSchedulerCtx GstOptSchedulerCtx;
|
|||
typedef enum
|
||||
{
|
||||
GST_OPT_SCHEDULER_CTX_DISABLED = (1 << 1), /* the element is disabled */
|
||||
} GstOptSchedulerCtxFlags;
|
||||
}
|
||||
GstOptSchedulerCtxFlags;
|
||||
|
||||
struct _GstOptSchedulerCtx
|
||||
{
|
||||
|
@ -1595,7 +1600,8 @@ typedef enum
|
|||
GST_OPT_CHAIN_TO_CHAIN,
|
||||
GST_OPT_CHAIN_TO_LOOP,
|
||||
GST_OPT_LOOP_TO_LOOP,
|
||||
} LinkType;
|
||||
}
|
||||
LinkType;
|
||||
|
||||
/*
|
||||
* Entry points for this scheduler.
|
||||
|
@ -2064,8 +2070,8 @@ group_dec_links_for_element (GstOptSchedulerGroup * group, GstElement * element)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_opt_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
||||
GstPad * sinkpad)
|
||||
gst_opt_scheduler_pad_unlink (GstScheduler * sched,
|
||||
GstPad * srcpad, GstPad * sinkpad)
|
||||
{
|
||||
GstOptScheduler *osched = GST_OPT_SCHEDULER (sched);
|
||||
GstElement *element1, *element2;
|
||||
|
@ -2133,7 +2139,6 @@ gst_opt_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
|||
else {
|
||||
gboolean still_link1, still_link2;
|
||||
GstOptSchedulerGroup *group;
|
||||
GstElement *element = NULL; /* shut up gcc */
|
||||
|
||||
/* since group1 == group2, it doesn't matter which group we take */
|
||||
group = group1;
|
||||
|
@ -2158,7 +2163,8 @@ gst_opt_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
|||
|
||||
while (group->elements)
|
||||
for (l = group->elements; l && l->data; l = l->next) {
|
||||
element = (GstElement *) l->data;
|
||||
GstElement *element = (GstElement *) l->data;
|
||||
|
||||
if (GST_ELEMENT_IS_DECOUPLED (element))
|
||||
continue;
|
||||
|
||||
|
@ -2202,28 +2208,37 @@ gst_opt_scheduler_pad_unlink (GstScheduler * sched, GstPad * srcpad,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!still_link1 && !still_link2)
|
||||
return;
|
||||
|
||||
/* now check which one of the elements we can remove from the group */
|
||||
if (still_link1) {
|
||||
element = element2;
|
||||
} else if (still_link2) {
|
||||
element = element1;
|
||||
}
|
||||
|
||||
if (!still_link1) {
|
||||
/* we only remove elements that are not the entry point of a loop based
|
||||
* group and are not decoupled */
|
||||
if (!(group->entry == element &&
|
||||
if (!(group->entry == element1 &&
|
||||
group->type == GST_OPT_SCHEDULER_GROUP_LOOP) &&
|
||||
!GST_ELEMENT_IS_DECOUPLED (element)) {
|
||||
GST_LOG ("element is separated from the group");
|
||||
!GST_ELEMENT_IS_DECOUPLED (element1)) {
|
||||
GST_LOG ("el ement1 is separated from the group");
|
||||
|
||||
/* have to decrement links to other groups from other pads */
|
||||
group_dec_links_for_element (group, element);
|
||||
remove_from_group (group, element);
|
||||
group_dec_links_for_element (group, element1);
|
||||
remove_from_group (group, element1);
|
||||
} else {
|
||||
GST_LOG ("element is decoupled or entry in loop based group");
|
||||
GST_LOG ("element1 is decoupled or entry in loop based group");
|
||||
}
|
||||
}
|
||||
|
||||
if (!still_link2) {
|
||||
/* we only remove elements that are not the entry point of a loop based
|
||||
* group and are not decoupled */
|
||||
if (!(group->entry == element2 &&
|
||||
group->type == GST_OPT_SCHEDULER_GROUP_LOOP) &&
|
||||
!GST_ELEMENT_IS_DECOUPLED (element2)) {
|
||||
GST_LOG ("element2 is separated from the group");
|
||||
|
||||
/* have to decrement links to other groups from other pads */
|
||||
group_dec_links_for_element (group, element2);
|
||||
remove_from_group (group, element2);
|
||||
} else {
|
||||
GST_LOG ("element2 is decoupled or entry in loop based group");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue