summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-08-08 23:39:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-08 23:39:35 +0000
commit1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9 (patch)
tree59129feacd309c8ce496d47f29e2468821e63579 /media
parent9bdc9c4ee0b44ca407cdca4499df9b3134bc5884 (diff)
parent4a0efb77198c69df711ab369ac482a42dbdfab07 (diff)
downloadframeworks_av-1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9.zip
frameworks_av-1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9.tar.gz
frameworks_av-1b832c3d8f2b1b24f9bc7025afd2b4a8b4e6c6f9.tar.bz2
Merge "Fix regression for AudioRecord streaming callback mode" into klp-dev
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioRecord.cpp17
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);