summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andy Hung <hunga@google.com> 2024-01-24 22:53:20 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-01-24 22:53:20 +0000
commit913c46b911515cdba8b0e9d24fbc7c8d65b09e4d (patch)
tree55ae5b5e39fa3b8123383a6478a8b4f196f47ed0
parent156bb5fd1d3d6328b3d29e66b69d2650e5267ca7 (diff)
parentb9faaa3304c9d80f777aaa748d25b2cbc754176f (diff)
Merge "SoundPool: Enable multithreaded track start" into main
-rw-r--r--media/jni/soundpool/StreamManager.cpp3
-rw-r--r--media/jni/soundpool/StreamManager.h2
2 files changed, 2 insertions, 3 deletions
diff --git a/media/jni/soundpool/StreamManager.cpp b/media/jni/soundpool/StreamManager.cpp
index 52060f1e6209..66fec1c528e7 100644
--- a/media/jni/soundpool/StreamManager.cpp
+++ b/media/jni/soundpool/StreamManager.cpp
@@ -35,10 +35,9 @@ static constexpr int32_t kMaxStreams = 32;
// In R, we change this to true, as it is the correct way per SoundPool documentation.
static constexpr bool kStealActiveStream_OldestFirst = true;
-// 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 = true;
+static constexpr bool kPlayOnCallingThread = false;
// Amount of time for a StreamManager thread to wait before closing.
static constexpr int64_t kWaitTimeBeforeCloseNs = 9 * NANOS_PER_SECOND;
diff --git a/media/jni/soundpool/StreamManager.h b/media/jni/soundpool/StreamManager.h
index adbab4b0f9d9..340b49bc6d6c 100644
--- a/media/jni/soundpool/StreamManager.h
+++ b/media/jni/soundpool/StreamManager.h
@@ -48,7 +48,7 @@ class JavaThread {
public:
JavaThread(std::function<void()> f, const char *name)
: mF{std::move(f)} {
- createThreadEtc(staticFunction, this, name);
+ createThreadEtc(staticFunction, this, name, ANDROID_PRIORITY_AUDIO);
}
JavaThread(JavaThread &&) = delete; // uses "this" ptr, not moveable.