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

David Woodhouse dwmw2 at infradead.org
Wed Mar 11 21:19:50 EDT 2015


From: Youness Alaoui <kakaroto at kakaroto.homelinux.net>

Next on the list...

---
 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(+)

diff --git a/libpurple/media.c b/libpurple/media.c
index 70359f3..ca39c39 100644
--- a/libpurple/media.c
+++ b/libpurple/media.c
@@ -1298,6 +1298,20 @@ purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id)
 }
 
 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
index 02ec32c..a07222d 100644
--- a/libpurple/media.h
+++ b/libpurple/media.h
@@ -406,6 +406,19 @@ gboolean purple_media_set_decryption_parameters(PurpleMedia *media,
 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
index 77bb804..ef4ab8d 100644
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -103,6 +103,10 @@ static const gchar **purple_media_backend_fs2_get_available_params(void);
 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(PurpleMediaBackendIface *iface)
 	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_volume(PurpleMediaBackendFs2 *self,
 #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
index 81f8e9d..75ced23 100644
--- a/libpurple/media/backend-iface.c
+++ b/libpurple/media/backend-iface.c
@@ -235,3 +235,16 @@ purple_media_backend_get_available_params(PurpleMediaBackend *self)
 	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
index 552d74b..5cb9342 100644
--- 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(PurpleMediaBackend *self,
  */
 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_ */
-- 
2.1.0


-- 
dwmw2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <https://pidgin.im/pipermail/devel/attachments/20150312/a9c60e7f/attachment.bin>


More information about the Devel mailing list