[farsight2/master] We're using a recursive lock, remove unlocked version

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


---
 gst/fsrtpconference/fs-rtp-substream.c |   40 ++++++++------------------------
 1 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index 1c6480d..35a67ae 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -709,19 +709,18 @@ fs_rtp_sub_stream_get_property (GObject *object,
 
 
 /**
- * fs_rtp_session_set_codecbin_locked:
+ * fs_rtp_session_set_codecbin:
  * @substream: a #FsRtpSubStream
  *
  * Add and links the rtpbin for a given substream.
  * Removes any codecbin that was previously there.
  *
- * The caller MUST hold the session lock
  *
  * Returns: TRUE on success
  */
 
-static gboolean
-fs_rtp_sub_stream_set_codecbin_locked (FsRtpSubStream *substream,
+gboolean
+fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
     GError **error)
 {
   GstPad *codec_bin_sink_pad;
@@ -729,6 +728,8 @@ fs_rtp_sub_stream_set_codecbin_locked (FsRtpSubStream *substream,
   FsCodec *codec = NULL;
   GstElement *codecbin;
 
+  FS_RTP_SESSION_LOCK (substream->priv->session);
+
   if (substream->priv->codecbin)
   {
     if (gst_element_set_state (substream->priv->codecbin, GST_STATE_NULL) !=
@@ -809,10 +810,12 @@ fs_rtp_sub_stream_set_codecbin_locked (FsRtpSubStream *substream,
     if (!substream->priv->output_ghostpad)
       ret =  fs_rtp_sub_stream_add_output_ghostpad_locked (substream, error);
 
+    FS_RTP_SESSION_UNLOCK (substream->priv->session);
     return ret;
   }
   else
   {
+    FS_RTP_SESSION_UNLOCK (substream->priv->session);
     return TRUE;
   }
 
@@ -826,32 +829,9 @@ fs_rtp_sub_stream_set_codecbin_locked (FsRtpSubStream *substream,
     fs_rtp_sub_stream_invalidate_codec_locked (substream, substream->priv->pt,
         NULL);
 
-    return FALSE;
-}
-
-/**
- * fs_rtp_sub_stream_set_codecbin:
- * @substream: a #FsRtpSubStream
- *
- * Add and links the rtpbin for a given substream.
- * Removes any codecbin that was previously there.
- *
- * MT safe.
- *
- * Returns: TRUE on success
- */
-
-gboolean
-fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
-    GError **error)
-{
-  gboolean ret;
-
-  FS_RTP_SESSION_LOCK (substream->priv->session);
-  ret = fs_rtp_sub_stream_set_codecbin_locked (substream, error);
-  FS_RTP_SESSION_UNLOCK (substream->priv->session);
+    FS_RTP_SESSION_UNLOCK (substream->priv->session);
 
-  return ret;
+    return FALSE;
 }
 
 FsRtpSubStream *
@@ -1027,7 +1007,7 @@ _rtpbin_pad_have_data_callback (GstPad *pad, GstMiniObject *miniobj,
   }
 
 
-  if (!fs_rtp_sub_stream_set_codecbin_locked (self, &error))
+  if (!fs_rtp_sub_stream_set_codecbin (self, &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,
-- 
1.5.6.5




More information about the farsight-commits mailing list