[farsight2/master] Move function to select substream codec into session

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


---
 gst/fsrtpconference/fs-rtp-session.c   |   37 +++++++++++++++++++++++++++++++-
 gst/fsrtpconference/fs-rtp-session.h   |    8 +++++++
 gst/fsrtpconference/fs-rtp-substream.c |   34 +---------------------------
 gst/fsrtpconference/fs-rtp-substream.h |    4 ---
 4 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index f62615f..650f1ec 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1709,6 +1709,39 @@ _substream_error (FsRtpSubStream *substream,
 }
 
 
+gboolean
+fs_rtp_session_substream_add_codec_bin (FsRtpSession *session,
+    gpointer ss,
+    guint32 ssrc,
+    guint pt,
+    GError **error)
+{
+  FsRtpSubStream *substream = ss;
+  gboolean ret = FALSE;
+  FsCodec *codec = NULL;
+  GstElement *codecbin = NULL;
+
+  FS_RTP_SESSION_LOCK (session);
+
+  codecbin = fs_rtp_session_new_recv_codec_bin_locked (session, ssrc, pt,
+      &codec, error);
+
+  if (!codecbin)
+  {
+    ret = FALSE;
+    goto out;
+  }
+
+  ret = fs_rtp_sub_stream_set_codecbin (substream, codec, codecbin, error);
+
+ out:
+  FS_RTP_SESSION_UNLOCK (session);
+
+  fs_codec_destroy (codec);
+
+  return ret;
+}
+
 /**
  * fs_rtp_session_new_recv_pad:
  * @session: a #FsSession
@@ -1751,7 +1784,9 @@ fs_rtp_session_new_recv_pad (FsRtpSession *session, GstPad *new_pad,
     return;
   }
 
-  if (!fs_rtp_sub_stream_create_codecbin (substream, &error)) {
+  if (!fs_rtp_session_substream_add_codec_bin (session, substream, ssrc, pt,
+          &error))
+  {
     if (error)
       fs_session_emit_error (FS_SESSION (session), error->code,
           "Could not add the codec bin to the new substream", error->message);
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index b634fdc..74cdfdd 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -108,6 +108,14 @@ void fs_rtp_session_associate_ssrc_cname (FsRtpSession *session,
 void fs_rtp_session_bye_ssrc (FsRtpSession *session,
     guint32 ssrc);
 
+gboolean
+fs_rtp_session_substream_add_codec_bin (FsRtpSession *session,
+    gpointer ss,
+    guint32 ssrc,
+    guint pt,
+    GError **error);
+
+
 G_END_DECLS
 
 #endif /* __FS_RTP_SESSION_H__ */
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index 7401125..c18a5d5 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -707,37 +707,6 @@ fs_rtp_sub_stream_get_property (GObject *object,
   }
 }
 
-
-gboolean
-fs_rtp_sub_stream_create_codecbin (FsRtpSubStream *substream,
-    GError **error)
-{
-  gboolean ret = FALSE;
-  FsCodec *codec = NULL;
-  GstElement *codecbin = NULL;
-
-  FS_RTP_SESSION_LOCK (substream->priv->session);
-
-  codecbin = fs_rtp_session_new_recv_codec_bin_locked (
-      substream->priv->session,
-      substream->priv->ssrc, substream->priv->pt, &codec, error);
-
-  if (!codecbin)
-  {
-    ret = FALSE;
-    goto out;
-  }
-
-  ret = fs_rtp_sub_stream_set_codecbin (substream, codec, codecbin, error);
-
-out:
-  FS_RTP_SESSION_UNLOCK (substream->priv->session);
-
-  fs_codec_destroy (codec);
-
-  return ret;
-}
-
 /**
  * fs_rtp_session_set_codecbin:
  * @substream: a #FsRtpSubStream
@@ -1032,7 +1001,8 @@ _rtpbin_pad_have_data_callback (GstPad *pad, GstMiniObject *miniobj,
   }
 
 
-  if (!fs_rtp_sub_stream_create_codecbin (self, &error))
+  if (!fs_rtp_session_substream_add_codec_bin (self->priv->session,
+          self, self->priv->ssrc, self->priv->pt, &error))
   {
     gchar *str = g_strdup_printf ("Could not add the new recv codec bin for"
         " ssrc %u and payload type %d to the state NULL", self->priv->ssrc,
diff --git a/gst/fsrtpconference/fs-rtp-substream.h b/gst/fsrtpconference/fs-rtp-substream.h
index aff7e6a..04e5852 100644
--- a/gst/fsrtpconference/fs-rtp-substream.h
+++ b/gst/fsrtpconference/fs-rtp-substream.h
@@ -85,10 +85,6 @@ gboolean fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
     GstElement *codecbin,
     GError **error);
 
-gboolean
-fs_rtp_sub_stream_create_codecbin (FsRtpSubStream *substream,
-    GError **error);
-
 void fs_rtp_sub_stream_stop (FsRtpSubStream *substream);
 
 gboolean fs_rtp_sub_stream_add_output_ghostpad_locked (
-- 
1.5.6.5




More information about the farsight-commits mailing list