Loading media/jni/soundpool/SoundPool.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -501,7 +501,8 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV } int numChannels = sample->numChannels(); uint32_t sampleRate = uint32_t(float(sample->sampleRate()) * rate + 0.5); uint32_t bufferFrames = (afFrameCount * sampleRate) / afSampleRate; uint32_t totalFrames = (kDefaultBufferCount * afFrameCount * sampleRate) / afSampleRate; uint32_t bufferFrames = (totalFrames + (kDefaultBufferCount - 1)) / kDefaultBufferCount; uint32_t frameCount = 0; if (loop) { Loading @@ -510,8 +511,8 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV #ifndef USE_SHARED_MEM_BUFFER // Ensure minimum audio buffer size in case of short looped sample if(frameCount < kDefaultBufferCount * bufferFrames) { frameCount = kDefaultBufferCount * bufferFrames; if(frameCount < totalFrames) { frameCount = totalFrames; } #endif Loading Loading
media/jni/soundpool/SoundPool.cpp +6 −5 Original line number Diff line number Diff line Loading @@ -501,7 +501,8 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV } int numChannels = sample->numChannels(); uint32_t sampleRate = uint32_t(float(sample->sampleRate()) * rate + 0.5); uint32_t bufferFrames = (afFrameCount * sampleRate) / afSampleRate; uint32_t totalFrames = (kDefaultBufferCount * afFrameCount * sampleRate) / afSampleRate; uint32_t bufferFrames = (totalFrames + (kDefaultBufferCount - 1)) / kDefaultBufferCount; uint32_t frameCount = 0; if (loop) { Loading @@ -510,8 +511,8 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV #ifndef USE_SHARED_MEM_BUFFER // Ensure minimum audio buffer size in case of short looped sample if(frameCount < kDefaultBufferCount * bufferFrames) { frameCount = kDefaultBufferCount * bufferFrames; if(frameCount < totalFrames) { frameCount = totalFrames; } #endif Loading