Zero out voice buffer memory immediately after allocation.
Can't wait for the voice thread to initialize it since it concievably could be moved before the voice thread actually does so and the move callback accesses data that must be first set up in the voice thread function. Change-Id: Ia0d09539854db85e132e09d26cb129f02f5d93ff
This commit is contained in:
parent
7909bf039f
commit
8bbd4d91a0
1 changed files with 14 additions and 8 deletions
|
@ -161,11 +161,18 @@ static int move_callback(int handle, void *current, void *new)
|
|||
/* Have to adjust the pointers that point into things in voice_buf */
|
||||
off_t diff = new - current;
|
||||
struct voice_thread_data *td = voice_buf->td;
|
||||
td->src.p32[0] = SKIPBYTES(td->src.p32[0], diff);
|
||||
td->src.p32[1] = SKIPBYTES(td->src.p32[1], diff);
|
||||
if (td->dst != NULL) /* Only when calling dsp_process */
|
||||
td->dst->p16out = SKIPBYTES(td->dst->p16out, diff);
|
||||
mixer_adjust_channel_address(PCM_MIXER_CHAN_VOICE, diff);
|
||||
|
||||
if (td != NULL)
|
||||
{
|
||||
td->src.p32[0] = SKIPBYTES(td->src.p32[0], diff);
|
||||
td->src.p32[1] = SKIPBYTES(td->src.p32[1], diff);
|
||||
|
||||
if (td->dst != NULL) /* Only when calling dsp_process */
|
||||
td->dst->p16out = SKIPBYTES(td->dst->p16out, diff);
|
||||
|
||||
mixer_adjust_channel_address(PCM_MIXER_CHAN_VOICE, diff);
|
||||
}
|
||||
|
||||
voice_buf = new;
|
||||
|
||||
return BUFLIB_CB_OK;
|
||||
|
@ -322,10 +329,7 @@ static void voice_data_init(struct voice_thread_data *td)
|
|||
dsp_configure(td->dsp, DSP_SET_STEREO_MODE, STEREO_MONO);
|
||||
|
||||
mixer_channel_set_amplitude(PCM_MIXER_CHAN_VOICE, MIX_AMP_UNITY);
|
||||
|
||||
voice_buf->frame_in = voice_buf->frame_out = 0;
|
||||
voice_buf->td = td;
|
||||
td->dst = NULL;
|
||||
}
|
||||
|
||||
/* Voice thread message processing */
|
||||
|
@ -536,6 +540,8 @@ void voice_thread_init(void)
|
|||
return;
|
||||
}
|
||||
|
||||
memset(voice_buf, 0, sizeof (*voice_buf));
|
||||
|
||||
logf("Starting voice thread");
|
||||
queue_init(&voice_queue, false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue