# CRASH: AudioTrack::setVolume

**URL:** <https://qa.fmod.com/t/crash-audiotrack-setvolume/19867>\
**Category:** Unity\
**Created:** [February 13, 2023, 3:33pm UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867 "2023-02-13T15:33:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko.ravnjak](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@marko.ravnjak](https://qa.fmod.com/u/marko.ravnjak)\
**Post date:** [February 13, 2023, 3:33pm UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867/1 "2023-02-13T15:33:21Z")

</div>

We are getting a few of those crashes (android 12, redmi/poco devices)

setVolume:484 libaudioclient.android::AudioTrack::setVolume(float, float)  
doSetVolume:112 libaaudio\_internal.aaudio::AudioStreamTrack::doSetVolume()  
playerSetVolume:336 libaaudio\_internal.aaudio::AudioStream::MyPlayerBase::playerSetVolume()  
setVolume:144 libaudioclient.android::PlayerBase::setVolume(float)  
onTransact:644 libaudioclient.android::media::BnPlayer::onTransact(unsigned int, android::Parcel const&, android::Parcel\*, unsigned int)  
transact:248 libbinder.android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel\*, unsigned int)  
executeCommand:1028 libbinder.android::IPCThreadState::executeCommand(int)  
getAndExecuteCommand:160 libbinder.android::IPCThreadState::getAndExecuteCommand()  
joinThreadPool:68 libbinder.android::IPCThreadState::joinThreadPool(bool)  
Unknown:-2 libbinder.0x6cbf8  
\_threadLoop:260 libutils.android:🧵:\_threadLoop(void\*)  
javaThreadShell:140 libandroid\_runtime.android::AndroidRuntime::javaThreadShell(void\*)  
Unknown:-2 libutils.0x11acc  
\_\_pthread\_start:264 libc.\_\_pthread\_start(void\*)  
\_\_start\_thread:64 libc.\_\_start\_thread

I was checking this:

