summaryrefslogtreecommitdiffstats
path: root/gst/switch/gstswitch.c
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2004-02-15 18:20:15 +0000
committerJulien Moutte <julien@moutte.net>2004-02-15 18:20:15 +0000
commita179e2fe8cb1063c61fbd63999116a751da0cf17 (patch)
treeab5add9e62cf7781a9c682b473e2d2d86aab003d /gst/switch/gstswitch.c
parenta6e9759fdf776a38d996d5d7423b9c3106b9ec92 (diff)
downloadgst-plugins-bad-a179e2fe8cb1063c61fbd63999116a751da0cf17.tar.gz
gst-plugins-bad-a179e2fe8cb1063c61fbd63999116a751da0cf17.tar.bz2
gst-plugins-bad-a179e2fe8cb1063c61fbd63999116a751da0cf17.zip
gst/switch/gstswitch.c: More fixes for correct data refcounting.
Original commit message from CVS: 2004-02-15 Julien MOUTTE <julien@moutte.net> * gst/switch/gstswitch.c: (gst_switch_loop): More fixes for correct data refcounting.
Diffstat (limited to 'gst/switch/gstswitch.c')
-rw-r--r--gst/switch/gstswitch.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c
index 1b1c88a4..e57508bc 100644
--- a/gst/switch/gstswitch.c
+++ b/gst/switch/gstswitch.c
@@ -241,16 +241,18 @@ gst_switch_loop (GstElement *element)
switchpad = g_list_nth_data (gstswitch->sinkpads, gstswitch->active_sinkpad);
if (switchpad && switchpad->data) {
+ GstData *data = switchpad->data;
/* Loose our reference to that data */
gst_data_unref (switchpad->data);
+ switchpad->data = NULL;
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
"using data from active pad %p",
switchpad->sinkpad);
- if (GST_IS_EVENT (switchpad->data)) {
- GstEvent *event = GST_EVENT (switchpad->data);
+ if (GST_IS_EVENT (data)) {
+ GstEvent *event = GST_EVENT (data);
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
"handling event from active pad %p",
switchpad->sinkpad);
@@ -262,12 +264,11 @@ gst_switch_loop (GstElement *element)
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
"pushing data from active pad %p to %p",
switchpad->sinkpad, gstswitch->srcpad);
- gst_pad_push (gstswitch->srcpad, switchpad->data);
+ gst_pad_push (gstswitch->srcpad, data);
}
/* Mark this data as forwarded so that it won't get unrefed on next poll */
switchpad->forwarded = TRUE;
- switchpad->data = NULL;
}
}