diff options
author | Glenn Kasten <gkasten@google.com> | 2014-02-28 22:24:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-02-28 22:24:58 +0000 |
commit | f0aaabfeab95f67889fd417947900d6ec7dbdd3c (patch) | |
tree | 2b21a18ffaa0f5bc9b72aa483f0a89805b0d79df /media/libmedia | |
parent | d2304db2fcb5112292105a0949a55986a4c9875f (diff) | |
parent | 2c48f27be6b3ae58e451d9b56c1dfd00e606f345 (diff) | |
download | frameworks_av-f0aaabfeab95f67889fd417947900d6ec7dbdd3c.zip frameworks_av-f0aaabfeab95f67889fd417947900d6ec7dbdd3c.tar.gz frameworks_av-f0aaabfeab95f67889fd417947900d6ec7dbdd3c.tar.bz2 |
Merge "Make openRecord_l more like createTrack_l for fast tracks: part 2"
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 8b92669..a8e1f5d 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -451,6 +451,9 @@ status_t AudioRecord::openRecord_l(size_t epoch) } } + // FIXME Assume double buffering, because we don't know the true HAL sample rate + const uint32_t nBuffering = 2; + mNotificationFramesAct = mNotificationFramesReq; size_t frameCount = mReqFrameCount; @@ -522,23 +525,21 @@ status_t AudioRecord::openRecord_l(size_t epoch) } frameCount = temp; - // FIXME missing fast track frameCount logic mAwaitBoost = false; if (mFlags & AUDIO_INPUT_FLAG_FAST) { if (trackFlags & IAudioFlinger::TRACK_FAST) { - ALOGV("AUDIO_INPUT_FLAG_FAST successful; frameCount %u", mFrameCount); + ALOGV("AUDIO_INPUT_FLAG_FAST successful; frameCount %u", frameCount); mAwaitBoost = true; - // double-buffering is not required for fast tracks, due to tighter scheduling - if (mNotificationFramesAct == 0 || mNotificationFramesAct > mFrameCount) { - mNotificationFramesAct = mFrameCount; - } } else { - ALOGV("AUDIO_INPUT_FLAG_FAST denied by server; frameCount %u", mFrameCount); + ALOGV("AUDIO_INPUT_FLAG_FAST denied by server; frameCount %u", frameCount); // once denied, do not request again if IAudioRecord is re-created mFlags = (audio_input_flags_t) (mFlags & ~AUDIO_INPUT_FLAG_FAST); - if (mNotificationFramesAct == 0 || mNotificationFramesAct > mFrameCount/2) { - mNotificationFramesAct = mFrameCount/2; - } + } + // Theoretically double-buffering is not required for fast tracks, + // due to tighter scheduling. But in practice, to accomodate kernels with + // scheduling jitter, and apps with computation jitter, we use double-buffering. + if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount/nBuffering) { + mNotificationFramesAct = frameCount/nBuffering; } } |