[farsight2/master] Make fs_rtp_session_get_recv_codec_for_pt use its own locking
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:20:18 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 28 +++++++++++++++++++++-------
gst/fsrtpconference/fs-rtp-session.h | 5 ++---
gst/fsrtpconference/fs-rtp-substream.c | 12 ++++++------
3 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index bbaed1d..3de8096 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -2096,17 +2096,31 @@ fs_rtp_session_verify_send_codec_bin_locked (FsRtpSession *self, GError **error)
}
-
+/**
+ * fs_rtp_session_get_recv_codec_for_pt
+ *
+ * Gets the Codec from its PT from the codecs associations table
+ *
+ * Return: a copy of the #FsCodec or NULL
+ */
FsCodec *
-fs_rtp_session_get_recv_codec_for_pt_locked (FsRtpSession *session,
- gint pt,
- GError **error)
+fs_rtp_session_get_recv_codec_for_pt (FsRtpSession *session,
+ gint pt)
{
- CodecAssociation *codec_association = g_hash_table_lookup (
+ CodecAssociation *codec_association = NULL;
+ FsCodec *codec = NULL;
+
+ FS_RTP_SESSION_LOCK (session);
+
+ codec_association = g_hash_table_lookup (
session->priv->negotiated_codec_associations, GINT_TO_POINTER (pt));
- g_assert (codec_association);
- return fs_codec_copy (codec_association->codec);
+ if (codec_association)
+ codec = fs_codec_copy (codec_association->codec);
+
+ FS_RTP_SESSION_UNLOCK (session);
+
+ return codec;
}
diff --git a/gst/fsrtpconference/fs-rtp-session.h b/gst/fsrtpconference/fs-rtp-session.h
index 15cb147..55d644d 100644
--- a/gst/fsrtpconference/fs-rtp-session.h
+++ b/gst/fsrtpconference/fs-rtp-session.h
@@ -101,9 +101,8 @@ GstElement *fs_rtp_session_new_recv_codec_bin_locked (FsRtpSession *session,
FsCodec **out_codec,
GError **error);
-FsCodec *fs_rtp_session_get_recv_codec_for_pt_locked (FsRtpSession *session,
- gint pt,
- GError **error);
+FsCodec *fs_rtp_session_get_recv_codec_for_pt (FsRtpSession *session,
+ gint pt);
void fs_rtp_session_associate_ssrc_cname (FsRtpSession *session,
guint32 ssrc,
diff --git a/gst/fsrtpconference/fs-rtp-substream.c b/gst/fsrtpconference/fs-rtp-substream.c
index a06c51c..c452bcb 100644
--- a/gst/fsrtpconference/fs-rtp-substream.c
+++ b/gst/fsrtpconference/fs-rtp-substream.c
@@ -658,15 +658,15 @@ _rtpbin_pad_have_data_callback (GstPad *pad, GstMiniObject *miniobj,
GError *error = NULL;
gboolean success = FALSE;
- FS_RTP_SESSION_LOCK (self->priv->session);
-
- codec = fs_rtp_session_get_recv_codec_for_pt_locked (self->priv->session,
- self->priv->pt, &error);
+ codec = fs_rtp_session_get_recv_codec_for_pt (self->priv->session,
+ self->priv->pt);
if (!codec)
{
- fs_session_emit_error (FS_SESSION (self), error->code,
- "Could not get the new recv codec for pt %d", error->message);
+ gchar *str = g_strdup_printf ("Could not get the new recv codec for"
+ " pt %d", self->priv->pt);
+ fs_session_emit_error (FS_SESSION (self), FS_ERROR_UNKNOWN_CODEC, str,
+ str);
goto done;
}
--
1.5.6.5
More information about the farsight-commits
mailing list