diff options
author | Mingming Yin <mingming@codeaurora.org> | 2015-12-14 16:05:08 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-19 02:46:24 -0500 |
commit | e9990d5c032e2a29de51e1a361df409f269194c2 (patch) | |
tree | ecfb0701b20c54afde271a5117e0594d76ebdbea /media/libmedia/AudioRecord.cpp | |
parent | 53c13f5281032650995e1bab9ab4232c932ae654 (diff) | |
download | frameworks_av-e9990d5c032e2a29de51e1a361df409f269194c2.zip frameworks_av-e9990d5c032e2a29de51e1a361df409f269194c2.tar.gz frameworks_av-e9990d5c032e2a29de51e1a361df409f269194c2.tar.bz2 |
libmedia: correct latency computing of AudioRecord
- Originally, audio record latency is calculated by frame
buffers allocated for this track, while the actual
latency is determined by audio hal.
- Compute the track latency by frame count returned
from audio hal when in TRANSFER_CALLBACK mode
Change-Id: I26e5e47e8cc3720895b962f7aab8a595a54b7c83
Diffstat (limited to 'media/libmedia/AudioRecord.cpp')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 6dc52cd..66903b3 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -276,7 +276,11 @@ status_t AudioRecord::set( mActive = false; mUserData = user; // TODO: add audio hardware input latency here - mLatency = (1000*mFrameCount) / sampleRate; + if (mTransfer == TRANSFER_CALLBACK) { + mLatency = (1000*mNotificationFramesAct) / sampleRate; + } else { + mLatency = (1000*mFrameCount) / sampleRate; + } mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; |