-
Notifications
You must be signed in to change notification settings - Fork 573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash in aaudio::AudioStreamLegacy::getBestTimestamp() #1489
Comments
See https://developer.android.com/ndk/guides/audio/aaudio/aaudio#thread-safety AAudio is not completely thread safe. Oboe is a wrapper on AAudio so this issue is likely to also happen for Oboe. |
@extreamsd - was the crash from an assert() or something like a SIGSEGV? The crash is happening during a legacy callback. The callback is calling calculateLatencyMillis() while calls getTimestamp(). There were known issues with calling getTimestamp() from a legacy callback: The original assert was fixed in R and the user was running R. Also the stack does not match the old bug. But it may be related. Because of these issues, we recommend NOT calling getTimestamp or calculateLatencyMillis() from a callback. I just noticed that our autodocs do not mention that recommendation. I added #1499 |
We are tracking this internally at b/275752736 | P4 | possible race in AudioStreamLegacy::getBestTimestamp() |
hello! i think i'm encountering almost the same error on my side! however i'm using the juce framework (also oboe 1.6.1) so my stack looks a little different. i did notice theres a bug fix in 1.7.0, but i wasn't sure if it was related...
if it is, then i'm kind of in an awkward situation here because i'm not using this repo directly (the files juce included doesn't look entirely the same either) so even if i wanted to bump 1.7.0 i wouldn't know exactly how to upgrade. but since @philburk commented here after 1.7.0 release then i assume this is still a work in progress? is there anything I can do in the code? Juce forum haven't replied my issue... |
This might be related to not using std:shared_ptr when opening the stream. |
hello, i think i'm encountering almost the same error on my side! the code like this
I have encountered this problem twice already while do stress testing for app. The tombstone file like this Tombstone maker: 'xCrash 3.1.0' backtrace: in order to keep audio and picture synchronizing, i will call AudioStreamerPlayer::getLatency() once a second. @philburk from the backtrace i can not find why it will crash on ExtendedTimestamp or getBestTimestamp, is there anything I can do in the code to avoid the crash? |
@arieshfut - I cannot match this to any known bug. Is it happening on any release other than R? Does it seem to happen when plugging or unplugging a headset, or connecting or disconnecting Bluetooth? Does it still happen with Oboe 1.8.0? Can you reproduce it reliably? If so then please provide repro steps. |
Is it happening on any release other than R? Does it seem to happen when plugging or unplugging a headset, or connecting or disconnecting Bluetooth? Does it still happen with Oboe 1.8.0? Can you reproduce it reliably? If so then please provide repro steps. now i am trying to call getLatency function separate from audio stream callback, expect can fix this bug. |
@philburk Hello, two years have passed, I wonder if this problem has been solved, our project also has this function crash, adb logcat log is as follows: 08-15 08:19:20.198 12284 12284 F crashpad: O{;+1qpOl-$4ZjPE.OS5Wm{H[sdzXC5b|u7IyP^LZpF)>xr5WmNqe)RbkgRY+J+^k)Ds'DX2As;>OZwm@f;"^F>nr)npBsmw>xs[TL! The running environment is mumu emulator, Android kernel 12 version, long time (more than 12 hours) continuous playback of audio will appear this problem. |
/**
|
Android version(s): 11
Android device(s): Samsung SM-T500
Oboe version: 1.6.1
App name used for testing:
Audio Evolution Mobile Studio
I'm not sure if you are interested in these kind of stack traces since they are from customers who usually cannot reproduce issues, but here is the trace:
#00 pc 000000000008cea4 /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
#1 pc 0000000000025918 /system/lib64/libaaudio_internal.so (aaudio::AudioStreamLegacy::getBestTimestamp(int, long*, long*, android::ExtendedTimestamp*)+356)
#2 pc 0000000000029d84 /system/lib64/libaaudio_internal.so (aaudio::AudioStreamTrack::getTimestamp(int, long*, long*)+220)
#3 pc 000000000001e4e8 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::AudioStreamAAudio::getTimestamp(int, long*, long*)+108)
#4 pc 000000000001e578 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::AudioStreamAAudio::calculateLatencyMillis()+60)
#5 pc 000000000031214c /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libCore.so (Transport::onAudioReady(oboe::AudioStream*, void*, int)+1668)
#6 pc 000000000001ef70 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (non-virtual thunk to oboe::AudioSourceCaller::onProcessFixedBlock(unsigned char*, int)+80)
#7 pc 00000000000224a8 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (FixedBlockReader::read(unsigned char*, int)+160)
#8 pc 0000000000022948 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::SourceFloatCaller::onProcess(int)+52)
#9 pc 0000000000027cbc /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::flowgraph::FlowGraphPortFloatOutput::pullData(long, int)+128)
#10 pc 0000000000027e14 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::flowgraph::FlowGraphSink::pullData(int)+72)
#11 pc 0000000000029c70 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::flowgraph::SinkFloat::read(void*, int)+68)
#12 pc 0000000000021bd8 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (non-virtual thunk to oboe::FilterAudioStream::onAudioReady(oboe::AudioStream*, void*, int)+72)
#13 pc 000000000001f488 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::AudioStream::fireDataCallback(void*, int)+104)
#14 pc 000000000001d9a4 /data/app/~~rgPx6Ut9nfsdblOnLgTDjA==/com.extreamsd.aemobile--o34yNaqcH60uit7xcWmfA==/lib/arm64/libaeoboe.so (oboe::AudioStreamAAudio::callOnAudioReady(AAudioStreamStruct*, void*, int)+40)
#15 pc 0000000000022a4c /system/lib64/libaaudio_internal.so (aaudio::AudioStream::maybeCallDataCallback(void*, int)+192)
#16 pc 0000000000024aa4 /system/lib64/libaaudio_internal.so (aaudio::AudioStreamLegacy::callDataCallbackFrames(unsigned char*, int)+304)
#17 pc 00000000000251a0 /system/lib64/libaaudio_internal.so (aaudio::AudioStreamLegacy::processCallbackCommon(int, void*)+944)
#18 pc 000000000008bee8 /system/lib64/libaudioclient.so (android::AudioTrack::processAudioBuffer()+2824)
#19 pc 000000000008b0d8 /system/lib64/libaudioclient.so (android::AudioTrack::AudioTrackThread::threadLoop()+272)
#20 pc 00000000000154d4 /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+216)
#21 pc 00000000000a4974 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+144)
#22 pc 0000000000014db0 /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+408)
#23 pc 00000000000f41b8 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
#24 pc 000000000008ede4 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
Even though there is no further contextual information, perhaps it's important to know about these crashes anyway in case you see more frequent crashes in getBestTimestamp().
The text was updated successfully, but these errors were encountered: