changeset 28175:fa2e83d7ba7f

Set alsasrc's slave-method to 2. This stops the audio timestamps from being screwed up. Thanks to Tester for this fix.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Wed, 05 Aug 2009 02:17:12 +0000
parents 6ed9c1def7c8
children 584fa66dfb31
files libpurple/mediamanager.c
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/mediamanager.c	Wed Aug 05 01:58:02 2009 +0000
+++ b/libpurple/mediamanager.c	Wed Aug 05 02:17:12 2009 +0000
@@ -230,6 +230,7 @@
 	g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL);
 
 	if (manager->priv->pipeline == NULL) {
+		FsElementAddedNotifier *notifier;
 		gchar *filename;
 		GError *err = NULL;
 		GKeyFile *keyfile;
@@ -248,15 +249,8 @@
 		filename = g_build_filename(purple_user_dir(),
 				"fs-element.conf", NULL);
 		keyfile = g_key_file_new();
-		if (g_key_file_load_from_file(keyfile, filename,
+		if (!g_key_file_load_from_file(keyfile, filename,
 				G_KEY_FILE_NONE, &err)) {
-			FsElementAddedNotifier *notifier =
-					fs_element_added_notifier_new();
-			fs_element_added_notifier_add(notifier,
-					GST_BIN(manager->priv->pipeline));
-			fs_element_added_notifier_set_properties_from_keyfile(
-					notifier, keyfile);
-		} else {
 			if (err->code == 4)
 				purple_debug_info("mediamanager",
 						"Couldn't read "
@@ -268,10 +262,22 @@
 						"fs-element.conf: %s\n",
 						err->message);
 			g_error_free(err);
-			g_key_file_free(keyfile);
 		}
 		g_free(filename);
 
+		/* Hack to make alsasrc stop messing up audio timestamps */
+		if (!g_key_file_has_key(keyfile,
+				"alsasrc", "slave-method", NULL)) {
+			g_key_file_set_integer(keyfile,
+					"alsasrc", "slave-method", 2);
+		}
+
+		notifier = fs_element_added_notifier_new();
+		fs_element_added_notifier_add(notifier,
+				GST_BIN(manager->priv->pipeline));
+		fs_element_added_notifier_set_properties_from_keyfile(
+				notifier, keyfile);
+
 		gst_element_set_state(manager->priv->pipeline,
 				GST_STATE_PLAYING);
 	}