[farsight2/master] rtp: Do proper locking when removing send codec bin
Olivier Crête
olivier.crete at collabora.co.uk
Tue May 26 12:51:20 PDT 2009
---
gst/fsrtpconference/fs-rtp-session.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 1048594..07941d3 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -3274,13 +3274,20 @@ fs_rtp_session_remove_send_codec_bin (FsRtpSession *self,
FsCodec *codec_without_config,
gboolean error_emit)
{
+ FS_RTP_SESSION_LOCK (self);
+
if (self->priv->send_codecbin)
{
- gst_element_set_locked_state (self->priv->send_codecbin, TRUE);
- if (gst_element_set_state (self->priv->send_codecbin, GST_STATE_NULL) !=
+ GstElement *codecbin = self->priv->send_codecbin;
+ self->priv->send_codecbin = NULL;
+
+ FS_RTP_SESSION_UNLOCK (self);
+
+ gst_element_set_locked_state (codecbin, TRUE);
+ if (gst_element_set_state (codecbin, GST_STATE_NULL) !=
GST_STATE_CHANGE_SUCCESS)
{
- gst_element_set_locked_state (self->priv->send_codecbin, FALSE);
+ gst_element_set_locked_state (codecbin, FALSE);
GST_ERROR ("Could not stop the codec bin, setting it to NULL did not"
" succeed");
if (error_emit)
@@ -3290,12 +3297,10 @@ fs_rtp_session_remove_send_codec_bin (FsRtpSession *self,
return FALSE;
}
- gst_bin_remove (GST_BIN (self->priv->conference),
- self->priv->send_codecbin);
- self->priv->send_codecbin = NULL;
+ gst_bin_remove (GST_BIN (self->priv->conference), codecbin);
+ FS_RTP_SESSION_LOCK (self);
}
- FS_RTP_SESSION_LOCK (self);
fs_codec_destroy (self->priv->current_send_codec);
self->priv->current_send_codec = NULL;
FS_RTP_SESSION_UNLOCK (self);
--
1.5.6.5
More information about the farsight-commits
mailing list