mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-11 18:46:41 -04:00
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:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user