summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastCapture.cpp
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-07 18:45:35 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-07 18:45:35 -0800
commit697a7ab8c538ca84a92b605e50824da1cbf9b466 (patch)
treefe32b5c0b8e0fa115cd6358c5428b8a48e285dec /services/audioflinger/FastCapture.cpp
parent7f8512331f105565054202486fa0a6094ad693c1 (diff)
parent5dc9ffe50ef517591b8ffad66c7e4d6ec82b8b4b (diff)
downloadframeworks_av-697a7ab8c538ca84a92b605e50824da1cbf9b466.zip
frameworks_av-697a7ab8c538ca84a92b605e50824da1cbf9b466.tar.gz
frameworks_av-697a7ab8c538ca84a92b605e50824da1cbf9b466.tar.bz2
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/frameworks/av into cm-13.0
Android 6.0.1 release 3 Change-Id: I2f2a1fe1b58c828e8341556996211562d6e195ab
Diffstat (limited to 'services/audioflinger/FastCapture.cpp')
-rw-r--r--services/audioflinger/FastCapture.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/services/audioflinger/FastCapture.cpp b/services/audioflinger/FastCapture.cpp
index 04ed08f..2493fb7 100644
--- a/services/audioflinger/FastCapture.cpp
+++ b/services/audioflinger/FastCapture.cpp
@@ -131,7 +131,9 @@ void FastCapture::onStateChange()
// FIXME new may block for unbounded time at internal mutex of the heap
// implementation; it would be better to have normal capture thread allocate for
// us to avoid blocking here and to prevent possible priority inversion
- (void)posix_memalign(&mReadBuffer, 32, frameCount * Format_frameSize(mFormat));
+ size_t bufferSize = frameCount * Format_frameSize(mFormat);
+ (void)posix_memalign(&mReadBuffer, 32, bufferSize);
+ memset(mReadBuffer, 0, bufferSize); // if posix_memalign fails, will segv here.
mPeriodNs = (frameCount * 1000000000LL) / mSampleRate; // 1.00
mUnderrunNs = (frameCount * 1750000000LL) / mSampleRate; // 1.75
mOverrunNs = (frameCount * 500000000LL) / mSampleRate; // 0.50