I am posting my conclusions, in case anyone ever stumbles upon this
page with similar questions:

> 4. I am left with the sound being played until the phone is rebooted,
> since there is NO way I know of to get a hold on the AudioTrack
> instance after the service process is killed.

There is indeed no way to get hold of the Track, it will continue
playback until the phone is shut down.

> Is there ANY way to detect in a Process that we are about to be killed
> in an ugly manner?

No.

> How does the MediaPlaybackService mange to stop playback of a song
> when I kill it?

I suppose it is not stopping the playback either. However, it uses a
STREAMing AudioTrack, not a STATIC/LOOPING one, so once its buffers
run dry (since the service stops pouring data into them), the Track
stops.

This is how I 'solved' my issue as well: I just stopped using the
static/looping mode (which would have been more effective btw), and
implemented streaming with threads instead.

> As far as I can tell, none of the AudioTrack's native_stop() /
> native_release() / native_finalize() methods get called in this
> scenario, leaving the system in an erroneous/inconsistent state.

Still looks like a bug to me.

-szabolcs

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to