pcmbuf: bug fix with pcmbuf flush, code cleanup, added comments

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23608 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jeffrey Goode 2009-11-11 07:02:18 +00:00
parent db4cab0e66
commit 0db3308cb5
4 changed files with 64 additions and 68 deletions

View file

@ -168,7 +168,7 @@ static void* codec_get_buffer(size_t *size)
return &codecbuf[codec_size];
}
static bool codec_pcmbuf_insert_callback(
static void codec_pcmbuf_insert_callback(
const void *ch1, const void *ch2, int count)
{
const char *src[2] = { ch1, ch2 };
@ -181,14 +181,14 @@ static bool codec_pcmbuf_insert_callback(
/* Prevent audio from a previous track from playing */
if (ci.new_track || ci.stop_codec)
return true;
return;
while ((dest = pcmbuf_request_buffer(&out_count)) == NULL)
{
cancel_cpu_boost();
sleep(1);
if (ci.seek_time || ci.new_track || ci.stop_codec)
return true;
return;
}
/* Get the real input_size for output_size bytes, guarding
@ -196,7 +196,7 @@ static bool codec_pcmbuf_insert_callback(
inp_count = dsp_input_count(ci.dsp, out_count);
if (inp_count <= 0)
return true;
return;
/* Input size has grown, no error, just don't write more than length */
if (inp_count > count)
@ -205,14 +205,12 @@ static bool codec_pcmbuf_insert_callback(
out_count = dsp_process(ci.dsp, dest, src, inp_count);
if (out_count <= 0)
return true;
return;
pcmbuf_write_complete(out_count);
count -= inp_count;
}
return true;
} /* codec_pcmbuf_insert_callback */
static void codec_set_elapsed_callback(unsigned long value)