AudioPulseAudio: alloc pcmbuf via CPU class

In AudioPulseAudio::streamWriteCallback() we're operating on pcmbuf
via an operation from CPU class. All methods of CPU assume the buffer
being aligned on 16 byte boundaries. However pa_xmalloc() & friends do
not allocate aligned memory which resulted in a crash when calling
CPU::convertToS16() (SSE2 version takes advantage of aligned memory).

Replacing pa_xmalloc()/pa_xfree() with CPU::memAlloc()/CPU::memFree()
fixes this crash.

Closes bug #2890465.
This commit is contained in:
Tobias Doerffel
2009-11-05 10:18:23 +01:00
parent 66f0ca60e2
commit 598bbcd1f7

View File

@@ -230,7 +230,7 @@ void AudioPulseAudio::streamWriteCallback(pa_stream *s, size_t length)
{
const fpp_t fpp = getMixer()->framesPerPeriod();
sampleFrameA * temp = CPU::allocFrames( fpp );
Sint16 * pcmbuf = (Sint16*)pa_xmalloc( fpp * channels() *
Sint16 * pcmbuf = (Sint16*)CPU::memAlloc( fpp * channels() *
sizeof(Sint16) );
size_t fd = 0;
@@ -254,7 +254,7 @@ void AudioPulseAudio::streamWriteCallback(pa_stream *s, size_t length)
fd += frames;
}
pa_xfree( pcmbuf );
CPU::memFree( pcmbuf );
CPU::freeFrames( temp );
}