Hi,
I'm trying to use Farsight for a project of mine (yet to have any
decisive success). Some of the (inevitable) segfaults I've experienced during
development suggest to me that there are certain bugs in Farsight.
In particular, these two patches make me see less segfaults. What do
you think about them?
Magnus
>From 7d546ebbd1427ebe250ad8bc1aee586404260e50 Mon Sep 17 00:00:00 2001
From: Magnus Henoch <[EMAIL PROTECTED]>
Date: Sat, 18 Oct 2008 12:50:28 +0200
Subject: [PATCH] Hack around unref of NULL parent
---
plugins/rtp/rtpstream.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/plugins/rtp/rtpstream.c b/plugins/rtp/rtpstream.c
index ad0617b..b509692 100644
--- a/plugins/rtp/rtpstream.c
+++ b/plugins/rtp/rtpstream.c
@@ -2047,7 +2047,9 @@ farsight_rtp_stream_unlink_source (FarsightRTPStream *self)
src_parent = (GstElement *) gst_element_get_parent (self->priv->src);
src_in_pipeline = (src_parent == self->priv->pipeline);
- gst_object_unref (src_parent);
+ /* XXX: is this correct? */
+ if (src_parent)
+ gst_object_unref (src_parent);
if (src_in_pipeline) {
/* In this case, we own the source */
--
1.6.0.2
>From 7e21ab3b2c7da109c03bdcc40cab55a00d8599e4 Mon Sep 17 00:00:00 2001
From: Magnus Henoch <[EMAIL PROTECTED]>
Date: Tue, 4 Nov 2008 08:29:27 +0000
Subject: [PATCH] Don't free gstreamer elements unless we are supposed to.
---
plugins/rtp/rtpstream.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/plugins/rtp/rtpstream.c b/plugins/rtp/rtpstream.c
index b509692..d63292c 100644
--- a/plugins/rtp/rtpstream.c
+++ b/plugins/rtp/rtpstream.c
@@ -3362,11 +3362,11 @@ build_dtmf_tone_generator (FarsightRTPStream *self)
if (!gst_element_link_pads (dtmfsrc, "src", encoder, "sink")) {
STREAM_WARNING (self, "Could not link dtmf source pad to encoder");
- goto error;
+ goto error_dont_free_elements;
}
if (!gst_element_link_pads (encoder, "src", payloader, "sink")) {
STREAM_WARNING (self, "Could not link dtmf encoder to payloader");
- goto error;
+ goto error_dont_free_elements;
}
payloader_src_pad = gst_element_get_static_pad (payloader, "src");
@@ -3381,27 +3381,26 @@ build_dtmf_tone_generator (FarsightRTPStream *self)
"generator bin");
gst_object_unref (payloader_src_pad);
gst_object_unref (bin_ghostpad);
- goto error;
+ goto error_dont_free_elements;
}
gst_object_unref (payloader_src_pad);
} else {
STREAM_WARNING (self, "Could not create DTMF tone generator ghost pad");
- goto error;
+ goto error_dont_free_elements;
}
} else {
STREAM_WARNING (self, "DTMF payloader has no 'src' pad");
- goto error;
+ goto error_dont_free_elements;
}
}
return dtmf_bin;
+
error:
/* Any error that might occur would happen before the elements
* get added to the bin, so we need to remove them one by one
*/
- if(dtmf_bin)
- gst_object_unref (dtmf_bin);
if(dtmfsrc)
gst_object_unref (dtmfsrc);
if(encoder)
@@ -3409,6 +3408,13 @@ build_dtmf_tone_generator (FarsightRTPStream *self)
if(payloader)
gst_object_unref (payloader);
+ error_dont_free_elements:
+ /* Except that some of them occur _after_ that, in which case we
+ * must not free the elements.
+ */
+ if(dtmf_bin)
+ gst_object_unref (dtmf_bin);
+
return NULL;
}
--
1.6.0.2
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Farsight-devel mailing list
Farsight-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/farsight-devel