[farsight2/master] Only create the outside pad emit the pad blocking signal if there is a codec/codecbin

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:20:18 PST 2008


---
 gst/fsrtpconference/fs-rtp-stream.c |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 75d90e4..7041dea 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -538,25 +538,33 @@ fs_rtp_stream_add_substream (FsRtpStream *stream,
     FsRtpSubStream *substream,
     GError **error)
 {
-  GstPad *ghostpad;
-  FsCodec *codec;
-
-  ghostpad = fs_rtp_sub_stream_get_output_ghostpad (substream, error);
-
-  if (!ghostpad)
-    return FALSE;
-
-  g_object_get (substream, "codec", &codec, NULL);
+  FsCodec *codec = NULL;
 
   FS_RTP_SESSION_LOCK (stream->priv->session);
   stream->priv->substreams = g_list_prepend (stream->priv->substreams,
       substream);
   FS_RTP_SESSION_UNLOCK (stream->priv->session);
 
-  g_signal_emit_by_name (stream, "src-pad-added", ghostpad, codec);
+  g_object_get (substream, "codec", &codec, NULL);
+
+  /* Only let a pad out if it has a codec attached to it */
+  if (codec)
+  {
+    GstPad *ghostpad;
+
+    ghostpad = fs_rtp_sub_stream_get_output_ghostpad (substream, error);
 
-  fs_codec_destroy (codec);
-  gst_object_unref (ghostpad);
+    if (!ghostpad)
+    {
+      fs_codec_destroy (codec);
+      return FALSE;
+    }
+
+    g_signal_emit_by_name (stream, "src-pad-added", ghostpad, codec);
+
+    fs_codec_destroy (codec);
+    gst_object_unref (ghostpad);
+  }
 
   return TRUE;
 }
-- 
1.5.6.5




More information about the farsight-commits mailing list