Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9648e4b6 authored by Eric Laurent's avatar Eric Laurent
Browse files

fix issue 1641535: SoundPool should use AudioTrack with shared memory buffer

Enabled USE_SHARED_MEM_BUFFER switch in SoundPool.cpp
parent 05d24afb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@
#define LOG_TAG "SoundPool"
#include <utils/Log.h>

//#define USE_SHARED_MEM_BUFFER
//
#define USE_SHARED_MEM_BUFFER

// XXX needed for timing latency
#include <utils/Timers.h>
@@ -507,10 +508,12 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV
        frameCount = sample->size()/numChannels/((sample->format() == AudioSystem::PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t));
    }

#ifndef USE_SHARED_MEM_BUFFER
    // Ensure minimum audio buffer size in case of short looped sample
    if(frameCount < kDefaultBufferCount * bufferFrames) {
        frameCount = kDefaultBufferCount * bufferFrames;
    }
#endif

    AudioTrack* newTrack;