[farsight2/master] Emit the codec-changed signal if the codec is changed for a substream

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


---
 gst/fsrtpconference/fs-rtp-substream.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index bdfbda3..c3132a1 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -801,9 +801,16 @@ fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
   gchar *tmp;
   gboolean ret = FALSE;
   GstPad *pad;
+  gboolean codec_changed = TRUE;
 
   FS_RTP_SESSION_LOCK (substream->priv->session);
 
+  if (substream->priv->codec)
+  {
+    if (!fs_codec_are_equal (codec, substream->priv->codec))
+      codec_changed = FALSE;
+  }
+
   if (substream->priv->codecbin)
   {
     if (gst_element_set_state (substream->priv->codecbin, GST_STATE_NULL) !=
@@ -895,8 +902,15 @@ fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
   substream->priv->codec = fs_codec_copy (codec);
 
   if (substream->priv->stream && !substream->priv->output_ghostpad)
+  {
     if (!fs_rtp_sub_stream_add_output_ghostpad_locked (substream, error))
       goto error;
+  }
+  else
+  {
+    if (codec_changed)
+      g_signal_emit (substream, signals[CODEC_CHANGED], 0);
+  }
 
   FS_RTP_SESSION_UNLOCK (substream->priv->session);
   return TRUE;
-- 
1.5.6.5




More information about the farsight-commits mailing list