/pidgin/main: b709356517b5: mediamanager: ignore PulseAudio moni...

Jakub Adam jakub.adam at ktknet.cz
Mon Jul 18 00:33:09 EDT 2016


Changeset: b709356517b522c4215b39e56d44a2bdceb9d4ba
Author:	 Jakub Adam <jakub.adam at ktknet.cz>
Date:	 2016-06-22 09:37 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/b709356517b5

Description:

mediamanager: ignore PulseAudio monitors

Ignore PulseAudio monitor audio sources since they have little use
in the context of telephony.

diffstat:

 libpurple/mediamanager.c |  38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diffs (55 lines):

diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -1944,6 +1944,40 @@ gst_device_create_cb(PurpleMediaElementI
 	return result;
 }
 
+static gboolean
+device_is_ignored(GstDevice *device)
+{
+	gboolean result = FALSE;
+
+#if GST_CHECK_VERSION(1, 6, 0)
+	gchar *device_class;
+
+	g_return_val_if_fail(device, TRUE);
+
+	device_class = gst_device_get_device_class(device);
+
+	/* Ignore PulseAudio monitor audio sources since they have little use
+	 * in the context of telephony.*/
+	if (purple_strequal(device_class, "Audio/Source")) {
+		GstStructure *properties;
+		const gchar *pa_class;
+
+		properties = gst_device_get_properties(device);
+
+		pa_class = gst_structure_get_string(properties, "device.class");
+		if (purple_strequal(pa_class, "monitor")) {
+			result = TRUE;
+		}
+
+		gst_structure_free(properties);
+	}
+
+	g_free(device_class);
+#endif /* GST_CHECK_VERSION(1, 6, 0) */
+
+	return result;
+}
+
 static void
 purple_media_manager_register_gst_device(PurpleMediaManager *manager,
 		GstDevice *device)
@@ -1954,6 +1988,10 @@ purple_media_manager_register_gst_device
 	gchar *device_class;
 	gchar *id;
 
+	if (device_is_ignored(device)) {
+		return;
+	}
+
 	name = gst_device_get_display_name(device);
 	device_class = gst_device_get_device_class(device);
 



More information about the Commits mailing list