diff options
author | Glenn Kasten <gkasten@google.com> | 2015-10-14 20:44:40 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-10-14 20:44:40 +0000 |
commit | 1f42a6cc1edd96030478a8bc1e05a0ff7710e539 (patch) | |
tree | bd3201353b9cc3582c32f9960817123c546c976b | |
parent | 9d1bc9f252edae3a31decf5c18e971c6ab424b26 (diff) | |
parent | c57ad1ed177ab58ae759a5054d8a14a306715f85 (diff) | |
download | frameworks_av-1f42a6cc1edd96030478a8bc1e05a0ff7710e539.zip frameworks_av-1f42a6cc1edd96030478a8bc1e05a0ff7710e539.tar.gz frameworks_av-1f42a6cc1edd96030478a8bc1e05a0ff7710e539.tar.bz2 |
am c57ad1ed: am 55d1ea47: Merge "DO NOT MERGE - AudioFlinger: Clear record buffers when starting RecordThread" into lmp-dev
* commit 'c57ad1ed177ab58ae759a5054d8a14a306715f85':
DO NOT MERGE - AudioFlinger: Clear record buffers when starting RecordThread
-rw-r--r-- | services/audioflinger/FastCapture.cpp | 1 | ||||
-rw-r--r-- | services/audioflinger/Threads.cpp | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/services/audioflinger/FastCapture.cpp b/services/audioflinger/FastCapture.cpp index 0c9b976..9613e26 100644 --- a/services/audioflinger/FastCapture.cpp +++ b/services/audioflinger/FastCapture.cpp @@ -134,6 +134,7 @@ void FastCapture::onStateChange() unsigned channelCount = Format_channelCount(format); // FIXME frameSize readBuffer = new short[frameCount * channelCount]; + memset(readBuffer, 0, frameCount * channelCount * sizeof(readBuffer[0])); periodNs = (frameCount * 1000000000LL) / sampleRate; // 1.00 underrunNs = (frameCount * 1750000000LL) / sampleRate; // 1.75 overrunNs = (frameCount * 500000000LL) / sampleRate; // 0.50 diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 5282ffe..4c90be5 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -6239,7 +6239,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 - mRsmpInBuffer = new int16_t[(mRsmpInFramesP2 + mFrameCount - 1) * mChannelCount]; + size_t bufferSizeInShorts = (mRsmpInFramesP2 + mFrameCount - 1) * mChannelCount; + mRsmpInBuffer = new int16_t[bufferSizeInShorts]; + memset(mRsmpInBuffer, 0, bufferSizeInShorts * sizeof(mRsmpInBuffer[0])); // 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? |