[ALSA] Reverted last patch for SNDCTL_DSP_GETOPTR fix & possible overflow fix
authorJaroslav Kysela <perex@suse.cz>
Fri, 27 May 2005 08:07:06 +0000 (10:07 +0200)
committerJaroslav Kysela <perex@suse.cz>
Sun, 29 May 2005 08:15:03 +0000 (10:15 +0200)
ALSA<-OSS emulation
This reverts the last patch which wrongly mixes bytes and frames.
The real culprit might be the 32-bit overflow, so the return expression uses
64-bit values now in snd_pcm_oss_bytes().

Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/core/oss/pcm_oss.c

index 6f90dbb7680465b2c4f169ac093c0f174a256a65..a293982bdd210aceb25ac8e7dad31fd7451e2e57 100644 (file)
@@ -124,13 +124,12 @@ int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin)
 
 static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames)
 {
-       long bytes = 0;
        snd_pcm_runtime_t *runtime = substream->runtime;
        snd_pcm_uframes_t buffer_size = snd_pcm_lib_buffer_bytes(substream);
-       bytes = frames_to_bytes(runtime, frames);
+       frames = frames_to_bytes(runtime, frames);
        if (buffer_size == runtime->oss.buffer_bytes)
-               return bytes;
-       return (runtime->oss.buffer_bytes * frames) / buffer_size;
+               return frames;
+       return (long)(((int64_t)runtime->oss.buffer_bytes * (int64_t)frames) / (int64_t)buffer_size);
 }
 
 static long snd_pcm_alsa_frames(snd_pcm_substream_t *substream, long bytes)