[farsight2/master] transform the new_recv_codec_bin function into a pre-locked one
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:20:16 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 9 ++-------
gst/fsrtpconference/fs-rtp-session.h | 2 +-
gst/fsrtpconference/fs-rtp-substream.c | 5 ++---
3 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index c6a1607..0341cc6 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1726,13 +1726,13 @@ _create_codec_bin (CodecBlueprint *blueprint, const FsCodec *codec,
*
* This function will create a new reception codec bin for the specified codec
*
- * MT safe.
+ * Must be called with the FsRtpSession lock taken
*
* Returns: a newly-allocated codec bin
*/
GstElement *
-fs_rtp_session_new_recv_codec_bin (FsRtpSession *session,
+fs_rtp_session_new_recv_codec_bin_locked (FsRtpSession *session,
guint32 ssrc,
guint pt,
FsCodec **out_codec,
@@ -1744,10 +1744,7 @@ fs_rtp_session_new_recv_codec_bin (FsRtpSession *session,
FsCodec *codec = NULL;
gchar *name;
- FS_RTP_SESSION_LOCK (session);
-
if (!session->priv->negotiated_codec_associations) {
- FS_RTP_SESSION_UNLOCK (session);
g_set_error (error, FS_ERROR, FS_ERROR_INTERNAL,
"No negotiated codecs yet");
return NULL;
@@ -1763,8 +1760,6 @@ fs_rtp_session_new_recv_codec_bin (FsRtpSession *session,
codec = fs_codec_copy (ca->codec);
}
- FS_RTP_SESSION_UNLOCK (session);
-
if (!ca) {
g_set_error (error, FS_ERROR, FS_ERROR_UNKNOWN_CODEC,
"There is no negotiated codec with pt %d", pt);
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index 6fabe5a..ef8670a 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -95,7 +95,7 @@ void fs_rtp_session_new_recv_pad (FsRtpSession *session, GstPad *new_pad,
gboolean fs_rtp_session_negotiate_codecs (FsRtpSession *session,
GList *remote_codecs, GError **error);
-GstElement *fs_rtp_session_new_recv_codec_bin (FsRtpSession *session,
+GstElement *fs_rtp_session_new_recv_codec_bin_locked (FsRtpSession *session,
guint32 ssrc,
guint pt,
FsCodec **out_codec,
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index 1fca843..b078bd6 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -426,7 +426,6 @@ fs_rtp_sub_stream_add_codecbin_locked (FsRtpSubStream *substream,
FsCodec *codec = NULL;
GstElement *codecbin;
-
if (substream->priv->codecbin)
{
g_set_error (error, FS_ERROR, FS_ERROR_INVALID_ARGUMENTS,
@@ -434,13 +433,12 @@ fs_rtp_sub_stream_add_codecbin_locked (FsRtpSubStream *substream,
return FALSE;
}
- codecbin = fs_rtp_session_new_recv_codec_bin (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)
return FALSE;
-
if (!gst_bin_add (GST_BIN (substream->priv->conference), codecbin))
{
g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION,
@@ -486,6 +484,7 @@ fs_rtp_sub_stream_add_codecbin_locked (FsRtpSubStream *substream,
gst_pad_set_blocked_async (substream->priv->rtpbin_pad, FALSE, _blocked_cb,
NULL);
+
return TRUE;
error:
--
1.5.6.5
More information about the farsight-commits
mailing list