diff options
author | Andy Hung <hunga@google.com> | 2015-09-21 12:44:54 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2015-10-13 12:17:53 -0700 |
commit | 4c6e77ff8e18a1551320a6b42f6a45e19dcce748 (patch) | |
tree | 97d86a674d1cecec6da60dfb0ec0c2eae1e2b644 /services/audioflinger/FastCapture.cpp | |
parent | 5076a51e0572246f7062e48761766c01f17233c2 (diff) | |
download | frameworks_av-4c6e77ff8e18a1551320a6b42f6a45e19dcce748.zip frameworks_av-4c6e77ff8e18a1551320a6b42f6a45e19dcce748.tar.gz frameworks_av-4c6e77ff8e18a1551320a6b42f6a45e19dcce748.tar.bz2 |
AudioFlinger: Clear record buffers when starting RecordThread
Bug: 24211743
Bug: 24267152
Change-Id: I58c55e56b85067b71e4e300f947b4dfc159637ba
Diffstat (limited to 'services/audioflinger/FastCapture.cpp')
-rw-r--r-- | services/audioflinger/FastCapture.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/audioflinger/FastCapture.cpp b/services/audioflinger/FastCapture.cpp index 79ac12b..1bba5f6 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 |