summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-07-17 21:02:40 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-07-17 21:02:40 +0000
commit2103cf4b74c25e7d199e28349e377c2edb9a7ec6 (patch)
treec2313f495be1914cfe7c7c6fce6706b10e470778 /firmware
parente9919342c558bc6b1f843bbc6e900c5ef540ee8f (diff)
downloadrockbox-2103cf4b74c25e7d199e28349e377c2edb9a7ec6.tar.gz
rockbox-2103cf4b74c25e7d199e28349e377c2edb9a7ec6.zip
Check that remaining bytes counter is not zero.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7183 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/pcm_playback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index fc7239bf86..da04795d80 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -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);