Fixed iriver cpu boosting problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7410 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d682b73749
commit
29aad55d97
3 changed files with 24 additions and 6 deletions
|
@ -93,7 +93,7 @@ void (*pcmbuf_watermark_event)(int bytes_left);
|
||||||
static int last_chunksize;
|
static int last_chunksize;
|
||||||
static long mixpos = 0;
|
static long mixpos = 0;
|
||||||
|
|
||||||
static void pcmbuf_boost(bool state)
|
void pcmbuf_boost(bool state)
|
||||||
{
|
{
|
||||||
static bool boost_state = false;
|
static bool boost_state = false;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ bool pcmbuf_add_chunk(void *addr, int size, void (*callback)(void));
|
||||||
int pcmbuf_num_used_buffers(void);
|
int pcmbuf_num_used_buffers(void);
|
||||||
void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left));
|
void pcmbuf_set_watermark(int numbytes, void (*callback)(int bytes_left));
|
||||||
|
|
||||||
|
void pcmbuf_boost(bool state);
|
||||||
void pcmbuf_set_boost_mode(bool state);
|
void pcmbuf_set_boost_mode(bool state);
|
||||||
bool pcmbuf_is_lowdata(void);
|
bool pcmbuf_is_lowdata(void);
|
||||||
void pcmbuf_flush_audio(void);
|
void pcmbuf_flush_audio(void);
|
||||||
|
|
|
@ -131,6 +131,7 @@ static struct mp3entry id3_voice;
|
||||||
static char *voicebuf;
|
static char *voicebuf;
|
||||||
static int voice_remaining;
|
static int voice_remaining;
|
||||||
static bool voice_is_playing;
|
static bool voice_is_playing;
|
||||||
|
static bool voice_cpu_boosted = false;
|
||||||
static void (*voice_getmore)(unsigned char** start, int* size);
|
static void (*voice_getmore)(unsigned char** start, int* size);
|
||||||
|
|
||||||
/* Is file buffer currently being refilled? */
|
/* Is file buffer currently being refilled? */
|
||||||
|
@ -254,6 +255,17 @@ static void swap_codec(void)
|
||||||
logf("codec resuming:%d", current_codec);
|
logf("codec resuming:%d", current_codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void voice_boost_cpu(bool state)
|
||||||
|
{
|
||||||
|
if (state != voice_cpu_boosted)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
cpu_boost(state);
|
||||||
|
#endif
|
||||||
|
voice_cpu_boosted = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2,
|
bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2,
|
||||||
long length)
|
long length)
|
||||||
{
|
{
|
||||||
|
@ -306,9 +318,9 @@ bool codec_pcmbuf_insert_split_callback(void *ch1, void *ch2,
|
||||||
if (voice_is_playing && pcmbuf_usage() > 30
|
if (voice_is_playing && pcmbuf_usage() > 30
|
||||||
&& pcmbuf_mix_usage() < 20)
|
&& pcmbuf_mix_usage() < 20)
|
||||||
{
|
{
|
||||||
cpu_boost(true);
|
voice_boost_cpu(true);
|
||||||
swap_codec();
|
swap_codec();
|
||||||
cpu_boost(false);
|
voice_boost_cpu(false);
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
|
@ -436,8 +448,13 @@ void* voice_request_data(long *realsize, long reqsize)
|
||||||
{
|
{
|
||||||
swap_codec();
|
swap_codec();
|
||||||
}
|
}
|
||||||
if (!voice_is_playing)
|
else if (!voice_is_playing)
|
||||||
|
{
|
||||||
|
voice_boost_cpu(false);
|
||||||
|
if (!pcm_is_playing())
|
||||||
|
pcmbuf_boost(false);
|
||||||
sleep(HZ/16);
|
sleep(HZ/16);
|
||||||
|
}
|
||||||
|
|
||||||
if (voice_remaining)
|
if (voice_remaining)
|
||||||
{
|
{
|
||||||
|
@ -1277,11 +1294,11 @@ void initialize_buffer_fill(void)
|
||||||
fill_bytesleft = filebuflen - filebufused;
|
fill_bytesleft = filebuflen - filebufused;
|
||||||
cur_ti->start_pos = ci.curpos;
|
cur_ti->start_pos = ci.curpos;
|
||||||
|
|
||||||
pcmbuf_set_boost_mode(true);
|
|
||||||
|
|
||||||
if (filling)
|
if (filling)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
pcmbuf_set_boost_mode(true);
|
||||||
|
|
||||||
filling = true;
|
filling = true;
|
||||||
|
|
||||||
/* Calculate real track count after throwing away old tracks. */
|
/* Calculate real track count after throwing away old tracks. */
|
||||||
|
|
Loading…
Reference in a new issue