changeset 28078:afa79877d972

Detect that there has been an error in the GStreamer pipeline, output an appropriate message and end the conference.
author maiku@pidgin.im
date Sun, 23 Aug 2009 09:12:32 +0000
parents 3571b38c1a7e
children ea6e571ebe4d
files libpurple/media.c
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Sun Aug 23 07:08:19 2009 +0000
+++ b/libpurple/media.c	Sun Aug 23 09:12:32 2009 +0000
@@ -2129,6 +2129,35 @@
 			}
 			break;
 		}
+		case GST_MESSAGE_ERROR: {
+			GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg));
+			GstElement *lastElement = NULL;
+			while (!GST_IS_PIPELINE(element)) {
+				if (element == media->priv->confbin) {
+					purple_media_error("media", _("Conference error."));
+					purple_media_end(media, NULL, NULL);
+					break;
+				}
+				lastElement = element;
+				element = GST_ELEMENT_PARENT(element);
+			}
+			if (GST_IS_PIPELINE(element)) {
+				GList *sessions = g_hash_table_get_values(media->priv->sessions);
+				for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
+					PurpleMediaSession *session = sessions->data;
+
+					if (session->src == lastElement) {
+						if (session->type & PURPLE_MEDIA_AUDIO)
+							purple_media_error(media, _("Error with your microphone."));
+						else
+							purple_media_error(media, _("Error with your webcam."));
+						purple_media_end(media, NULL, NULL);
+						break;
+					}
+				}
+				g_list_free(sessions);
+			}
+		}
 		default:
 			break;
 	}