> [@Fmod crash on android crash stack libaudioclient.so](https://qa.fmod.com/t/fmod-crash-on-android-crash-stack-libaudioclient-so/18266):
>
> crash on android Xiaomi 2106118C and HUAWEI JER-AN10 happend several times. crash stack follows, i do not known why this happens. our fmod version is 2.01.11 our game developed by unity. Xiaomi 2106118C phone’s android version is: 11.0 HUAWEI JER-AN10 phones’s android version is: 10.0 i saw a web [Android 9/10 crash in FMOD 2.00.09](https://qa.fmod.com/t/android-9-10-crash-in-fmod-2-00-09/16113) it said the crash will happend on android 9 or 10. so, please help me to solve this question. Signal 11(SIGSEGV), Code 1(SEGV\_MAPERR) 1 #00 pc 0000000000080…

I’m guessing they are related?

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [February 13, 2023, 11:09pm UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867/2 "2023-02-13T23:09:06Z")

</div>

The stack traces are almost identical, so I am confident this is the exact same [issue with Oboe on Android 12](https://github.com/google/oboe/issues/538):

| Your stack trace | Known issue stack trace |
| --- | --- |
| android::AudioTrack::setVolume(float, float) | android::AudioTrack::setVolume(float, float) |
| aaudio::AudioStreamTrack::doSetVolume() | aaudio::AudioStreamTrack::doSetVolume() |
| aaudio::AudioStream::MyPlayerBase::playerSetVolume() | aaudio::AudioStream::MyPlayerBase::playerSetVolume() |
| android::PlayerBase::setVolume(float) | android::PlayerBase::setVolume(float) |
| android::media::BnPlayer::onTransact(unsigned int, android::Parcel const&, android::Parcel\*, unsigned int) | android::media::BnPlayer::onTransact(unsigned int, android::Parcel const&, android::Parcel\*, unsigned int) |
| android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel\*, unsigned int) | android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel\*, unsigned int) |
| android::IPCThreadState::executeCommand(int) | android::IPCThreadState::executeCommand(int) |
| android::IPCThreadState::getAndExecuteCommand() | android::IPCThreadState::getAndExecuteCommand() |
| android::IPCThreadState::joinThreadPool(bool) | android::IPCThreadState::joinThreadPool(bool) |
| - | android::PoolThread::threadLoop() |
| android::thread::\_threadLoop(void\*) | android::thread::\_threadLoop(void\*) |
| android::AndroidRuntime::javaThreadShell(void\*) | android::AndroidRuntime::javaThreadShell(void\*) |

Unfortunately because this is a bug with the Android audio APIs and not related to FMOD, we cannot do anything on our end to prevent this crash.

---

<div class="post-metadata">

**Author:** ![maksimomelyanchuk](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@maksimomelyanchuk](https://qa.fmod.com/u/maksimomelyanchuk)\
**Post date:** [September 27, 2024, 10:08am UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867/3 "2024-09-27T10:08:44Z")

</div>

Hello! We can see that our users still have such crashes on Android 13, 14. Do you have any information about it?

```auto
libaudioclient +0x97c4c android::AudioTrack::setVolume
* libaudioclient +0xba1dc android::TrackPlayerBase::playerSetVolume
* libaudioclient +0xb91e8 android::PlayerBase::setVolume
* libaudioclient +0x45adc android::media::BnPlayer::onTransact
* libbinder +0x49840 android::BBinder::transact
* libbinder +0x53234 android::IPCThreadState::executeCommand
* libbinder +0x52d68 android::IPCThreadState::getAndExecuteCommand
* libbinder +0x535e4 android::IPCThreadState::joinThreadPool
* libbinder +0x7f030 <unknown>
* libutils +0x1223c android::Thread::_threadLoop
* libandroid_runtime +0xbd62c android::AndroidRuntime::javaThreadShell
* libutils +0x11acc <unknown>
* libc +0xb4980 <unknown>
libc +0x52aa0 <unknown>

```

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 30, 2024, 12:11am UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867/4 "2024-09-30T00:11:04Z")

</div>

I can’t find any reports of this crash in Android 13 or 14. Looking through the repo, it appears that the Android 13 fix was applied to `AudioStream`, which would resolve the `AudioStream::MyPlayerBase::playerSetVolume` crash case. I see a recent change in the repo to resolve a similar looking crash in `TrackPlayerBase` [https://android-review.googlesource.com/c/platform/frameworks/av/+/2909337](https://android-review.googlesource.com/c/platform/frameworks/av/+/2909337)  
So this doesn’t appear to be an FMOD issue, and I would expect this crash case to be resolved in Android 15.

---

<div class="post-metadata">

**Author:** ![Mihec](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@Mihec](https://qa.fmod.com/u/Mihec)\
**Post date:** [August 21, 2025, 2:36pm UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867/5 "2025-08-21T14:36:51Z")

</div>

We solved this, it was only an issue on Xiaomi devices Android 11 (but we had a loooot of crashes reported). We changed the Audio output for these devices to FMOD.OUTPUTTYPE.OPENSL. Before we had automatic audio output selection, so it decided based on android version to take Open SL, AudioTrack or AAudio. And now we just override the automatic selection for the offending devices. So the issue was related to Xiaomi changing android OS or screwing up driver code… The code I provided was added to FMOD.AudioManager.Initialize() method. You can maybe expect a little more latency, since AAudio that was choosen before is supposed to work with less latency. Otherwise all seems well.

#if UNITY\_ANDROID

```auto
var deviceModel = SystemInfo.deviceModel;
if (!string.IsNullOrEmpty(deviceModel) && deviceModel.Contains("M2003J15SC") || deviceModel.Contains("M2004J19C") || deviceModel.Contains("M2101K7BG") || deviceModel.Contains("21121119SG") || deviceModel.Contains("M2101K7BL"))
{
    using var buildVersion = new AndroidJavaClass("android.os.Build$VERSION");
    var sdkVersion = buildVersion.GetStatic<int>("SDK_INT");

    if (sdkVersion == 31)
    {
        outputType = FMOD.OUTPUTTYPE.OPENSL;
        RuntimeUtils.DebugLogWarning($"Disabling sound on, because of bad drivers and crashes on {deviceModel}");
    }
}
#endif

```

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 27, 2025, 6:07am UTC](https://qa.fmod.com/t/crash-audiotrack-setvolume/19867/6 "2025-08-27T06:07:30Z")

</div>

Glad to hear you’ve got a work around, thanks for sharing your solution!
