1
0
Fork 0

(svn r18829) -Codechange: Don't free memory from within audio mixer callback handler as it may be required to be real-time safe.

release/1.0
peter1138 2010-01-16 17:47:26 +00:00
parent 6101ad8396
commit 711dea210b
1 changed files with 3 additions and 4 deletions

View File

@ -141,9 +141,7 @@ static void mix_int8_to_int16(MixerChannel *sc, int16 *buffer, uint samples)
static void MxCloseChannel(MixerChannel *mc) static void MxCloseChannel(MixerChannel *mc)
{ {
free(mc->memory);
mc->active = false; mc->active = false;
mc->memory = NULL;
} }
void MxMixSamples(void *buffer, uint samples) void MxMixSamples(void *buffer, uint samples)
@ -170,8 +168,9 @@ MixerChannel *MxAllocateChannel()
{ {
MixerChannel *mc; MixerChannel *mc;
for (mc = _channels; mc != endof(_channels); mc++) for (mc = _channels; mc != endof(_channels); mc++)
if (mc->memory == NULL) { if (!mc->active) {
mc->active = false; free(mc->memory);
mc->memory = NULL;
return mc; return mc;
} }
return NULL; return NULL;