forked from len0rd/rockbox
Turnaround time must be included in dsp yielding to throttle against other threads. Do at least one per buffer full as well (or things can stick a bit on initial input triggers).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16721 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0b3f241187
commit
d3ecbbf988
1 changed files with 9 additions and 3 deletions
12
apps/dsp.c
12
apps/dsp.c
|
@ -1112,7 +1112,8 @@ int dsp_callback(int msg, intptr_t param)
|
||||||
int dsp_process(struct dsp_config *dsp, char *dst, const char *src[], int count)
|
int dsp_process(struct dsp_config *dsp, char *dst, const char *src[], int count)
|
||||||
{
|
{
|
||||||
int32_t *tmp[2];
|
int32_t *tmp[2];
|
||||||
long last_yield = current_tick;
|
static long last_yield;
|
||||||
|
long tick;
|
||||||
int written = 0;
|
int written = 0;
|
||||||
int samples;
|
int samples;
|
||||||
|
|
||||||
|
@ -1126,6 +1127,10 @@ int dsp_process(struct dsp_config *dsp, char *dst, const char *src[], int count)
|
||||||
if (new_gain)
|
if (new_gain)
|
||||||
dsp_set_replaygain(); /* Gain has changed */
|
dsp_set_replaygain(); /* Gain has changed */
|
||||||
|
|
||||||
|
/* Perform at least one yield before starting */
|
||||||
|
last_yield = current_tick;
|
||||||
|
yield();
|
||||||
|
|
||||||
/* Testing function pointers for NULL is preferred since the pointer
|
/* Testing function pointers for NULL is preferred since the pointer
|
||||||
will be preloaded to be used for the call if not. */
|
will be preloaded to be used for the call if not. */
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
|
@ -1162,10 +1167,11 @@ int dsp_process(struct dsp_config *dsp, char *dst, const char *src[], int count)
|
||||||
dst += samples * sizeof (int16_t) * 2;
|
dst += samples * sizeof (int16_t) * 2;
|
||||||
|
|
||||||
/* yield at least once each tick */
|
/* yield at least once each tick */
|
||||||
if (current_tick > last_yield)
|
tick = current_tick;
|
||||||
|
if (TIME_AFTER(tick, last_yield))
|
||||||
{
|
{
|
||||||
|
last_yield = tick;
|
||||||
yield();
|
yield();
|
||||||
last_yield = current_tick;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue