Prevent arithmetic overflow after 2^32 microseconds, i.e. about one hoour and 11 minutes...
This commit is contained in:
+1
-2
@@ -910,8 +910,7 @@ static void play(void *buf, int samples) {
|
||||
}
|
||||
frame_index = 0; // we'll be starting over
|
||||
measurement_data_is_valid = 0;
|
||||
}
|
||||
if ((snd_pcm_state(alsa_handle) == SND_PCM_STATE_PREPARED) ||
|
||||
} else if ((snd_pcm_state(alsa_handle) == SND_PCM_STATE_PREPARED) ||
|
||||
(snd_pcm_state(alsa_handle) == SND_PCM_STATE_RUNNING)) {
|
||||
if (buf == NULL)
|
||||
debug(1, "NULL buffer passed to pcm_writei -- skipping it");
|
||||
|
||||
@@ -2301,10 +2301,7 @@ void *player_thread_func(void *arg) {
|
||||
uint64_t elapsed_play_time, frames_played;
|
||||
conn->frame_rate_status = config.output->rate_info(&elapsed_play_time,&frames_played);
|
||||
if (conn->frame_rate_status==0) {
|
||||
uint64_t elapsed_play_time_microseconds_fp, elapsed_play_time_microseconds;
|
||||
elapsed_play_time_microseconds_fp = elapsed_play_time * 1000000;
|
||||
elapsed_play_time_microseconds = elapsed_play_time_microseconds_fp >> 32;
|
||||
conn->frame_rate = frames_played*1000000.0/elapsed_play_time_microseconds;
|
||||
conn->frame_rate = 1.0*(frames_played*(uint64_t)0x100000000)/elapsed_play_time;
|
||||
}
|
||||
}
|
||||
inform(
|
||||
|
||||
Reference in New Issue
Block a user