diff options
author | Glenn Kasten <gkasten@google.com> | 2013-08-02 16:14:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-08-02 16:14:01 +0000 |
commit | f36dbfe3d517e9311be0a4d0fd6658380690e84c (patch) | |
tree | 65768073d7fd288eac6c28f1283589d65fe0cbad /services | |
parent | 1a3739169becc850999c3c06db402541119a428c (diff) | |
parent | 82aaf94a5b18939e4d790bbc752031f3070704a3 (diff) | |
download | frameworks_av-f36dbfe3d517e9311be0a4d0fd6658380690e84c.zip frameworks_av-f36dbfe3d517e9311be0a4d0fd6658380690e84c.tar.gz frameworks_av-f36dbfe3d517e9311be0a4d0fd6658380690e84c.tar.bz2 |
Merge "Report underruns for fast tracks also"
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/PlaybackTracks.h | 1 | ||||
-rw-r--r-- | services/audioflinger/Threads.cpp | 13 | ||||
-rw-r--r-- | services/audioflinger/Tracks.cpp | 10 |
3 files changed, 8 insertions, 16 deletions
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h index 628f5af..5600411c 100644 --- a/services/audioflinger/PlaybackTracks.h +++ b/services/audioflinger/PlaybackTracks.h @@ -140,7 +140,6 @@ private: // but the slot is only used if track is active FastTrackUnderruns mObservedUnderruns; // Most recently observed value of // mFastMixerDumpState.mTracks[mFastIndex].mUnderruns - uint32_t mUnderrunCount; // Counter of total number of underruns, never reset volatile float mCachedVolume; // combined master volume and stream type volume; // 'volatile' means accessed without lock or // barrier, but is read/written atomically diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 17fbd72..f0c27c3 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -2739,8 +2739,10 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac track->mObservedUnderruns = underruns; // don't count underruns that occur while stopping or pausing // or stopped which can occur when flush() is called while active - if (!(track->isStopping() || track->isPausing() || track->isStopped())) { - track->mUnderrunCount += recentUnderruns; + if (!(track->isStopping() || track->isPausing() || track->isStopped()) && + recentUnderruns > 0) { + // FIXME fast mixer will pull & mix partial buffers, but we count as a full underrun + track->mAudioTrackServerProxy->tallyUnderrunFrames(recentUnderruns * mFrameCount); } // This is similar to the state machine for normal tracks, @@ -3056,12 +3058,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac mixerStatus = MIXER_TRACKS_READY; } } else { - // only implemented for normal tracks, not fast tracks if (framesReady < desiredFrames && !track->isStopped() && !track->isPaused()) { - // we missed desiredFrames whatever the actual number of frames missing was - cblk->u.mStreaming.mUnderrunFrames += desiredFrames; - // FIXME also wake futex so that underrun is noticed more quickly - (void) android_atomic_or(CBLK_UNDERRUN, &cblk->mFlags); + track->mAudioTrackServerProxy->tallyUnderrunFrames(desiredFrames); } // clear effect chain input buffer if an active track underruns to avoid sending // previous audio buffer again to effects @@ -3086,7 +3084,6 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac tracksToRemove->add(track); } } else { - track->mUnderrunCount++; // No buffers for this track. Give it a few chances to // fill a buffer, then remove it from active list. if (--(track->mRetryCount) <= 0) { diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index 1f75468..e676365 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -316,7 +316,6 @@ AudioFlinger::PlaybackThread::Track::Track( mPresentationCompleteFrames(0), mFlags(flags), mFastIndex(-1), - mUnderrunCount(0), mCachedVolume(1.0), mIsInvalid(false), mAudioTrackServerProxy(NULL), @@ -389,7 +388,7 @@ void AudioFlinger::PlaybackThread::Track::destroy() /*static*/ void AudioFlinger::PlaybackThread::Track::appendDumpHeader(String8& result) { result.append(" Name Client Type Fmt Chn mask Session fCount S F SRate " - "L dB R dB Server Main buf Aux Buf Flags Underruns\n"); + "L dB R dB Server Main buf Aux Buf Flags UndFrmCnt\n"); } void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) @@ -470,7 +469,7 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) (int)mMainBuffer, (int)mAuxBuffer, mCblk->mFlags, - mUnderrunCount, + mAudioTrackServerProxy->getUnderrunFrames(), nowInUnderrun); } @@ -489,10 +488,7 @@ status_t AudioFlinger::PlaybackThread::Track::getNextBuffer( buffer->frameCount = buf.mFrameCount; buffer->raw = buf.mRaw; if (buf.mFrameCount == 0) { - // only implemented so far for normal tracks, not fast tracks - mCblk->u.mStreaming.mUnderrunFrames += desiredFrames; - // FIXME also wake futex so that underrun is noticed more quickly - (void) android_atomic_or(CBLK_UNDERRUN, &mCblk->mFlags); + mAudioTrackServerProxy->tallyUnderrunFrames(desiredFrames); } return status; } |