BUS_ADRALN when trying to call "openStream"
Android version(s): 13 Android device(s): Samsung Galaxy S20 Oboe version: 1.9.3 App name used for testing: NTgCallsX
Code:
std::shared_ptr<oboe::AudioStream> stream;
oboe::AudioStreamBuilder builder;
const auto r = builder.setDirection(isCapture ? oboe::Direction::Input : oboe::Direction::Output)
->setSharingMode(oboe::SharingMode::Exclusive)
->setPerformanceMode(oboe::PerformanceMode::LowLatency)
->setSampleRate(desc->sampleRate)
->setChannelCount(desc->channelCount)
->setCallback(this)
->openStream(stream);
Crash:
2025-04-24 22:28:47.365 24301-24301 oboe_device_module.cpp org.pytgcalls.ntgcallsx E (line 17): OboeDeviceModule initializing
2025-04-24 22:28:47.365 24301-24301 libc org.pytgcalls.ntgcallsx A Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x6d61657274536f in tid 24301 (calls.ntgcallsx), pid 24301 (calls.ntgcallsx)
---------------------------- PROCESS STARTED (24549) for package org.pytgcalls.ntgcallsx ----------------------------
2025-04-24 22:28:48.046 24547-24547 DEBUG crash_dump64 A Cmdline: org.pytgcalls.ntgcallsx
2025-04-24 22:28:48.046 24547-24547 DEBUG crash_dump64 A pid: 24301, tid: 24301, name: calls.ntgcallsx >>> org.pytgcalls.ntgcallsx <<<
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #01 pc 00000000011211b0 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (oboe::AudioStreamBuilder::openStreamInternal(oboe::AudioStream**)+60) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #02 pc 0000000001121bf8 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (oboe::AudioStreamBuilder::openStream(std::__Cr::shared_ptr<oboe::AudioStream>&)+108) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #03 pc 0000000000498110 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (ntgcalls::OboeDeviceModule::OboeDeviceModule(ntgcalls::AudioDescription const*, bool, ntgcalls::BaseSink*)+384) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #04 pc 0000000000497484 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (ntgcalls::MediaDevice::CreateAudioDevice(ntgcalls::AudioDescription const*, ntgcalls::BaseSink*, bool)+120) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #05 pc 00000000004c4104 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (std::__Cr::unique_ptr<ntgcalls::BaseReader, std::__Cr::default_delete<ntgcalls::BaseReader> > ntgcalls::MediaDevice::CreateDevice<ntgcalls::BaseReader>(ntgcalls::BaseMediaDescription const&, ntgcalls::BaseSink*, bool)+56) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #06 pc 00000000004b88f0 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (void ntgcalls::StreamManager::setConfig<ntgcalls::AudioSink, ntgcalls::AudioDescription>(ntgcalls::StreamManager::Mode, ntgcalls::StreamManager::Device, std::__Cr::optional<ntgcalls::AudioDescription> const&)+4472) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #07 pc 00000000004b7374 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (ntgcalls::StreamManager::setStreamSources(ntgcalls::StreamManager::Mode, ntgcalls::MediaDescription const&)+260) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #08 pc 000000000048eee8 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (ntgcalls::P2PCall::init(ntgcalls::MediaDescription const&) const+104) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #09 pc 000000000047ccf0 /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (ntgcalls::NTgCalls::createP2PCall(long, ntgcalls::MediaDescription const&)+468) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #10 pc 000000000045071c /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/lib/arm64/libntgcalls.so (Java_io_github_pytgcalls_NTgCalls_createP2PCall+84) (BuildId: 2a133e2e65b17418c40caad128c9a093c1ee0641)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #16 pc 00000000001c9b44 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.pytgcalls.ntgcallsx.NTgCallsInterface.<init>+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #21 pc 00000000003c91f4 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.service.TGCallService.checkInitiated+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #26 pc 00000000003ca9c0 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.service.TGCallService.updateCurrentState+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #31 pc 00000000003ca894 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.service.TGCallService.updateCall+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #36 pc 00000000003c9ae0 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.service.TGCallService.onCallUpdated+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #41 pc 00000000003e38ac [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.telegram.TdlibCache.notifyListeners+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #46 pc 00000000003e4058 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.telegram.TdlibCache.onUpdateCall+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #51 pc 0000000000438988 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.telegram.Tdlib.handleUiMessage+0)
2025-04-24 22:28:48.047 24547-24547 DEBUG crash_dump64 A #56 pc 000000000041f4f4 [anon:dalvik-classes5.dex extracted in memory from /data/app/~~WRSOozaQg01K-rJ6UC8jOA==/org.pytgcalls.ntgcallsx-ocdU8kom8OPQbCEB9r7bnQ==/base.apk] (org.thunderdog.challegram.telegram.TdlibUi.handleMessage+0)
If applicable, please attach a few seconds of an uncompressed recording of the sound in a WAV or AIFF file.
@Laky-64 - that looks like a very common way to open a stream. So maybe desc->sampleRate or desc->channelCount are strange. What are those values?
Are just values with 48000 (sampleRate) and 2 (channelCount)
48K stereo is very normal. We have not seen this crash.
If it is INPUT, maybe it is lacking Mic permission. But that is often checked on start(). Can you use the Android Studio source level debugger to step through the openStreamInternal call to see where it crashes?
Can be a problem with 16kb paging? More than anything else I don't know how to use "ndk-stack" and I don't "readable logs"
48K stereo is very normal. We have not seen this crash.
If it is INPUT, maybe it is lacking Mic permission. But that is often checked on start(). Can you use the Android Studio source level debugger to step through the openStreamInternal call to see where it crashes?
Oboe 1.9.3 uses 16 kB pages sizes. https://github.com/google/oboe/releases/tag/1.9.3
Does your app use 16 kB page sizes?
Is the crash consistent? Crashes every time?
Is NTgCallsX a released app or an internal test version?
Have you tried any other devices?
Hi, by the way, nope, my app doesn't support 16kb page size. Is there a way to avoid 16 KB page size?
And yup, it's consistent, every time I try to call openStream, and regarding NTgCallsX is a public repo, but the code I was testing I haven't published yet due to I want to have more clean commits
In speaking of, if I've tried to use other devices, nope, I haven't tried it, but I don't think it's a device-related thing
Oboe 1.9.3 uses 16 kB pages sizes. https://github.com/google/oboe/releases/tag/1.9.3
Does your app use 16 kB page sizes?
Is the crash consistent? Crashes every time?
Is NTgCallsX a released app or an internal test version?
Have you tried any other devices?
Hi, btw I've made public the part of implementation: https://github.com/pytgcalls/ntgcalls/commit/19ddd398eb4b
My compile definitions: https://github.com/pytgcalls/ntgcalls/blob/features/oboe-android/cmake/Toolchain.cmake#L18-L19 https://github.com/pytgcalls/ntgcalls/blob/features/oboe-android/cmake/FindLibCXX.cmake#L23-L27
I looked at your posted code and could not see any obvious problems. Maybe it is a build issue.
One odd thought. What if builder is falling out of scope? Try:
->setChannelCount(desc->channelCount)
->setCallback(this);
const auto r = builder.openStream(stream);
->setChannelCount(desc->channelCount) ->setCallback(this); const auto r = builder.openStream(stream);
Tried and nope, still the problem, regarding the compilation, keep in mind I'm doing 2 compilation, the first one I build an archive library (.a) without setting things like "16kb page" since is a static library, then I do a linking here: https://github.com/pytgcalls/ntgcalls/blob/features/oboe-android/android/app/src/main/jni/CMakeLists.txt https://github.com/pytgcalls/ntgcalls/blob/features/oboe-android/android/app/src/main/jni/cmake/FindNTgCalls.cmake