From 598bbcd1f72d84ffd3da0cdd429a8b0cd5d21f15 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Thu, 5 Nov 2009 10:18:23 +0100 Subject: [PATCH] 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. --- src/core/audio/AudioPulseAudio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/audio/AudioPulseAudio.cpp b/src/core/audio/AudioPulseAudio.cpp index 03edd6612..0e6ea6871 100644 --- a/src/core/audio/AudioPulseAudio.cpp +++ b/src/core/audio/AudioPulseAudio.cpp @@ -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 ); }