Browse Source

[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
tags/0.120.1
torben 16 years ago
parent
commit
b26335d4c1
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      tools/alsa_in.c
  2. +2
    -2
      tools/alsa_out.c

+ 2
- 2
tools/alsa_in.c View File

@@ -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));


+ 2
- 2
tools/alsa_out.c View File

@@ -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));


Loading…
Cancel
Save