From a7fb77d6eca56e61e94f62e7deb4120b60b1e919 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 10 May 2010 23:50:54 -0700 Subject: Upstream: integrate timer/clock management changes. Change-Id: I24acbdebe58d207352548f54dda1abf5be01e7d4 --- audio/audio.c | 3 ++- audio/noaudio.c | 5 +++-- audio/wavaudio.c | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'audio') diff --git a/audio/audio.c b/audio/audio.c index 2d77f14..1980450 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1990,7 +1990,8 @@ static void audio_init (void) } conf.period.ticks = 1; } else { - conf.period.ticks = ticks_per_sec / conf.period.hertz; + conf.period.ticks = + muldiv64 (1, get_ticks_per_sec (), conf.period.hertz); } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); diff --git a/audio/noaudio.c b/audio/noaudio.c index 7451653..0209edb 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -53,7 +53,7 @@ static int no_run_out (HWVoiceOut *hw) now = qemu_get_clock (vm_clock); ticks = now - no->old_ticks; - bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; + bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); bytes = audio_MIN (bytes, INT_MAX); samples = bytes >> hw->info.shift; @@ -109,7 +109,8 @@ static int no_run_in (HWVoiceIn *hw) if (dead) { int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - no->old_ticks; - int64_t bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; + int64_t bytes = + muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); no->old_ticks = now; bytes = audio_MIN (bytes, INT_MAX); diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 6f2cc54..a82997e 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -63,7 +63,8 @@ static int wav_out_run (HWVoiceOut *hw) struct st_sample *src; int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - wav->old_ticks; - int64_t bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; + int64_t bytes = + muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); if (bytes > INT_MAX) { samples = INT_MAX >> hw->info.shift; @@ -355,7 +356,7 @@ static int wav_in_run (HWVoiceIn *hw) int64_t now = qemu_get_clock (vm_clock); int64_t ticks = now - wav->old_ticks; - int64_t bytes = (ticks * hw->info.bytes_per_second) / ticks_per_sec; + int64_t bytes = muldiv64(ticks, hw->info.bytes_per_second, get_ticks_per_sec()); if (bytes > INT_MAX) { samples = INT_MAX >> hw->info.shift; -- cgit v1.1