diff options
author | Glenn Kasten <gkasten@google.com> | 2013-12-17 16:26:41 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-12-17 16:26:41 +0000 |
commit | a67c76538fff102cd44b2f38dd073df5f2a33605 (patch) | |
tree | da803da6b3053b23ad6c5ebbd33fd7667e2697b3 /media | |
parent | a0e1c3918dd1356445df98e89dab6be2c8a78da3 (diff) | |
parent | b5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e (diff) | |
download | frameworks_av-a67c76538fff102cd44b2f38dd073df5f2a33605.zip frameworks_av-a67c76538fff102cd44b2f38dd073df5f2a33605.tar.gz frameworks_av-a67c76538fff102cd44b2f38dd073df5f2a33605.tar.bz2 |
Merge "Increase kFastTrackMultiplier from 1 to 2"
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index b8a89a0..9730b03 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -866,7 +866,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) @@ -1006,9 +1007,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 { |