summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-12-03 09:06:43 -0800
committerGlenn Kasten <gkasten@android.com>2013-12-04 17:12:42 -0800
commitb5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e (patch)
tree12cac79b78992586c8f8da4f618a020f40d92441 /media/libmedia
parent92630351d265a61faae2dfe006a8bb330283aa7b (diff)
downloadframeworks_av-b5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e.zip
frameworks_av-b5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e.tar.gz
frameworks_av-b5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e.tar.bz2
Increase kFastTrackMultiplier from 1 to 2
Change-Id: I158f147295eebcea96e4047d7618069bc48bdd7d
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 fe5cd9e..2965b73 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -857,7 +857,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)
@@ -996,9 +997,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 {