Skip to content
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

AAudioStream_close crashes on Android 8.1 #361

Closed
loongee opened this issue Jan 23, 2019 · 2 comments
Closed

AAudioStream_close crashes on Android 8.1 #361

loongee opened this issue Jan 23, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@loongee
Copy link

loongee commented Jan 23, 2019

It's a crash on the same app as I mentioned in #359

When DISCONNECT event raised, the error handler calls close()
but close() crashed.

devices: VIVO X9s/ VIVO X20 / HUAWEI Mate 10 / Meizu 16 / etc.
OS: Android 8.1 (Android 9 does not crash at all)
oboe version: 1.1.1

crash rate: about 5 times / 1000 users per day.

backtrace as follows:

SIGABRT:
#00 pc 0001a794 /system/lib/libc.so (abort+63) [armeabi-v7a::2a4f9449d26c102eb3273056d9f69245]
#1 pc 000065ab /system/lib/liblog.so (__android_log_assert+158) [armeabi-v7a::067eccbd48c13902e69ef050b36bf01c]
#2 pc 0001248f /system/lib/libaaudio.so (_ZN6aaudio11AudioStreamD1Ev+110) [armeabi-v7a::9b0e6a17c09bd1322e800f7b4913ddb7]
#3 pc 00013ef5 /system/lib/libaaudio.so (_ZN6aaudio16AudioStreamTrackD0Ev+2) [armeabi-v7a::9b0e6a17c09bd1322e800f7b4913ddb7]
#4 pc 00012ecb /system/lib/libaaudio.so (AAudioStream_close+42) [armeabi-v7a::9b0e6a17c09bd1322e800f7b4913ddb7]
#5 pc 003a95df /data/app/com.tencent.qgame-f89jxGbwruadjLNPIpPpvw==/lib/arm/libqgplayer-lib.so (_ZN4oboe17AudioStreamAAudio5closeEv+62) [armeabi-v7a::de1dfbeb99205ca392b18fc844c4926b]
#6 pc 003a9cdf /data/app/com.tencent.qgame-f89jxGbwruadjLNPIpPpvw==/lib/arm/libqgplayer-lib.so [armeabi-v7a::de1dfbeb99205ca392b18fc844c4926b]
#7 pc 003a9db7 /data/app/com.tencent.qgame-f89jxGbwruadjLNPIpPpvw==/lib/arm/libqgplayer-lib.so (ZNSt6__ndk114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEPFvPN4oboe17AudioStreamAAudioEP18AAudioStreamStructNS7_6ResultEES9_SB_SC_EEEEEPvSG+30) [armeabi-v7a::de1dfbeb99205ca392b18fc844c4926b]
#8 pc 0004749f /system/lib/libc.so (_ZL15__pthread_startPv+22) [armeabi-v7a::2a4f9449d26c102eb3273056d9f69245]
#9 pc 0001b259 /system/lib/libc.so (__start_thread+32) [armeabi-v7a::2a4f9449d26c102eb3273056d9f69245]

log:

01-21 22:11:37.846 2784 4469 D AudioStreamLegacy: onAudioDeviceUpdate() deviceId 2
01-21 22:11:37.846 2784 4469 D AudioStreamLegacy: onAudioDeviceUpdate() DISCONNECT the stream now
01-21 22:11:37.847 2784 21566 D AAudio : AAudioStream_requestStop(0xc8c24300)
01-21 22:11:37.847 2784 21566 D : PlayerBase::stop() from IPlayer
01-21 22:11:37.847 2784 21566 D AudioTrack: stop() called with 11539204 frames delivered
01-21 22:11:37.848 2784 21566 D AAudio : AAudioStream_close(0xc8c24300)
01-21 22:11:37.848 2784 21566 V AudioTrack: ~AudioTrack, releasing session id 37097 from 2784 on behalf of 2784
01-21 22:11:37.848 2784 21566 D AAudioStream: destroying 0xc8c24300, state = AAUDIO_STREAM_STATE_STOPPED
01-21 22:11:37.848 2784 21566 F AAudioStream: aaudio stream still in use, state = AAUDIO_STREAM_STATE_STOPPED

I believe it's a system bug, but also want you to know.

@dturner dturner added this to the future milestone Jan 29, 2019
@philburk
Copy link
Collaborator

philburk commented Feb 5, 2019

@loongee can you reproduce this in your office?

This message:
"AAudioStream: aaudio stream still in use, state = AAUDIO_STREAM_STATE_STOPPED"
is from "frameworks/av/media/libaaudio/src/core/AudioStream.cpp"
The destructor asserts if the stream is still running.

So why is the stream in STOPPED state when the destructor is called?!

Is your app calling stop?

This change in PI prevented a stream from moving from the CLOSED state to the STOPPED state.
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/av/+/3790487/3/media/libaaudio/src/core/AudioStream.cpp#245

I believe it's a system bug, but also want you to know.

Me too. I also work on AAudio. So we will look in both Oboe and AAudio for the bug.

@atneya atneya added the bug label Jun 11, 2019
@philburk
Copy link
Collaborator

I believe this was fixed in P.
I think it can be avoided by only calling stop() and close() from the same thread.
Please reopen if you are still seeing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants