Skip to content

Commit 42fb2ce

Browse files
Eric LaurentJean-Baptiste Queru
authored andcommitted
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
1 parent e25863c commit 42fb2ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libs/audioflinger/AudioFlinger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
13441344
// for all its buffers to be filled before processing it
13451345
mAudioMixer->setActiveTrack(track->name());
13461346
if (cblk->framesReady() && (track->isReady() || track->isStopped()) &&
1347-
!track->isPaused())
1347+
!track->isPaused() && !track->isTerminated())
13481348
{
13491349
//LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);
13501350

0 commit comments

Comments
 (0)