diff options
Diffstat (limited to 'apps/plugins/mpegplayer/audio_thread.c')
-rw-r--r-- | apps/plugins/mpegplayer/audio_thread.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c index a901b721d8..d04257ac30 100644 --- a/apps/plugins/mpegplayer/audio_thread.c +++ b/apps/plugins/mpegplayer/audio_thread.c | |||
@@ -643,8 +643,8 @@ static void audio_thread(void) | |||
643 | struct pcm_frame_header *dst_hdr = pcm_output_get_buffer(); | 643 | struct pcm_frame_header *dst_hdr = pcm_output_get_buffer(); |
644 | const char *src[2] = | 644 | const char *src[2] = |
645 | { (char *)synth.pcm.samples[0], (char *)synth.pcm.samples[1] }; | 645 | { (char *)synth.pcm.samples[0], (char *)synth.pcm.samples[1] }; |
646 | int out_count = (synth.pcm.length * CLOCK_RATE | 646 | int out_count = rb->dsp_output_count(td.dsp, (synth.pcm.length * |
647 | + (td.samplerate - 1)) / td.samplerate; | 647 | CLOCK_RATE + (td.samplerate - 1)) / td.samplerate); |
648 | ssize_t size = sizeof(*dst_hdr) + out_count*4; | 648 | ssize_t size = sizeof(*dst_hdr) + out_count*4; |
649 | 649 | ||
650 | /* Wait for required amount of free buffer space */ | 650 | /* Wait for required amount of free buffer space */ |
@@ -657,8 +657,17 @@ static void audio_thread(void) | |||
657 | goto message_process; | 657 | goto message_process; |
658 | } | 658 | } |
659 | 659 | ||
660 | int inp_count = rb->dsp_input_count(td.dsp, out_count); | ||
661 | |||
662 | if (inp_count <= 0) | ||
663 | break; | ||
664 | |||
665 | /* Input size has grown, no error, just don't write more than length */ | ||
666 | if (inp_count > synth.pcm.length) | ||
667 | inp_count = synth.pcm.length; | ||
668 | |||
660 | out_count = rb->dsp_process(td.dsp, dst_hdr->data, src, | 669 | out_count = rb->dsp_process(td.dsp, dst_hdr->data, src, |
661 | synth.pcm.length); | 670 | inp_count); |
662 | 671 | ||
663 | if (out_count <= 0) | 672 | if (out_count <= 0) |
664 | break; | 673 | break; |