From 151117ec0bb69b5a4829baecaa23b9324745fdd4 Mon Sep 17 00:00:00 2001 From: Andy Hung Date: Sun, 28 Nov 2021 23:30:02 -0800 Subject: [PATCH] SoundPool: Update queue only if streamID matches SoundPool API commands are based on an atomic compare-StreamID if match then operate (see compare-exchange). Test: soundpool_stress Test: atest SoundPoolAacTest Test: atest SoundPoolHapticTest Test: atest SoundPoolMidiTest Test: atest SoundPoolOggTest Bug: 201233890 Bug: 201262390 Change-Id: I63cc07d581a0ac1d5440852bfe0c75edc9d73e75 --- media/jni/soundpool/SoundPool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp index 253b4e3a8a098..00c4a9782f33c 100644 --- a/media/jni/soundpool/SoundPool.cpp +++ b/media/jni/soundpool/SoundPool.cpp @@ -185,7 +185,7 @@ void SoundPool::stop(int32_t streamID) auto apiLock = kUseApiLock ? std::make_unique>(mApiLock) : nullptr; soundpool::Stream* stream = mStreamManager.findStream(streamID); if (stream != nullptr && stream->requestStop(streamID)) { - mStreamManager.moveToRestartQueue(stream); + mStreamManager.moveToRestartQueue(stream, streamID); } }