Index: gst-plugins-base-0.10.20/ext/alsa/gstalsamixer.c
===================================================================
--- gst-plugins-base-0.10.20.orig/ext/alsa/gstalsamixer.c	2009-02-03 12:27:57.000000000 -0500
+++ gst-plugins-base-0.10.20/ext/alsa/gstalsamixer.c	2009-02-03 12:29:32.000000000 -0500
@@ -135,11 +135,14 @@
 
   count = snd_mixer_get_count (handle);
 
+  g_static_rec_mutex_lock (mixer->rec_mutex);
+
   /* Check if we have a playback mixer labelled as 'Master' */
   element = snd_mixer_first_elem (handle);
   for (i = 0; i < count; i++) {
     if (snd_mixer_selem_has_playback_volume (element) &&
         strcmp (snd_mixer_selem_get_name (element), "Master") == 0) {
+      g_static_rec_mutex_unlock (mixer->rec_mutex);
       return element;
     }
     element = snd_mixer_elem_next (element);
@@ -150,6 +153,7 @@
   for (i = 0; i < count; i++) {
     if (snd_mixer_selem_has_playback_volume (element) &&
         strcmp (snd_mixer_selem_get_name (element), "Front") == 0) {
+      g_static_rec_mutex_unlock (mixer->rec_mutex);
       return element;
     }
     element = snd_mixer_elem_next (element);
@@ -160,6 +164,7 @@
   for (i = 0; i < count; i++) {
     if (snd_mixer_selem_has_playback_volume (element) &&
         strcmp (snd_mixer_selem_get_name (element), "PCM") == 0) {
+      g_static_rec_mutex_unlock (mixer->rec_mutex);
       return element;
     }
     element = snd_mixer_elem_next (element);
@@ -170,6 +175,7 @@
   for (i = 0; i < count; i++) {
     if (snd_mixer_selem_has_playback_volume (element) &&
         snd_mixer_selem_has_playback_switch (element)) {
+      g_static_rec_mutex_unlock (mixer->rec_mutex);
       return element;
     }
     element = snd_mixer_elem_next (element);
@@ -179,11 +185,13 @@
   element = snd_mixer_first_elem (handle);
   for (i = 0; i < count; i++) {
     if (snd_mixer_selem_has_playback_volume (element)) {
+      g_static_rec_mutex_unlock (mixer->rec_mutex);
       return element;
     }
     element = snd_mixer_elem_next (element);
   }
 
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
   /* Looks like we're out of luck ... */
   return NULL;
 }
@@ -555,6 +563,8 @@
 
   g_return_if_fail (mixer->handle != NULL);
 
+  g_static_rec_mutex_lock (mixer->rec_mutex);
+
   gst_alsa_mixer_track_update (alsa_track);
 
   if (track->flags & GST_MIXER_TRACK_OUTPUT) {  /* return playback volume */
@@ -589,6 +599,7 @@
         volumes[i] = alsa_track->volumes[i];
     }
   }
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
 }
 
 static gboolean
@@ -616,6 +627,8 @@
 
   g_return_if_fail (mixer->handle != NULL);
 
+  g_static_rec_mutex_lock (mixer->rec_mutex);
+
   gst_alsa_mixer_track_update (alsa_track);
 
   if (track->flags & GST_MIXER_TRACK_OUTPUT) {
@@ -662,6 +675,7 @@
         alsa_track->volumes[i] = volumes[i];
     }
   }
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
 }
 
 void
@@ -672,11 +686,14 @@
 
   g_return_if_fail (mixer->handle != NULL);
 
+  g_static_rec_mutex_lock (mixer->rec_mutex);
+
   gst_alsa_mixer_track_update (alsa_track);
 
-  if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE))
+  if (!!(mute) == !!(track->flags & GST_MIXER_TRACK_MUTE)) {
+    g_static_rec_mutex_unlock (mixer->rec_mutex);
     return;
-
+  }
   if (mute) {
     track->flags |= GST_MIXER_TRACK_MUTE;
 
@@ -710,6 +727,7 @@
       snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol);
     }
   }
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
 }
 
 void
@@ -720,10 +738,14 @@
 
   g_return_if_fail (mixer->handle != NULL);
 
+  g_static_rec_mutex_lock (mixer->rec_mutex);
+
   gst_alsa_mixer_track_update (alsa_track);
 
-  if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD))
+  if (!!(record) == !!(track->flags & GST_MIXER_TRACK_RECORD)) {
+    g_static_rec_mutex_unlock (mixer->rec_mutex);
     return;
+  }
 
   if (record) {
     track->flags |= GST_MIXER_TRACK_RECORD;
@@ -761,6 +783,7 @@
       snd_mixer_selem_set_capture_volume (alsa_track->element, i, vol);
     }
   }
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
 }
 
 void
@@ -782,7 +805,9 @@
   if (idx == -1)
     return;
 
+  g_static_rec_mutex_lock (mixer->rec_mutex);
   snd_mixer_selem_set_enum_item (alsa_opts->element, 0, idx);
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
 }
 
 const gchar *
@@ -793,8 +818,9 @@
   GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
 
   g_return_val_if_fail (mixer->handle != NULL, NULL);
-
+  g_static_rec_mutex_lock (mixer->rec_mutex);
   ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
   if (ret == 0)
     return g_list_nth_data (opts->values, idx);
   else
@@ -821,8 +847,9 @@
     GST_WARNING ("Cannot send update notifications, no GstMixer * given");
     return;
   }
-
+  g_static_rec_mutex_lock (mixer->rec_mutex);
   ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
+  g_static_rec_mutex_unlock (mixer->rec_mutex);
   if (ret == 0) {
     option = g_list_nth_data (GST_MIXER_OPTIONS (alsa_opts)->values, idx);
     gst_mixer_option_changed (mixer->interface, GST_MIXER_OPTIONS (alsa_opts),
