[vlc-devel] commit: ALSA: warn user on current alsa-lib versions if re-open fails ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Nov 10 21:48:36 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 10 22:45:56 2009 +0200| [f4cae1c6485e9f84d2e9c625ec334b96b1937737] | committer: Rémi Denis-Courmont 

ALSA: warn user on current alsa-lib versions if re-open fails

This bug is fixed in alsa-lib git repository. Depending on the
underlying ALSA driver, re-opening the sound card might fail if VLC
forked and executed another process. This is especially bad with
xdg-screensaver, although this could affect other -earlier- usages
of fork+exec or posix_spawn.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f4cae1c6485e9f84d2e9c625ec334b96b1937737
---

 modules/audio_output/alsa.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 1594b7f..28d3102 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -45,6 +45,7 @@
 #define ALSA_PCM_NEW_HW_PARAMS_API
 #define ALSA_PCM_NEW_SW_PARAMS_API
 #include <alsa/asoundlib.h>
+#include <alsa/version.h>
 
 /*#define ALSA_DEBUG*/
 
@@ -261,10 +262,24 @@ static void Probe( aout_instance_t * p_aout,
     }
 
     var_Change( p_aout, "audio-device", VLC_VAR_CHOICESCOUNT, &val, NULL );
+#if (SND_LIB_VERSION <= 0x010015)
+# warning Please update alsa-lib to version > 1.0.21a.
+    var_Create( p_aout->p_libvlc, "alsa-working", VLC_VAR_BOOL );
+    if( val.i_int <= 0 )
+    {
+        if( var_GetBool( p_aout->p_libvlc, "alsa-working" ) )
+            dialog_FatalWait( p_aout, "ALSA version problem",
+                "VLC failed to re-open your sound card.\n"
+                "Please update alsa-lib to version 1.0.22 or higher "
+                "to fix this issue." );
+    }
+    else
+        var_SetBool( p_aout->p_libvlc, "alsa-working", true );
+#endif
     if( val.i_int <= 0 )
     {
         /* Probe() has failed. */
-        msg_Dbg( p_aout, "failed to find a usable alsa configuration" );
+        msg_Dbg( p_aout, "failed to find a usable ALSA configuration" );
         var_Destroy( p_aout, "audio-device" );
         return;
     }




More information about the vlc-devel mailing list