Revert "Revert "SoundPool: Use caller thread for sound playback""
This reverts commit af018345e56b18fcc617c04b3b9a55ac9b548b7f.
Reason for revert: Further testing indicates there is no regression from the original state before October 23. See bug for more details on testing performed.
Change-Id: Idba0a01621243ab17e9ef607aec75af2c8db2f25
Test: forrest test on builds 5960785 and 5960803 perfetto_system#ion-avg
Bug: 145834064
diff --git a/media/jni/soundpool/StreamManager.cpp b/media/jni/soundpool/StreamManager.cpp
index 8928c47..64f81d5 100644
--- a/media/jni/soundpool/StreamManager.cpp
+++ b/media/jni/soundpool/StreamManager.cpp
@@ -38,7 +38,7 @@
// kPlayOnCallingThread = true prior to R.
// Changing to false means calls to play() are almost instantaneous instead of taking around
// ~10ms to launch the AudioTrack. It is perhaps 100x faster.
-static constexpr bool kPlayOnCallingThread = false;
+static constexpr bool kPlayOnCallingThread = true;
// Amount of time for a StreamManager thread to wait before closing.
static constexpr int64_t kWaitTimeBeforeCloseNs = 9 * NANOS_PER_SECOND;
@@ -167,6 +167,7 @@
if (!stream->getPairStream()->hasSound()) {
if (stream->getSoundID() == soundID) {
newStream = stream;
+ fromAvailableQueue = false;
break;
} else if (newStream == nullptr) {
newStream = stream;