gnome-power-manager r2734 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2734 - in trunk: . src
- Date: Sun, 16 Mar 2008 18:59:47 +0000 (GMT)
Author: rhughes
Date: Sun Mar 16 18:59:47 2008
New Revision: 2734
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2734&view=rev
Log:
2008-03-16 Richard Hughes <richard hughsie com>
* src/gpm-sound.c: (gpm_sound_gst_bus_cb), (gpm_sound_init):
We never change state of the playbin back to NULL when playing a sound
event.
This as multiple problems :
- lock indefinitely the mixer when using ALSA as gstreamer audio sink :
- Create an HUGE leak when using pulsaudio as gstreamer audio sink and for
some reasons pulsaudio crash, or you terminate the stream in pavucontrol.
Patch by Florent Mertens <outpourav yahoo fr>, and slightly tweaked by
me. Fixes #522336
Modified:
trunk/ChangeLog
trunk/src/gpm-sound.c
Modified: trunk/src/gpm-sound.c
==============================================================================
--- trunk/src/gpm-sound.c (original)
+++ trunk/src/gpm-sound.c Sun Mar 16 18:59:47 2008
@@ -225,6 +225,37 @@
}
/**
+ * gpm_sound_class_init:
+ *
+ * Needed to change state of the playbin back to NULL to avoid lockups
+ **/
+static void
+gpm_sound_gst_bus_cb (GstBus *bus, GstMessage *message, GpmSound *sound)
+{
+ switch (GST_MESSAGE_TYPE (message)) {
+ case GST_MESSAGE_ERROR: {
+ GError *error;
+ gchar *debug;
+
+ gst_element_set_state (sound->priv->playbin, GST_STATE_NULL);
+
+ gst_message_parse_error (message, &error, &debug);
+ gpm_warning ("%s (%s)", error->message, debug);
+
+ g_error_free (error);
+ g_free (debug);
+ break;
+ }
+ case GST_MESSAGE_EOS: {
+ gst_element_set_state (sound->priv->playbin, GST_STATE_NULL);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/**
* gpm_sound_init:
* @sound: This class instance
*
@@ -236,6 +267,7 @@
gpm_sound_init (GpmSound *sound)
{
GstElement *audio_sink;
+ GstBus *bus;
sound->priv = GPM_SOUND_GET_PRIVATE (sound);
@@ -264,6 +296,11 @@
if (audio_sink != NULL)
g_object_set (sound->priv->playbin, "audio-sink", audio_sink, NULL);
+ bus = gst_element_get_bus (GST_ELEMENT (sound->priv->playbin));
+ gst_bus_add_signal_watch (bus);
+ g_signal_connect (bus, "message", G_CALLBACK (gpm_sound_gst_bus_cb), sound);
+ gst_object_unref (bus);
+
/* do we beep? */
gpm_conf_get_bool (sound->priv->conf, GPM_CONF_UI_ENABLE_BEEPING, &sound->priv->enable_beeping);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]