changeset 26401:7909c74618fc

Fix audio levels.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Fri, 20 Mar 2009 08:10:26 +0000
parents 007cd8dad384
children 8b4394e84633
files libpurple/media.c pidgin/gtkmedia.c
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Fri Mar 20 06:49:55 2009 +0000
+++ b/libpurple/media.c	Fri Mar 20 08:10:26 2009 +0000
@@ -1770,6 +1770,7 @@
 					"liveadder", NULL);
 			sink = purple_media_manager_get_element(priv->manager,
 					PURPLE_MEDIA_RECV_AUDIO);
+			stream->sink = sink;
 		} else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
 			stream->src = gst_element_factory_make(
 					"fsfunnel", NULL);
--- a/pidgin/gtkmedia.c	Fri Mar 20 06:49:55 2009 +0000
+++ b/pidgin/gtkmedia.c	Fri Mar 20 08:10:26 2009 +0000
@@ -324,7 +324,7 @@
 	if (message->type != GST_MESSAGE_ELEMENT)
 		return TRUE;
 
-	if (gst_structure_has_name(
+	if (!gst_structure_has_name(
 			gst_message_get_structure(message), "level"))
 		return TRUE;
 
@@ -612,6 +612,10 @@
 		gtk_widget_show(gtkmedia->priv->recv_progress);
 	}
 	if (type & PURPLE_MEDIA_SEND_AUDIO) {
+		GstElement *media_src = purple_media_get_src(media, sid);
+		gtkmedia->priv->send_level = gst_bin_get_by_name(
+				GST_BIN(media_src), "sendlevel");
+
 		gtkmedia->priv->send_progress = gtk_progress_bar_new();
 		gtk_widget_set_size_request(gtkmedia->priv->send_progress, 320, 10);
 		gtk_box_pack_end(GTK_BOX(send_widget),
@@ -675,6 +679,13 @@
 	} else if (type == PURPLE_MEDIA_STATE_CHANGED_NEW &&
 			sid != NULL && name != NULL) {
 		pidgin_media_ready_cb(media, gtkmedia, sid);
+	} else if (type == PURPLE_MEDIA_STATE_CHANGED_CONNECTED &&
+			purple_media_get_session_type(media, sid) &
+			PURPLE_MEDIA_RECV_AUDIO) {
+		GstElement *media_sink = purple_media_get_sink(media,
+				sid, name);
+		gtkmedia->priv->recv_level = gst_bin_get_by_name(
+				GST_BIN(media_sink), "recvlevel");
 	}
 }