diff options
author | Eric Laurent <elaurent@google.com> | 2013-10-12 17:05:19 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-10-12 17:05:19 -0700 |
commit | b3cb72a17d9a472883e9e2faa18b42eac533fe99 (patch) | |
tree | 0cd89996f1cd52cdee00325e69e8c287b7a89439 /media | |
parent | 15ad2470b2f2ac34473eb568b606ad75e8e63ac6 (diff) | |
download | frameworks_av-b3cb72a17d9a472883e9e2faa18b42eac533fe99.zip frameworks_av-b3cb72a17d9a472883e9e2faa18b42eac533fe99.tar.gz frameworks_av-b3cb72a17d9a472883e9e2faa18b42eac533fe99.tar.bz2 |
SoundPool: handle new audio track event
If the AudioTrack is torn down, SoundPool will never
receive the buffer end event and the track will stay active
for ever.
The fix consists in stopping the AudioTrack when a new audiotrack
event is received.
Bug: 11193583.
Change-Id: I9876eb2a8f75c601368f669acd67b0accf6e2736
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/SoundPool.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/media/libmedia/SoundPool.cpp b/media/libmedia/SoundPool.cpp index 8434d43..22e9fad 100644 --- a/media/libmedia/SoundPool.cpp +++ b/media/libmedia/SoundPool.cpp @@ -744,11 +744,16 @@ void SoundChannel::process(int event, void *info, unsigned long toggle) b->size = count; //ALOGV("buffer=%p, [0]=%d", b->i16, b->i16[0]); } - } else if (event == AudioTrack::EVENT_UNDERRUN || event == AudioTrack::EVENT_BUFFER_END) { - ALOGV("process %p channel %d EVENT_UNDERRUN or EVENT_BUFFER_END", this, mChannelID); + } else if (event == AudioTrack::EVENT_UNDERRUN || event == AudioTrack::EVENT_BUFFER_END || + event == AudioTrack::EVENT_NEW_IAUDIOTRACK) { + ALOGV("process %p channel %d event %s", + this, mChannelID, (event == AudioTrack::EVENT_UNDERRUN) ? "UNDERRUN" : + (event == AudioTrack::EVENT_BUFFER_END) ? "BUFFER_END" : "NEW_IAUDIOTRACK"); mSoundPool->addToStopList(this); } else if (event == AudioTrack::EVENT_LOOP_END) { ALOGV("End loop %p channel %d", this, mChannelID); + } else { + ALOGW("SoundChannel::process unexpected event %d", event); } } |