summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-12-03 09:06:43 -0800
committerEric Laurent <elaurent@google.com>2014-03-05 14:10:41 -0800
commitd812fc012298470a1b8120e6d60a24b0b1d48047 (patch)
treebf3c68ea3a908a0792e766714cd9d54f98ebfb46 /media/libmedia
parent88876fb4eb8365343f2a9ca0e8f53148ca38b845 (diff)
downloadframeworks_av-d812fc012298470a1b8120e6d60a24b0b1d48047.zip
frameworks_av-d812fc012298470a1b8120e6d60a24b0b1d48047.tar.gz
frameworks_av-d812fc012298470a1b8120e6d60a24b0b1d48047.tar.bz2
Increase kFastTrackMultiplier from 1 to 2
Bug: 11967381 Change-Id: Iedec06280aa745d9df5d661f4916940cede9c191
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/AudioTrack.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index ccd1b49..11b0b89 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -879,7 +879,8 @@ status_t AudioTrack::createTrack_l(
ALOGV("createTrack_l() output %d afLatency %d", output, afLatency);
// The client's AudioTrack buffer is divided into n parts for purpose of wakeup by server, where
- // n = 1 fast track; nBuffering is ignored
+ // n = 1 fast track with single buffering; nBuffering is ignored
+ // n = 2 fast track with double buffering
// n = 2 normal track, no sample rate conversion
// n = 3 normal track, with sample rate conversion
// (pessimistic; some non-1:1 conversion ratios don't actually need triple-buffering)
@@ -1019,9 +1020,11 @@ status_t AudioTrack::createTrack_l(
ALOGV("AUDIO_OUTPUT_FLAG_FAST successful; frameCount %u", frameCount);
mAwaitBoost = true;
if (sharedBuffer == 0) {
- // double-buffering is not required for fast tracks, due to tighter scheduling
- if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount) {
- mNotificationFramesAct = frameCount;
+ // Theoretically double-buffering is not required for fast tracks,
+ // due to tighter scheduling. But in practice, to accommodate kernels with
+ // scheduling jitter, and apps with computation jitter, we use double-buffering.
+ if (mNotificationFramesAct == 0 || mNotificationFramesAct > frameCount/nBuffering) {
+ mNotificationFramesAct = frameCount/nBuffering;
}
}
} else {