sorry, i dumped the wrong output thread, please refer below right one: Clients: pid: 2141 Global session refs: session pid count 1 1541 1 2 1541 1 10 2141 1 12 3449 1 13 3449 1 14 3449 1 15 3449 1 19 3449 1 20 3449 1 Hardware status: 0 Standby Time mSec: 3000
Output thread 0x411b8008 internals last write occurred (msecs): 238843 total writes: 14 delayed writes: 0 blocked in write: 0 suspend count: 1 mix buffer : 0x40d0f148 Fast track availMask=0xf8 io handle: 5 TID: 1952 standby: 1 Sample rate: 48000 HAL frame count: 768 Normal frame count: 1152 Channel Count: 2 Channel Mask: 0x00000003 Format: 1 Frame size: 4 Pending setParameters commands: Index Command Pending config events: Index event param AudioMixer tracks: 00000003 FastMixer command=COLD_IDLE writeSequence=52 framesWritten=19968 numTracks=2 writeErrors=0 underruns=1 overruns=6 sampleRate=48000 frameCount=768 measuredWarmup=35.8 ms, warmupCycles=2 mixPeriod=16.00 ms Simple moving statistics over last 0.4 seconds: wall clock time in ms per mix cycle: mean=13.55 min=0.31 max=41.44 stddev=10.09 raw CPU load in us per mix cycle: mean=253 min=0 max=397 stddev=89 Fast tracks: kMaxFastTracks=8 activeMask=0x5 Index Active Full Partial Empty Recent Ready 0 yes 21 0 2 empty 0 1 no 0 0 0 full 0 2 yes 14 0 9 empty 0 3 no 0 0 0 full 0 4 no 0 0 0 full 0 5 no 0 0 0 full 0 6 no 0 0 0 full 0 7 no 0 0 0 full 0 State queue observer: stateChanges=8 State queue mutator: pushDirty=8 pushAck=3 blockedSequence=6 Output thread 0x411b8008 stream volumes in dB: 0:0, 1:-29, 2:-29, 3:-14, 4:-7.5, 5:-29, 6:-6.6, 7:-29, 8:-30, 9:-14, 10:-14 Output thread 0x411b8008 tracks Name Client Type Fmt Chn mask Session mFrCnt fCount S M F SRate L dB R dB Server User Main buf Aux Buf Flags Underruns F 2 2141 0 1 0x00000001 17 768 1536 T 0 1 48000 -10 -10 0x00002a00 0x00002a00 0x40d0f148 0x00000000 0x82 3* F 1 2141 0 1 0x00000001 10 0 1536 I 0 0 48000 -10 -10 0x00000000 0x00000000 0x40d0f148 0x00000000 0x83 0 Output thread 0x411b8008 active tracks Name Client Type Fmt Chn mask Session mFrCnt fCount S M F SRate L dB R dB Server User Main buf Aux Buf Flags Underruns F 2 2141 0 1 0x00000001 17 768 1536 T 0 1 48000 -10 -10 0x00002a00 0x00002a00 0x40d0f148 0x00000000 0x82 3* Normal mixer raw underrun counters: partial=0 empty=2 - 0 Effect Chains: 在 2012年12月13日星期四UTC+8下午1时59分14秒,eleven写道: > > Dear Glenn, > > I met a issue when I hang up a phone call after communication. > When hang up a phone call, there will be a notification stream from > earpiece to > notify user that phone call is ended. > > From the log, ToneGenerator will create a FastTrack to play it. > > And the Question is after palying the sound, this FastTrack will be set to > TERMINATED state and stay in Active state in MixerThread. > > After track the code, I found that below function never return ture: > > if (!track->presentationComplete(framesWritten, audioHALFrames)) { > // track stays in active list until presentation is complete > break; > } > > > bool AudioFlinger::PlaybackThread::Track::presentationComplete(size_t > framesWritten, size_t audioHalFrames) > { > // a track is considered presented when the total number of frames > written > to audio HAL > // corresponds to the number of frames written when > presentationComplete() > is called for the > // first time (mPresentationCompleteFrames == 0) plus the buffer > filling > status at that time. > if (mPresentationCompleteFrames == 0) { > mPresentationCompleteFrames = framesWritten + audioHalFrames; > ALOGV("presentationComplete() reset: mPresentationCompleteFrames > %d > audioHalFrames %d", > mPresentationCompleteFrames, audioHalFrames); > } > if (framesWritten >= mPresentationCompleteFrames) { > ALOGV("presentationComplete() session %d complete: framesWritten > %d", > mSessionId, framesWritten); > triggerEvents(AudioSystem::SYNC_EVENT_PRESENTATION_COMPLETE); > return true; > } > return false; > } > > After add some log to track I found that "framesWritten" alwasy be 0, > because in > playtrackthread, mBytesWritten was reset to 0 at the front of > PlaybackThread::threadLoop() > // put audio hardware into standby after short delay > if (CC_UNLIKELY((!mActiveTracks.size() && systemTime() > > standbyTime) || > mSuspended > 0)) { > if (!mStandby) { > > threadLoop_standby(); > > mStandby = true; > mBytesWritten = 0; > } > > Because it will just call presentationComplete() after Track's state > becomming > STOPPING_2 or TERMINATED.So the question is why Track's state changed so > slow > which make the next suspend operation reset the mBytesWritten always ?? > > BTW, I tried to make the mixerThread suspend just after mActiveTracks.size > =0,which means waiting FastTrack finish its presentationComplete. > but it still failed, because when Clinet AP call track's stop function, it > will > also stop writing, and mBytesWritten also can not get increased, so > presentationComplete will never return true. > > it is very weird !! And our platform support FastMixer, after happened > this, the > mixerthread will keep pushing state into FastMixer. > > Could you help me ? > > Thanks > > -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting