diff options
author | Glenn Kasten <gkasten@google.com> | 2012-05-10 14:48:07 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-05-14 08:56:45 -0700 |
commit | 09474df67278c0cd621b57c4aef1deaec4d8447f (patch) | |
tree | eafcf9a62df5202c4a0628a9ac9798b7c49dd08b /services/audioflinger/FastMixer.cpp | |
parent | d08f48c2ad2941d62b313007955c7145075d562c (diff) | |
download | frameworks_av-09474df67278c0cd621b57c4aef1deaec4d8447f.zip frameworks_av-09474df67278c0cd621b57c4aef1deaec4d8447f.tar.gz frameworks_av-09474df67278c0cd621b57c4aef1deaec4d8447f.tar.bz2 |
Improve underrun handling for fast tracks
Maintain more accurate accounting of type of underrun.
Automatically remove track from active list after a series of "empty" underruns.
Change-Id: If042bf80e1790dcaaf195c99dc9c0ed9b55382c1
Diffstat (limited to 'services/audioflinger/FastMixer.cpp')
-rw-r--r-- | services/audioflinger/FastMixer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp index 04d0f65..cd55396 100644 --- a/services/audioflinger/FastMixer.cpp +++ b/services/audioflinger/FastMixer.cpp @@ -360,20 +360,25 @@ bool FastMixer::threadLoop() // in the overall fast mix cycle being delayed. Should use a non-blocking FIFO. size_t framesReady = fastTrack->mBufferProvider->framesReady(); FastTrackDump *ftDump = &dumpState->mTracks[i]; - uint32_t underruns = ftDump->mUnderruns; + FastTrackUnderruns underruns = ftDump->mUnderruns; if (framesReady < frameCount) { ATRACE_INT("underrun", i); - ftDump->mUnderruns = (underruns + 2) | 1; if (framesReady == 0) { + underruns.mBitFields.mEmpty++; + underruns.mBitFields.mMostRecent = UNDERRUN_EMPTY; mixer->disable(name); } else { // allow mixing partial buffer + underruns.mBitFields.mPartial++; + underruns.mBitFields.mMostRecent = UNDERRUN_PARTIAL; mixer->enable(name); } - } else if (underruns & 1) { - ftDump->mUnderruns = underruns & ~1; + } else { + underruns.mBitFields.mFull++; + underruns.mBitFields.mMostRecent = UNDERRUN_FULL; mixer->enable(name); } + ftDump->mUnderruns = underruns; } // process() is CPU-bound mixer->process(AudioBufferProvider::kInvalidPTS); |