[farsight2/master] Make set_negotiated_codecs into an unlocking function

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 16 15:06:14 PST 2008


---
 gst/fsrtpconference/fs-rtp-session.c |    4 +++-
 gst/fsrtpconference/fs-rtp-stream.c  |   10 ++++++----
 gst/fsrtpconference/fs-rtp-stream.h  |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 1558f05..2b449d9 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1963,9 +1963,11 @@ fs_rtp_session_distribute_recv_codecs_locked (FsRtpSession *session,
       /* This function unlocks the lock, so we have to check the cookie
        * when we come back */
       g_object_ref (stream);
-      fs_rtp_stream_set_negotiated_codecs_locked (stream, new_codecs);
+      fs_rtp_stream_set_negotiated_codecs_unlock (stream, new_codecs);
       g_object_unref (stream);
 
+      FS_RTP_SESSION_LOCK (session);
+
       if (cookie != session->priv->streams_cookie)
         goto restart;
     }
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index a3f0e68..ca75a5d 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -847,21 +847,25 @@ _substream_codec_changed (FsRtpSubStream *substream,
 }
 
 /**
- * fs_rtp_stream_set_negotiated_codecs_locked
+ * fs_rtp_stream_set_negotiated_codecs_unlock
  * @stream: a #FsRtpStream
  * @codecs: The #GList of #FsCodec to set for the negotiated-codecs property
  *
  * This function sets the value of the FsStream:negotiated-codecs property.
  * Unlike most other functions in this element, it TAKES the reference to the
  * codecs, so you have to give it its own copy.
+ *
+ * You must enter this function with the session lock held and it will release
+ * it.
  */
 void
-fs_rtp_stream_set_negotiated_codecs_locked (FsRtpStream *stream,
+fs_rtp_stream_set_negotiated_codecs_unlock (FsRtpStream *stream,
     GList *codecs)
 {
   if (fs_codec_list_are_equal (stream->negotiated_codecs, codecs))
   {
     fs_codec_list_destroy (codecs);
+    FS_RTP_SESSION_UNLOCK (stream->priv->session);
     return;
   }
 
@@ -873,6 +877,4 @@ fs_rtp_stream_set_negotiated_codecs_locked (FsRtpStream *stream,
   FS_RTP_SESSION_UNLOCK (stream->priv->session);
 
   g_object_notify (G_OBJECT (stream), "negotiated-codecs");
-
-  FS_RTP_SESSION_LOCK (stream->priv->session);
 }
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index cbdf605..1b1dae1 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -105,7 +105,7 @@ gboolean fs_rtp_stream_add_substream_locked (FsRtpStream *stream,
     GError **error);
 
 void
-fs_rtp_stream_set_negotiated_codecs_locked (FsRtpStream *stream,
+fs_rtp_stream_set_negotiated_codecs_unlock (FsRtpStream *stream,
     GList *codecs);
 
 G_END_DECLS
-- 
1.5.6.5




More information about the farsight-commits mailing list