From b26335d4c1fc519d3c95eebbd832cd4d9d1140b4 Mon Sep 17 00:00:00 2001 From: torben Date: Sun, 13 Dec 2009 10:22:35 +0000 Subject: [PATCH] [alsa_io] fix overflow in time calculation, thanks to delYsid git-svn-id: svn+ssh://jackaudio.org/trunk/jack@3857 0c269be4-1314-0410-8aa9-9f06e86f4224 --- tools/alsa_in.c | 4 ++-- tools/alsa_out.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/alsa_in.c b/tools/alsa_in.c index ba29764..dbf3563 100644 --- a/tools/alsa_in.c +++ b/tools/alsa_in.c @@ -183,7 +183,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ } /* set the buffer time */ - buffer_time = 1000000*period*nperiods/rate; + buffer_time = 1000000*(uint64_t)period*nperiods/rate; err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); if (err < 0) { printf("Unable to set buffer time %i for playback: %s\n", 1000000*period*nperiods/rate, snd_strerror(err)); @@ -198,7 +198,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size ); } /* set the period time */ - period_time = 1000000*period/rate; + period_time = 1000000*(uint64_t)period/rate; err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); if (err < 0) { printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err)); diff --git a/tools/alsa_out.c b/tools/alsa_out.c index 6d7e097..abfd431 100644 --- a/tools/alsa_out.c +++ b/tools/alsa_out.c @@ -182,7 +182,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ } /* set the buffer time */ - buffer_time = 1000000*period*nperiods/rate; + buffer_time = 1000000*(uint64_t)period*nperiods/rate; err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); if (err < 0) { printf("Unable to set buffer time %i for playback: %s\n", 1000000*period*nperiods/rate, snd_strerror(err)); @@ -197,7 +197,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_ printf( "WARNING: buffer size does not match: (requested %d, got %d)\n", nperiods * period, (int) real_buffer_size ); } /* set the period time */ - period_time = 1000000*period/rate; + period_time = 1000000*(uint64_t)period/rate; err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); if (err < 0) { printf("Unable to set period time %i for playback: %s\n", 1000000*period/rate, snd_strerror(err));