[farsight2/master] Use the locked_state pattern everywhere in rtpsession

Olivier Crête olivier.crete at collabora.co.uk
Wed Dec 17 18:10:53 PST 2008


---
 gst/fsrtpconference/fs-rtp-session.c   |    9 +++++++--
 gst/fsrtpconference/fs-rtp-substream.c |    3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 6793196..8651f3a 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -385,13 +385,15 @@ _remove_transmitter (gpointer key, gpointer value, gpointer user_data)
 
   g_object_get (transmitter, "gst-sink", &sink, "gst-src", &src, NULL);
 
+  gst_element_set_locked_state (src, TRUE);
   gst_element_set_state (src, GST_STATE_NULL);
   gst_bin_remove (GST_BIN (self->priv->conference), src);
-  gst_element_set_state (src, GST_STATE_NULL);
+  gst_element_set_locked_state (src, FALSE);
 
+  gst_element_set_locked_state (sink, TRUE);
   gst_element_set_state (sink, GST_STATE_NULL);
   gst_bin_remove (GST_BIN (self->priv->conference), sink);
-  gst_element_set_state (sink, GST_STATE_NULL);
+  gst_element_set_locked_state (sink, FALSE);
 
   gst_object_unref (src);
   gst_object_unref (sink);
@@ -3189,6 +3191,7 @@ fs_rtp_session_add_send_codec_bin (FsRtpSession *session,
   return codecbin;
 
  error:
+  gst_element_set_locked_state (codecbin, TRUE);
   gst_element_set_state (codecbin, GST_STATE_NULL);
   gst_bin_remove (GST_BIN (session->priv->conference), codecbin);
   fs_codec_list_destroy (codecs);
@@ -3267,6 +3270,7 @@ _send_src_pad_blocked_callback (GstPad *pad, gboolean blocked,
   if (gst_element_set_state (self->priv->send_codecbin, GST_STATE_NULL) !=
       GST_STATE_CHANGE_SUCCESS)
   {
+    gst_element_set_locked_state (self->priv->send_codecbin, FALSE);
     fs_session_emit_error (FS_SESSION (self), FS_ERROR_INTERNAL,
         "Could not stop the codec bin",
         "Setting the codec bin to NULL did not succeed" );
@@ -3297,6 +3301,7 @@ _send_src_pad_blocked_callback (GstPad *pad, gboolean blocked,
       gst_object_unref (ourpad);
     }
 
+    gst_element_set_locked_state (cf, TRUE);
     gst_element_set_state (cf, GST_STATE_NULL);
     gst_bin_remove (GST_BIN (self->priv->conference), cf);
 
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index 14fc890..3804211 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -808,9 +808,11 @@ fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
 
   if (substream->priv->codecbin)
   {
+    gst_element_set_locked_state (substream->priv->codecbin, TRUE);
     if (gst_element_set_state (substream->priv->codecbin, GST_STATE_NULL) !=
         GST_STATE_CHANGE_SUCCESS)
     {
+      gst_element_set_locked_state (substream->priv->codecbin, FALSE);
       g_set_error (error, FS_ERROR, FS_ERROR_INTERNAL,
           "Could not set the codec bin for ssrc %u"
           " and payload type %d to the state NULL", substream->priv->ssrc,
@@ -915,6 +917,7 @@ fs_rtp_sub_stream_set_codecbin (FsRtpSubStream *substream,
 
  error:
 
+  gst_element_set_locked_state (codecbin, TRUE);
   gst_element_set_state (codecbin, GST_STATE_NULL);
   gst_object_ref (codecbin);
   gst_bin_remove (GST_BIN (substream->priv->conference), codecbin);
-- 
1.5.6.5




More information about the farsight-commits mailing list