1
0
Fork 0
forked from len0rd/rockbox

Check that remaining bytes counter is not zero.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7183 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2005-07-17 21:02:40 +00:00
parent e9919342c5
commit 2103cf4b74

View file

@ -101,7 +101,7 @@ static long calculate_channel_peak_average(int channel, unsigned short *addr,
addr = &addr[channel];
average = 0;
if (pcm_playing && !pcm_paused && addr != NULL)
if (pcm_playing && !pcm_paused && addr != NULL && size)
{
/* Calculate the zero point and remove DC offset (should be around 32768) */
zero_point = 0;
@ -164,7 +164,7 @@ static long calculate_channel_peak_average(int channel, unsigned short *addr,
void pcm_calculate_peaks(int *left, int *right)
{
unsigned short *addr = (unsigned short *)SAR0;
long size = MIN(512, BCR0);
long size = MIN(512, BCR0 / 2);
if (left != NULL)
*left = calculate_channel_peak_average(0, addr, size);