Victor Lazzarini victor.lazzar...@nuim.ie writes:
I guess the problem is that none of the right side variables/constant
is unsigned in:
unsigned buffer_time = 100*period*nperiods/rate;
so regardless of storing it in an unsigned, it overflows before you
try to store it, and so it
Hi.
I just happened to stumble about a (what I call) pretty subtle
bug in typical ALSA PCM code:
r...@fzidpc73:/tmp# cat test.c
#include stdio.h
int main() {
int period = 1024;
int nperiods = 3;
int rate = 96000;
unsigned buffer_time = 100*period*nperiods/rate;
printf(%d\n,
I guess the problem is that none of the right side variables/constant
is unsigned in:
unsigned buffer_time = 100*period*nperiods/rate;
so regardless of storing it in an unsigned, it overflows before you
try to store it, and so it messes up everything.
Note that you could also prevent