From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Re: [alsa-cvslog] CVS: alsa-kernel/core/oss pcm_oss.c,1.87,1.88 Date: Fri, 27 May 2005 11:32:55 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mx1.suse.de (ns1.suse.de [195.135.220.2]) by alsa.jcu.cz (ALSA's E-mail Delivery System) with ESMTP id 3B263209 for ; Fri, 27 May 2005 11:33:00 +0200 (MEST) In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Clemens Ladisch Cc: Jaroslav Kysela , ALSA development List-Id: alsa-devel@alsa-project.org At Fri, 27 May 2005 11:23:17 +0200 (METDST), Clemens Ladisch wrote: > > > 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(). > > > > 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); > > } > > This still uses a misleading type for buffer_size, and uses 'frames' > for a value not measure in frames. I think I'd better rename these. > Any objections? I second. Takashi ------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005