summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2009-08-12 18:28:30 +0000
committerJeffrey Goode <jeffg7@gmail.com>2009-08-12 18:28:30 +0000
commitd5592a671033c386c7c354338f61a93507e9d467 (patch)
tree0653d2466a9d89433fa71a85f2f5eb501f167387 /apps/plugins/mpegplayer
parent0dc2fb576045e73876973b9ac4f8a9434aa7e68e (diff)
downloadrockbox-d5592a671033c386c7c354338f61a93507e9d467.zip
rockbox-d5592a671033c386c7c354338f61a93507e9d467.tar.gz
rockbox-d5592a671033c386c7c354338f61a93507e9d467.tar.bz2
rockbox-d5592a671033c386c7c354338f61a93507e9d467.tar.xz
FS#10504: Make mpegplayer audio thread use correct sample count
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22280 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer')
-rw-r--r--apps/plugins/mpegplayer/audio_thread.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c
index a901b72..d04257a 100644
--- a/apps/plugins/mpegplayer/audio_thread.c
+++ b/apps/plugins/mpegplayer/audio_thread.c
@@ -643,8 +643,8 @@ static void audio_thread(void)
struct pcm_frame_header *dst_hdr = pcm_output_get_buffer();
const char *src[2] =
{ (char *)synth.pcm.samples[0], (char *)synth.pcm.samples[1] };
- int out_count = (synth.pcm.length * CLOCK_RATE
- + (td.samplerate - 1)) / td.samplerate;
+ int out_count = rb->dsp_output_count(td.dsp, (synth.pcm.length *
+ CLOCK_RATE + (td.samplerate - 1)) / td.samplerate);
ssize_t size = sizeof(*dst_hdr) + out_count*4;
/* Wait for required amount of free buffer space */
@@ -657,8 +657,17 @@ static void audio_thread(void)
goto message_process;
}
+ int inp_count = rb->dsp_input_count(td.dsp, out_count);
+
+ if (inp_count <= 0)
+ break;
+
+ /* Input size has grown, no error, just don't write more than length */
+ if (inp_count > synth.pcm.length)
+ inp_count = synth.pcm.length;
+
out_count = rb->dsp_process(td.dsp, dst_hdr->data, src,
- synth.pcm.length);
+ inp_count);
if (out_count <= 0)
break;