Fmod crashes on Android suspend/interrrupt

Hi,

I’m using FMOD for an android application. Everything was OK until I’ve recently updated the Fmod to the latest version and 64 bit support

The application crashes when an interrupt is detected (incoming call or application is sent to background).
I’ve tried to use those functions FMOD_System_MixerSuspend()/FMOD_System_MixerResume() (from FMOD library ) on OnPause()/OnResume() methods,
but the application crashes because is trying to call some pure virtual functions: (crash in __cxa_pure_virtual())

I’ve tried to completely destroy and recreate FMOD on every interrupt using OnResume()/OnPause() functions but the application crashes :

2019-10-31 05:13:34.368 3438-6460/? D/GameManagerService: identifyGamePackage. com.sec.android.app.launcher
2019-10-31 05:13:34.368 3438-6460/? D/GamePkgDataHelper: getGamePkgData(). com.sec.android.app.launcher
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: Abort message: ‘Pure virtual function called!’
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x0 0000000000000000 x1 0000000000001ec5 x2 0000000000000006 x3 0000000000000008
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x4 fefeff7ed0df753f x5 fefeff7ed0df753f x6 fefeff7ed0df753f x7 7f7f7f7fffff7f7f
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x8 0000000000000083 x9 179a14dad5798b82 x10 0000000000000000 x11 0000000000000001
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x12 ffffffffffffffff x13 0000000000000001 x14 0000000000000000 x15 00122a4e7a12f224
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x16 0000007cea09d2f8 x17 0000007cea03e408 x18 0000000000000000 x19 0000000000001ec5
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x20 0000000000001ec5 x21 00000000ffffffc8 x22 0000007fd1e07bf0 x23 0000007cea09f988
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x24 0000007fd1e07ac0 x25 0000007fd1e07b00 x26 0000007fd1e07b28 x27 0000000000000000
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: x28 0000000000000000 x29 0000007fd1e07a30 x30 0000007ce9ff0bd4
2019-10-31 05:13:34.370 7967-7967/? A/DEBUG: sp 0000007fd1e079f0 pc 0000007cea03e410 pstate 0000000060000000
2019-10-31 05:13:34.370 3438-10109/? D/Notification: allPendingIntents
2019-10-31 05:13:34.371 3438-10109/? I/chatty: uid=1000(system) Binder:3438_1E identical 2 lines
2019-10-31 05:13:34.371 3438-10109/? D/Notification: allPendingIntents
2019-10-31 05:13:34.371 23310-23310/? I/WorkerManager: New handler created for worker [service] (manager: c38d7ac, handler: f26c75)
2019-10-31 05:13:34.372 3438-10109/? D/Notification: allPendingIntents
2019-10-31 05:13:34.373 3438-10109/? I/chatty: uid=1000(system) Binder:3438_1E identical 2 lines
2019-10-31 05:13:34.373 3438-10109/? D/Notification: allPendingIntents
2019-10-31 05:13:34.373 3018-3299/? V/APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
2019-10-31 05:13:34.373 23310-23310/? I/WorkerHandler: New state for worker [service]: e (handler: f26c75)
2019-10-31 05:13:34.373 3018-3299/? V/APM_AudioPolicyManager: getNewOutputDevice() selected device 0
2019-10-31 05:13:34.373 3018-3299/? V/APM_AudioPolicyManager: ### curdevice : 2
2019-10-31 05:13:34.374 7967-7967/? A/DEBUG: backtrace:
2019-10-31 05:13:34.374 7967-7967/? A/DEBUG: #00 pc 000000000006b410 /system/lib64/libc.so (tgkill+8)
2019-10-31 05:13:34.374 7967-7967/? A/DEBUG: #01 pc 000000000001dbd0 /system/lib64/libc.so (abort+88)
2019-10-31 05:13:34.374 7967-7967/? A/DEBUG: #02 pc 0000000000043510 /system/lib64/libc++.so (abort_message+244)
2019-10-31 05:13:34.374 7967-7967/? A/DEBUG: #03 pc 0000000000067d48 /system/lib64/libc++.so (__cxa_pure_virtual+16)
2019-10-31 05:13:34.374 7967-7967/? A/DEBUG: #04 pc 00000000000c7c98 /data/app/com.myapp-yvDHz59oyC9FTJThz9eU9A==/lib/arm64/libfmod.so

Those crashes are on 32 and 64 bit version of the application.

Thanks.

Using the logging libraries (eg. libfmodL.so) will provide more information from FMOD.

What version were you previously using and what version did you update to?

I’m using 2.00.05 library. I’ve tried old libraries and the issue is the same.

Did the logging libraries provide any new information on the cause?

The issue was resolved after changing the initialization way

FROM
FmodSfx::FmodSfx(FMOD_SYSTEM* pSystem, FileStream* pFileStream, FMOD_SOUND_FORMAT format, bool bIsStream)
{
m_pSound = NULL;

FMOD_RESULT result;

#ifdef TARGET_ANDROID
char pPath[1000] = {0};
sprintf(pPath, “file:///android_asset/%s”, “sound1”);

	result = FMOD_System_CreateSound(pSystem, pPath, FMOD_LOOP_NORMAL | FMOD_CREATESTREAM, 0, &m_pSound);

#else
result = FMOD_System_CreateSound(pSystem, pFileStream->GetFilePath(), FMOD_CREATESTREAM | FMOD_LOOP_NORMAL, 0, &m_pSound);
#endif
}

TO
FmodSfx::FmodSfx(FMOD::System* pSystem, FileStream* pFileStream, FMOD_SOUND_FORMAT format, bool bIsStream)
{
m_pSound = NULL;

FMOD_RESULT result;

#ifdef TARGET_ANDROID
char pPath[1000] = {0};
sprintf(pPath, “file:///android_asset/%s”, “sound1”);

	result = pSystem->createSound(pPath, FMOD_DEFAULT | FMOD_LOOP_NORMAL, 0, &m_pSound);

#else
result = pSystem->createSound(pFileStream->GetFilePath(), FMOD_DEFAULT | FMOD_LOOP_NORMAL, 0, &m_pSound);
#endif
}