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/Threads.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/Threads.cpp')
-rw-r--r-- | services/audioflinger/Threads.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 0a7d4a2..246f6ba 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -6926,6 +6926,7 @@ void AudioFlinger::RecordThread::readInputParameters_l() mRsmpInFrames = mFrameCount * 7; mRsmpInFramesP2 = roundup(mRsmpInFrames); free(mRsmpInBuffer); + mRsmpInBuffer = NULL; // TODO optimize audio capture buffer sizes ... // Here we calculate the size of the sliding buffer used as a source @@ -6935,7 +6936,9 @@ void AudioFlinger::RecordThread::readInputParameters_l() // The current value is higher than necessary. However it should not add to latency. // Over-allocate beyond mRsmpInFramesP2 to permit a HAL read past end of buffer - (void)posix_memalign(&mRsmpInBuffer, 32, (mRsmpInFramesP2 + mFrameCount - 1) * mFrameSize); + size_t bufferSize = (mRsmpInFramesP2 + mFrameCount - 1) * mFrameSize; + (void)posix_memalign(&mRsmpInBuffer, 32, bufferSize); + memset(mRsmpInBuffer, 0, bufferSize); // if posix_memalign fails, will segv here. // AudioRecord mSampleRate and mChannelCount are constant due to AudioRecord API constraints. // But if thread's mSampleRate or mChannelCount changes, how will that affect active tracks? |