Hi all!
Le lundi 27 septembre 2010 14:02:17, Peter Retep a écrit :
> I found out a workaround:
> If you use pulseaudio as input source, liquidsoap won't shutdown (if you
> define a fallback for your input source).
> The problem is not solved by it and you might have a short timed
> fallback when the ALSA error occurs,
> but pulseaudio seems to wrap this and liquidsoap reconnects to
> pulseaudio input.
> We are using this for several days without seeing any
> alsa.unknown_errors anymore.
I have been thinking about this issue. The huge number associated to the
exception makes me suspect an int overflow: in the ocaml's binding for alsa, we
cast the returned value of the read/write functions to an int while it is in
fact defined as a long.
However, the requested number of frames is also an int so there should be no
reason for this to happen, but its not excluded that there is another bug
somewhere..
So, here is a list of possible things to do to figure out this bug
* Get a backtrace of the exception. It would help us a lot to find out which
function is ocaml-alsa returns this exception. This can be done by either
compiling with --enable-debugging or using our .deb packages.
* Tell us whether your use pure alsa or pulseaudio's alsa emulation.
* Try the attached patch, which may fix the error if my suspicions are
correct.
Thanks for your help,
Romain
Index: alsa_stubs.c
===================================================================
--- alsa_stubs.c (révision 7697)
+++ alsa_stubs.c (copie de travail)
@@ -114,7 +114,11 @@
return ans;
}
-static void check_for_err(int ret)
+/* Here, we use the type snd_pcm_sframes_t
+ * which is long usually and makes sure we
+ * avoid long to int overflow in the read/write
+ * function's return value. */
+static void check_for_err(snd_pcm_sframes_t ret)
{
if (ret >= 0)
return;
@@ -296,7 +300,7 @@
int ofs = Int_val(ofs_);
snd_pcm_t *handle = Pcm_handle_val(handle_);
char *buf;
- int ret;
+ snd_pcm_sframes_t ret;
if (ofs + len * Frame_size_val(handle_) > caml_string_length(dbuf))
caml_invalid_argument("buffer");
@@ -320,7 +324,7 @@
int ofs = Int_val(ofs_);
snd_pcm_t *handle = Pcm_handle_val(handle_);
char *buf;
- int ret;
+ snd_pcm_sframes_t ret;
if (ofs + len * Frame_size_val(handle_) > caml_string_length(sbuf))
caml_invalid_argument("buffer");
@@ -346,7 +350,7 @@
snd_pcm_t *handle = Pcm_handle_val(handle_);
char **buf;
int c;
- int ret;
+ snd_pcm_sframes_t ret;
/* TODO: check the size of dbuf */
buf = malloc(chans * sizeof(char*));
@@ -377,7 +381,7 @@
snd_pcm_t *handle = Pcm_handle_val(handle_);
char **buf;
int c;
- int ret;
+ snd_pcm_sframes_t ret;
/* TODO: check the size of sbuf */
buf = malloc(chans * sizeof(char*));
@@ -408,7 +412,7 @@
snd_pcm_t *handle = Pcm_handle_val(handle_);
float **buf;
int c, i;
- int ret;
+ snd_pcm_sframes_t ret;
/* TODO: check the size of dbuf */
buf = malloc(chans * sizeof(float*));
@@ -440,7 +444,7 @@
snd_pcm_t *handle = Pcm_handle_val(handle_);
float **buf;
int c, i;
- int ret;
+ snd_pcm_sframes_t ret;
/* TODO: check the size of fbuf */
buf = malloc(chans * sizeof(float*));
@@ -472,7 +476,7 @@
snd_pcm_t *handle = Pcm_handle_val(handle_);
double **buf;
int c, i;
- int ret;
+ snd_pcm_sframes_t ret;
/* TODO: check the size of fbuf */
buf = malloc(chans * sizeof(double*));
@@ -504,7 +508,7 @@
snd_pcm_t *handle = Pcm_handle_val(handle_);
double **buf;
int c, i;
- int ret;
+ snd_pcm_sframes_t ret;
/* TODO: check the size of fbuf */
buf = malloc(chans * sizeof(double*));
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users