/pidgin/main: 5ebbb1ee7028: media: Add a send-rtcp-mux API to al...

Youness Alaoui kakaroto at kakaroto.homelinux.net
Fri Mar 13 08:59:51 EDT 2015


Changeset: 5ebbb1ee7028bbe99801faee99b88221900b8183
Author:	 Youness Alaoui <kakaroto at kakaroto.homelinux.net>
Date:	 2014-08-11 16:28 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/5ebbb1ee7028

Description:

media: Add a send-rtcp-mux API to allow muxing of RTP and RTCP

diffstat:

 libpurple/media.c               |  14 ++++++++++++++
 libpurple/media.h               |  13 +++++++++++++
 libpurple/media/backend-fs2.c   |  26 ++++++++++++++++++++++++++
 libpurple/media/backend-iface.c |  13 +++++++++++++
 libpurple/media/backend-iface.h |  17 +++++++++++++++++
 5 files changed, 83 insertions(+), 0 deletions(-)

diffs (148 lines):

diff --git a/libpurple/media.c b/libpurple/media.c
--- a/libpurple/media.c
+++ b/libpurple/media.c
@@ -1298,6 +1298,20 @@ purple_media_codecs_ready(PurpleMedia *m
 }
 
 gboolean
+purple_media_set_send_rtcp_mux(PurpleMedia *media, const gchar *sess_id,
+                               const gchar *participant, gboolean send_rtcp_mux)
+{
+#ifdef USE_VV
+	g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
+
+	return purple_media_backend_set_send_rtcp_mux(media->priv->backend,
+			sess_id, participant, send_rtcp_mux);
+#else
+	return FALSE;
+#endif
+}
+
+gboolean
 purple_media_is_initiator(PurpleMedia *media,
 		const gchar *sess_id, const gchar *participant)
 {
diff --git a/libpurple/media.h b/libpurple/media.h
--- a/libpurple/media.h
+++ b/libpurple/media.h
@@ -406,6 +406,19 @@ gboolean purple_media_set_decryption_par
 gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id);
 
 /**
+ * purple_media_set_send_rtcp_mux:
+ * @media: The media object to find the session in.
+ * @sess_id: The session id of the session find the stream in.
+ * @participant: The name of the remote user to set the rtcp-mux for.
+ * @send_rtcp_mux: Whether to enable the rtcp-mux option
+ *
+ * Sets the rtcp-mux option for the stream.
+ *
+ * Returns: %TRUE RTCP-Mux was set successfully, or %FALSE otherwise.
+ */
+gboolean purple_media_set_send_rtcp_mux(PurpleMedia *media,
+		const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux);
+/**
  * purple_media_is_initiator:
  * @media: The media instance to find the session in.
  * @sess_id: The session id of the session to check.
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -103,6 +103,10 @@ static const gchar **purple_media_backen
 static gboolean purple_media_backend_fs2_send_dtmf(
 		PurpleMediaBackend *self, const gchar *sess_id,
 		gchar dtmf, guint8 volume, guint16 duration);
+static gboolean purple_media_backend_fs2_set_send_rtcp_mux(
+		PurpleMediaBackend *self,
+		const gchar *sess_id, const gchar *participant,
+		gboolean send_rtcp_mux);
 
 static void free_stream(PurpleMediaBackendFs2Stream *stream);
 static void free_session(PurpleMediaBackendFs2Session *session);
@@ -564,6 +568,7 @@ purple_media_backend_iface_init(PurpleMe
 	iface->set_params = purple_media_backend_fs2_set_params;
 	iface->get_available_params = purple_media_backend_fs2_get_available_params;
 	iface->send_dtmf = purple_media_backend_fs2_send_dtmf;
+	iface->set_send_rtcp_mux = purple_media_backend_fs2_set_send_rtcp_mux;
 }
 
 static FsMediaType
@@ -2839,3 +2844,24 @@ purple_media_backend_fs2_set_output_volu
 #endif /* USE_VV */
 }
 #endif /* USE_GSTREAMER */
+
+static gboolean
+purple_media_backend_fs2_set_send_rtcp_mux(PurpleMediaBackend *self,
+		const gchar *sess_id, const gchar *participant,
+		gboolean send_rtcp_mux)
+{
+	PurpleMediaBackendFs2Stream *stream;
+
+	g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), FALSE);
+	stream = get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
+			sess_id, participant);
+
+	if (stream != NULL &&
+		g_object_class_find_property (G_OBJECT_GET_CLASS (stream->stream),
+			"send-rtcp-mux") != NULL) {
+		g_object_set (stream->stream, "send-rtcp-mux", send_rtcp_mux, NULL);
+		return TRUE;
+	}
+
+	return FALSE;
+}
diff --git a/libpurple/media/backend-iface.c b/libpurple/media/backend-iface.c
--- a/libpurple/media/backend-iface.c
+++ b/libpurple/media/backend-iface.c
@@ -235,3 +235,16 @@ purple_media_backend_get_available_param
 	g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), NULL_ARRAY);
 	return PURPLE_MEDIA_BACKEND_GET_INTERFACE(self)->get_available_params();
 }
+
+gboolean
+purple_media_backend_set_send_rtcp_mux(PurpleMediaBackend *self,
+		const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux)
+{
+	PurpleMediaBackendIface *backend_iface;
+
+	g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND(self), FALSE);
+	backend_iface = PURPLE_MEDIA_BACKEND_GET_INTERFACE(self);
+	g_return_val_if_fail(backend_iface->set_send_rtcp_mux, FALSE);
+	return backend_iface->set_send_rtcp_mux(self,
+			sess_id, participant, send_rtcp_mux);
+}
diff --git a/libpurple/media/backend-iface.h b/libpurple/media/backend-iface.h
--- a/libpurple/media/backend-iface.h
+++ b/libpurple/media/backend-iface.h
@@ -93,6 +93,8 @@ struct _PurpleMediaBackendIface
 	gboolean (*send_dtmf) (PurpleMediaBackend *self,
 		const gchar *sess_id, gchar dtmf, guint8 volume,
 		guint16 duration);
+	gboolean (*set_send_rtcp_mux) (PurpleMediaBackend *self,
+		const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux);
 };
 
 /**
@@ -266,6 +268,21 @@ void purple_media_backend_set_params(Pur
  */
 const gchar **purple_media_backend_get_available_params(PurpleMediaBackend *self);
 
+/**
+ * purple_media_backend_set_send_rtcp_mux:
+ * @self: The media backend the session is in.
+ * @sess_id: The session id of the session to set the rtcp-mux option to
+ * @participant: The participant the stream is associated with.
+ * @send_rtcp_mux: Whether or not to enable rtcp-mux
+ *
+ * Controls whether or not the RTCP should be muxed with the RTP
+ *
+ * Returns: True if set successfully, otherwise False.
+ */
+gboolean purple_media_backend_set_send_rtcp_mux(PurpleMediaBackend *self,
+		const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux);
+
+
 G_END_DECLS
 
 #endif /* _MEDIA_BACKEND_IFACE_H_ */



More information about the Commits mailing list