diff options
author | Glenn Kasten <gkasten@google.com> | 2013-08-09 06:06:33 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-09 06:06:33 -0700 |
commit | 3cb40d7882b93c242267de0b8db10ef8957b3a24 (patch) | |
tree | 932aa303dc79208ea22cf428b5499087ead527ff /media/libmedia/AudioRecord.cpp | |
parent | 8ca3e7e53b4156d62d6135fc0e4c756344d9a3c4 (diff) | |
parent | 1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9 (diff) | |
download | frameworks_av-3cb40d7882b93c242267de0b8db10ef8957b3a24.zip frameworks_av-3cb40d7882b93c242267de0b8db10ef8957b3a24.tar.gz frameworks_av-3cb40d7882b93c242267de0b8db10ef8957b3a24.tar.bz2 |
am 1b832c3d: Merge "Fix regression for AudioRecord streaming callback mode" into klp-dev
* commit '1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9':
Fix regression for AudioRecord streaming callback mode
Diffstat (limited to 'media/libmedia/AudioRecord.cpp')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 2718420..616c3d6 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -245,9 +245,8 @@ status_t AudioRecord::set( return BAD_VALUE; } - if (notificationFrames == 0) { - notificationFrames = frameCount/2; - } + mNotificationFramesReq = notificationFrames; + mNotificationFramesAct = 0; // create the IAudioRecord status = openRecord_l(sampleRate, format, frameCount, mFlags, input, 0 /*epoch*/); @@ -267,8 +266,6 @@ status_t AudioRecord::set( mActive = false; mCbf = cbf; - mNotificationFramesReq = notificationFrames; - mNotificationFramesAct = 0; mRefreshRemaining = true; mUserData = user; // TODO: add audio hardware input latency here @@ -464,6 +461,15 @@ status_t AudioRecord::openRecord_l( } } + mNotificationFramesAct = mNotificationFramesReq; + + if (!(flags & AUDIO_INPUT_FLAG_FAST)) { + // Make sure that application is notified with sufficient margin before overrun + if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount/2) { + mNotificationFramesAct = frameCount/2; + } + } + int originalSessionId = mSessionId; sp<IAudioRecord> record = audioFlinger->openRecord(input, sampleRate, format, @@ -495,7 +501,6 @@ status_t AudioRecord::openRecord_l( mCblk = cblk; // FIXME missing fast track frameCount logic mAwaitBoost = false; - mNotificationFramesAct = mNotificationFramesReq; if (flags & AUDIO_INPUT_FLAG_FAST) { if (trackFlags & IAudioFlinger::TRACK_FAST) { ALOGV("AUDIO_INPUT_FLAG_FAST successful; frameCount %u", frameCount); |