Add code to check divisions and mods for a potrntial divide by zero problem. MAy cause SPS to terminate but leave a log message.

This commit is contained in:
Mike Brady
2021-11-21 21:47:32 +00:00
parent 881a5ca25e
commit 14bfba2724
10 changed files with 208 additions and 131 deletions
+7
View File
@@ -204,12 +204,19 @@ static int init(int argc, char **argv) {
framesize = par.bps * par.pchan;
config.output_rate = par.rate;
if (par.rate == 0) {
die("sndio: par.rate set to zero.");
}
config.audio_backend_buffer_desired_length = 1.0 * par.bufsz / par.rate;
config.audio_backend_latency_offset = 0;
sio_onmove(hdl, onmove_cb, NULL);
pthread_mutex_unlock(&sndio_mutex);
if (framesize == 0) {
die("sndio: framesize set to zero.");
}
return 0;
}