From 42fb2ce98ae9d73b1f2a57246a1e1ccc63324fd0 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 31 Mar 2010 12:21:17 -0700 Subject: Fix isssue 2548710: Native AudioTrack resources never freed. The problem is a bug in AudioFlinger::MixerThread::prepareTracks_l() that makes that even if the TrackHandle is destroyed, the corresponding Track will remain active as long as frames are ready for mixing. If the track uses shared memory (static mode) and the sound is looped, this track will play for ever. The fix consists in removing the track from active list immediately if the track is terminated. Change-Id: Iaa78a91e78d27f5c982218cc55e81702f1610ab2 --- libs/audioflinger/AudioFlinger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index ecfe1e0..5720f90 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -1344,7 +1344,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wpsetActiveTrack(track->name()); if (cblk->framesReady() && (track->isReady() || track->isStopped()) && - !track->isPaused()) + !track->isPaused() && !track->isTerminated()) { //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this); -- cgit v1.1