I have not seen this happen on my test devices so far.
Which device are you having the problem on?
Does the same problem happen on all other devices you try, or only this one?
Is it 100% repeatable, or only happens sometimes?
Please supply output of adb shell dumpsys media.audio_flinger
and the last 20 lines of adb logcat immediately after a failure.

On Wednesday, December 12, 2012 9:59:14 PM UTC-8, eleven wrote:
>
> 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: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to