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

Youness Alaoui <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 5f5abd63c305badb2749d73cfd461d1468d6ed83
Author:	 Youness Alaoui <[email protected]>
Date:	 2014-08-11 16:28 -0400
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/5f5abd63c305

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
@@ -1317,6 +1317,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
@@ -398,6 +398,19 @@ gboolean purple_media_set_decryption_par
 gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id);
 
 /**
+ * Sets the rtcp-mux option for the stream.
+ *
+ * @param media The media object to find the session in.
+ * @param sess_id The session id of the session find the stream in.
+ * @param participant The name of the remote user to set the rtcp-mux for.
+ * @paran send_rtcp_mux Whether to enable the rtcp-mux option
+ *
+ * @return @c TRUE RTCP-Mux was set successfully, or @c FALSE otherwise.
+ */
+gboolean purple_media_set_send_rtcp_mux(PurpleMedia *media,
+		const gchar *sess_id, const gchar *participant, gboolean send_rtcp_mux);
+
+/**
  * Gets whether the local user is the conference/session/stream's initiator.
  *
  * @param media The media instance to find the session in.
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
@@ -107,6 +107,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);
@@ -563,6 +567,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
@@ -2838,3 +2843,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
@@ -238,3 +238,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
@@ -81,6 +81,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_ */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.