summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 968c817)
raw | patch | inline | side by side (parent: 968c817)
author | Benjamin Otte <otte@gnome.org> | |
Fri, 2 Jul 2004 03:24:08 +0000 (03:24 +0000) | ||
committer | Benjamin Otte <otte@gnome.org> | |
Fri, 2 Jul 2004 03:24:08 +0000 (03:24 +0000) |
Original commit message from CVS:
* gst/gstpad.c: (gst_pad_check_schedulers),
(gst_pad_can_link_filtered), (gst_pad_link_filtered),
(gst_pad_link_prepare):
check that pads that get linked belong to the same manager. The old
code allowed linking elements before putting them into bins, so it
worked to link them and then put them in different threads, which
lead to weird behaviour.
Since this effectively disallows linking elements before putting
them in a bin, some applications might not work after this and error
out. If these applications are too critical, we might need to revert
that patch. Please test this before the next release...
* gst/gstpad.c: (gst_pad_check_schedulers),
(gst_pad_can_link_filtered), (gst_pad_link_filtered),
(gst_pad_link_prepare):
check that pads that get linked belong to the same manager. The old
code allowed linking elements before putting them into bins, so it
worked to link them and then put them in different threads, which
lead to weird behaviour.
Since this effectively disallows linking elements before putting
them in a bin, some applications might not work after this and error
out. If these applications are too critical, we might need to revert
that patch. Please test this before the next release...
ChangeLog | patch | blob | history | |
gst/gstpad.c | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index c2908a3728d3b1dda4ba8ca0556d19e624689473..b9de3390f4d579e33c96796806f4aff362bf79c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2004-07-02 Benjamin Otte <otte@gnome.org>
+
+ * gst/gstpad.c: (gst_pad_check_schedulers),
+ (gst_pad_can_link_filtered), (gst_pad_link_filtered),
+ (gst_pad_link_prepare):
+ check that pads that get linked belong to the same manager. The old
+ code allowed linking elements before putting them into bins, so it
+ worked to link them and then put them in different threads, which
+ lead to weird behaviour.
+ Since this effectively disallows linking elements before putting
+ them in a bin, some applications might not work after this and error
+ out. If these applications are too critical, we might need to revert
+ that patch. Please test this before the next release...
+
2004-06-28 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstpad.c: (gst_pad_get_caps):
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 3d855550d7a3ddef4187b9d187b6b14f8b378c52..66bd67c83022e8083c22a3aee8b519eb8e0056cb 100644 (file)
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
src_sched = gst_pad_get_scheduler (GST_PAD (realsrc));
sink_sched = gst_pad_get_scheduler (GST_PAD (realsink));
- if (src_sched && sink_sched) {
- if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
- num_decoupled++;
- if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
- num_decoupled++;
-
- if (src_sched != sink_sched && num_decoupled != 1) {
- return FALSE;
+ if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
+ num_decoupled++;
+ if (GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
+ num_decoupled++;
+
+ if (!src_sched && !sink_sched) {
+ if (num_decoupled == 0) {
+ GstObject *src_manager, *sink_manager;
+
+ /* figure out if the managers are equal */
+ src_manager = GST_OBJECT (gst_pad_get_parent (GST_PAD (realsrc)));
+ while (!GST_FLAG_IS_SET (src_manager, GST_BIN_FLAG_MANAGER)) {
+ if (!gst_object_get_parent (src_manager))
+ break;
+ src_manager = gst_object_get_parent (src_manager);
+ }
+ sink_manager = GST_OBJECT (gst_pad_get_parent (GST_PAD (realsink)));
+ while (!GST_FLAG_IS_SET (sink_manager, GST_BIN_FLAG_MANAGER)) {
+ if (!gst_object_get_parent (sink_manager))
+ break;
+ sink_manager = gst_object_get_parent (sink_manager);
+ }
+ if (sink_manager != src_manager)
+ return FALSE;
}
+ } else {
+ if (!src_sched
+ && !GST_FLAG_IS_SET (GST_PAD_PARENT (realsrc), GST_ELEMENT_DECOUPLED))
+ return FALSE;
+ if (!sink_sched
+ && !GST_FLAG_IS_SET (GST_PAD_PARENT (realsink), GST_ELEMENT_DECOUPLED))
+ return FALSE;
+ }
+
+ if (src_sched != sink_sched && num_decoupled != 1) {
+ return FALSE;
}
+
return TRUE;
}
}
if (!gst_pad_check_schedulers (realsrc, realsink)) {
- g_warning ("linking pads with different scheds requires "
- "exactly one decoupled element (such as queue)");
+ GST_CAT_INFO (GST_CAT_CAPS, "schedulers for pads %s:%s and %s:%s weren't "
+ "equal (or didn't exist at all). Linking pads with different "
+ "schedulers requires exactly one decoupled element (such as queue)",
+ GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
return FALSE;
}
}
if (!gst_pad_check_schedulers (realsrc, realsink)) {
- g_warning ("linking pads with different scheds requires "
- "exactly one decoupled element (such as queue)");
+ g_warning ("schedulers for pads %s:%s and %s:%s weren't "
+ "equal (or didn't exist at all). Linking pads with different "
+ "schedulers requires exactly one decoupled element (such as queue)",
+ GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
return FALSE;
}
src_sched = gst_pad_get_scheduler (GST_PAD (link->srcpad));
sink_sched = gst_pad_get_scheduler (GST_PAD (link->sinkpad));
+ /* should have been checked by gst_pad_check_schedulers */
+ g_assert (src_sched == sink_sched);
+ g_assert (sink_sched != NULL);
/* now tell the scheduler */
- if (src_sched && src_sched == sink_sched) {
- gst_scheduler_pad_link (src_sched,
- GST_PAD (link->srcpad), GST_PAD (link->sinkpad));
- } else {
- GST_CAT_INFO (GST_CAT_PADS,
- "not telling link to scheduler %s:%s and %s:%s, %p %p",
- GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad),
- src_sched, sink_sched);
- }
+ gst_scheduler_pad_link (src_sched, link->srcpad, link->sinkpad);
GST_CAT_INFO (GST_CAT_PADS, "linked %s:%s and %s:%s, successful",
GST_DEBUG_PAD_NAME (link->srcpad), GST_DEBUG_PAD_NAME (link->sinkpad));
g_return_val_if_fail (GST_PAD_PARENT (realsink) != NULL, NULL);
if (!gst_pad_check_schedulers (realsrc, realsink)) {
- g_warning ("linking pads with different scheds requires "
- "exactly one decoupled element (such as queue)");
+ g_warning ("schedulers for pads %s:%s and %s:%s weren't "
+ "equal (or didn't exist at all). Linking pads with different "
+ "schedulers requires exactly one decoupled element (such as queue)",
+ GST_DEBUG_PAD_NAME (realsrc), GST_DEBUG_PAD_NAME (realsink));
return NULL;
}