Skip to content

Instantly share code, notes, and snippets.

@gavv
Last active July 22, 2020 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavv/b4222d9600d6ac3dab95a37e3b26c96d to your computer and use it in GitHub Desktop.
Save gavv/b4222d9600d6ac3dab95a37e3b26c96d to your computer and use it in GitHub Desktop.
<<< BTW I see these "AudioFlinger server died!" messages from time to time; don't know why >>>
07-22 13:19:14.758 2302 2426 AudioService E Audioserver started.
07-22 13:19:15.260 30366 30612 AudioSystem W AudioFlinger server died!
07-22 13:19:15.268 30366 30366 MYAPP:StateManager I <<< here my app detects device removal, but it doesn't call close for now >>>
07-22 13:19:15.297 2302 2302 AudioService I Audio-path brought-up
07-22 13:19:15.297 2302 2302 AudioService I In onReceive(), mScoAudioState: 3, broadcast: true
07-22 13:19:15.310 30366 30614 AudioTrack I AUDIO_OUTPUT_FLAG_FAST successful; frameCount 1536 -> 1536
07-22 13:19:18.272 30366 30366 MYAPP:StateManager D <<< here, 3 seconds after device removal event, my app starts closing oboe streams >>>
<<< stopping and closing stream for device 132 >>>
07-22 13:19:18.276 30366 30366 AAudio D AAudioStream_requestStop(0x4dca89ff20)
07-22 13:19:18.276 30366 30366 MYAPP:Core I closing stream for device 132
07-22 13:19:18.276 30366 30366 AAudio D AAudioStream_close(0x4dca89ff20) called ---------------
07-22 13:19:18.281 30366 30366 AAudioStream D destroying 0x4dca89ff20, state = AAUDIO_STREAM_STATE_CLOSED
07-22 13:19:18.281 30366 30366 AAudio D AAudioStream_close(0x4dca89ff20) returned 0 ---------
<<< stopping stream for device 128 >>>
07-22 13:19:18.282 30366 30366 MYAPP:Core I stopping stream for device 128
07-22 13:19:18.282 30366 30366 AAudio D AAudioStream_requestStop(0x4cca87f040)
07-22 13:19:19.563 30366 30614 AudioTrack W restoreTrack_l() failed status -1, retries 3
07-22 13:19:19.620 30630 30661 AudioHwDevice I openOutputStream(), HAL returned sampleRate 8000, Format 0x1, channelMask 0x1, status -61
07-22 13:19:20.530 30752 30752 DEBUG F *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-22 13:19:20.530 30752 30752 DEBUG F Build fingerprint: 'xiaomi/lavender/lavender:9/PKQ1.180904.001/V11.0.6.0.PFGMIXM:user/release-keys'
07-22 13:19:20.530 30752 30752 DEBUG F Revision: '0'
07-22 13:19:20.530 30752 30752 DEBUG F ABI: 'arm'
07-22 13:19:20.530 30752 30752 DEBUG F pid: 30630, tid: 30660, name: TimeCheckThread >>> /system/bin/audioserver <<<
07-22 13:19:20.530 30752 30752 DEBUG F signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-22 13:19:20.531 30752 30752 DEBUG F Abort message: 'TimeCheck timeout for IAudioPolicyService: 1'
07-22 13:19:20.531 30752 30752 DEBUG F r0 00000000 r1 000077c4 r2 00000006 r3 00000008
07-22 13:19:20.531 30752 30752 DEBUG F r4 000077a6 r5 000077c4 r6 ee2114a4 r7 0000010c
07-22 13:19:20.531 30752 30752 DEBUG F r8 ee11376c r9 eff9e158 r10 f13acccc r11 3b9aca00
07-22 13:19:20.531 30752 30752 DEBUG F ip f17663bc sp ee211490 lr f16d07f9 pc f16c801e
07-22 13:19:20.537 30752 30752 DEBUG F backtrace:
07-22 13:19:20.538 30752 30752 DEBUG F #00 pc 0001d01e /system/lib/libc.so (abort+58)
07-22 13:19:20.538 30752 30752 DEBUG F #01 pc 00007e19 /system/lib/liblog.so (__android_log_assert+156)
07-22 13:19:20.538 30752 30752 DEBUG F #02 pc 00013765 /system/lib/libmedia_helper.so (android::TimeCheck::TimeCheckThread::threadLoop()+272)
07-22 13:19:20.538 30752 30752 DEBUG F #03 pc 0000c675 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+144)
07-22 13:19:20.538 30752 30752 DEBUG F #04 pc 00071841 /system/lib/libc.so (__pthread_start(void*)+22)
07-22 13:19:20.538 30752 30752 DEBUG F #05 pc 0001e045 /system/lib/libc.so (__start_thread+24)
07-22 13:19:20.738 30366 30614 AudioTrack E AudioFlinger could not create track, status: -32 output -1248116776
07-22 13:19:20.739 30366 30614 AudioTrack W restoreTrack_l(): createTrack_l failed, do not retry
07-22 13:19:20.739 30366 30614 AudioTrack W restoreTrack_l() failed status -32, retries 0
07-22 13:19:20.739 30366 30614 AudioTrack E Error -32 obtaining an audio buffer, giving up.
07-22 13:19:20.739 2302 2313 AudioSystem W AudioFlinger server died!
07-22 13:19:20.739 30420 30451 AudioManager W updateAudioPortCache: listAudioPorts failed
07-22 13:19:20.739 2890 4744 AudioSystem W AudioFlinger server died!
07-22 13:19:20.739 2302 2313 AudioSystem W AudioPolicyService server died!
07-22 13:19:20.740 30420 30451 AudioManager W updateAudioPortCache: listAudioPorts failed
07-22 13:19:20.740 30420 30451 AudioManager W updateAudioPortCache: listAudioPorts failed
07-22 13:19:20.740 30420 30433 AudioSystem W AudioPolicyService server died!
07-22 13:19:20.740 30366 30377 AudioSystem W AudioPolicyService server died!
07-22 13:19:20.740 2905 2930 AudioSystem W AudioFlinger server died!
07-22 13:19:20.740 30366 30366 AudioTrack W dead IAudioTrack, PCM, creating a new one from getPosition()
07-22 13:19:20.740 30366 30391 AudioManager W updateAudioPortCache: listAudioPorts failed
07-22 13:19:20.740 2302 2958 AudioManager W updateAudioPortCache: listAudioPorts failed
07-22 13:19:20.741 30366 30377 AudioSystem W AudioPolicyService server died!
07-22 13:19:21.747 30366 30628 AudioSystem W AudioFlinger server died!
07-22 13:19:21.747 30366 30628 AudioSystem W AudioFlinger server died!
07-22 13:19:21.747 30366 30628 AudioSystem W AudioFlinger server died!
07-22 13:19:21.782 30366 30366 AudioTrack I AUDIO_OUTPUT_FLAG_FAST successful; frameCount 1536 -> 1536
<<< onAudioDeviceUpdate() called >>>
07-22 13:19:21.783 30366 30612 AudioStreamLegacy D onAudioDeviceUpdate() deviceId 2
07-22 13:19:21.783 30366 30612 AudioStreamLegacy D onAudioDeviceUpdate() DISCONNECT the stream now
07-22 13:19:21.783 30366 30366 MYAPP:Core I no need to stop stream: ErrorDisconnected
<<< closing stream for device 128 >>>
07-22 13:19:21.783 30366 30366 MYAPP:Core I closing stream for device 128
07-22 13:19:21.783 30366 30366 AAudio D AAudioStream_close(0x4cca87f040) called ---------------
07-22 13:19:21.783 30366 30366 AAudioStream D destroying 0x4cca87f040, state = AAUDIO_STREAM_STATE_CLOSED
07-22 13:19:21.783 30366 30366 AAudio D AAudioStream_close(0x4cca87f040) returned 0 ---------
<<< destroying oboe streams >>>
07-22 13:19:21.784 30366 30366 MYAPP:Core D oboe stream destructor
07-22 13:19:21.784 30366 30366 MYAPP:Core D oboe stream destructor
<<< both oboe shared pointers were reset >>>
<<< my app now stops BT SCO >>>
07-22 13:19:21.784 30366 30366 MYAPP:BluetoothController D stopping bluetooth sco
07-22 13:19:21.784 30366 30366 AudioManager I In stopBluetoothSco(), calling application: tech.boring.boringaudio
07-22 13:19:21.785 2302 3483 AudioService I In stopBluetoothSco()
07-22 13:19:21.786 2302 3483 AudioService I In decCount(), mStartcount: 1
07-22 13:19:21.786 2302 3483 AudioService I In requestScoState(), state: 10, scoAudioMode: 0
07-22 13:19:21.786 2302 3483 AudioService I In checkScoAudioState(), mScoAudioState: 3
07-22 13:19:21.786 2302 3483 AudioService I In totalCount(), count: 0
07-22 13:19:21.786 2302 3483 AudioService I In disconnectBluetoothScoAudioHelper(), scoAudioMode: 0, bluetoothHeadset: android.bluetooth.BluetoothHeadset@e56199e, BluetoothDevice: BC:B8:63:46:6E:85
07-22 13:19:21.786 2302 3483 AudioService I In disconnectBluetoothScoAudioHelper(), calling stopScoUsingVirtualVoiceCall()
<<< it seems that here oboe callback is called after the stream was destroyed >>>
07-22 13:19:21.787 30366 30795 OboeAudio D oboe_aaudio_error_thread_proc() - entering >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<< sanitizer is not happy >>>
07-22 13:19:21.789 30361 30361 wrap.sh I FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x4fca929940)
07-22 13:19:21.790 30361 30361 wrap.sh I frameworks/av/media/libaaudio/src/legacy/AudioStreamLegacy.cpp:219:5: runtime error: control flow integrity check for type 'aaudio::AudioStream' failed during non-virtual call (vtable address 0x00724680004f)
07-22 13:19:21.790 30361 30361 wrap.sh I 0x00724680004f: note: invalid vtable
07-22 13:19:21.790 30361 30361 wrap.sh I <memory cannot be printed>
07-22 13:19:21.793 30366 30366 AudioManager I In setBluetoothScoOn(), on: false, calling application: tech.boring.boringaudio
07-22 13:19:21.794 2302 3481 AudioService D setBluetoothScoOn Permission Denial for pid = 30366, uid = 10338
07-22 13:19:21.794 2302 3481 AudioService I In setBluetoothScoOn(), on: false. The calling application Uid: 10338, is greater than FIRST_APPLICATION_UID exiting from setBluetoothScoOn()
07-22 13:19:21.794 2302 3481 AudioService I In setbluetoothScoOn(), mForcedUseForCommExt: 0
07-22 13:19:21.925 30420 30479 AudioManager I In isSpeakerphoneOn(), calling application: com.android.bluetooth
07-22 13:19:21.925 2302 3481 AudioService I In isSpeakerphoneOn(), mForcedUseForCommExt: 0
<<< sanitizer still doesn't like it >>>
07-22 13:19:21.934 30361 30361 wrap.sh I frameworks/av/media/libaaudio/src/legacy/AudioStreamLegacy.cpp:219:5: note: check failed in /system/lib64/libaaudio.so, vtable located in (unknown)
07-22 13:19:21.934 30361 30361 wrap.sh I SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior frameworks/av/media/libaaudio/src/legacy/AudioStreamLegacy.cpp:219:5 in
07-22 13:19:21.937 2302 2302 AudioService I device:BC:B8:63:46:6E:85
07-22 13:19:21.938 2302 2302 AudioService I checkAndUpdatTwsPlusScoState returns true
07-22 13:19:21.938 2302 2302 AudioService I In setBluetoothScoOn(), eventSource: setBluetoothScoOn(false) from u/pid:1000/2302
07-22 13:19:21.938 2302 2302 AudioService I setBluetoothScoOnInt: false setBluetoothScoOn(false) from u/pid:1000/2302
07-22 13:19:21.938 2302 2302 AudioService I In setbluetoothScoOnInt(), mForcedUseForCommExt: 0
07-22 13:19:21.943 2302 2302 AudioService I In clearCount(), stopSco: false, mStartcount: 0
07-22 13:19:21.943 2302 2302 AudioService I Audio-path brought-down
07-22 13:19:21.943 2302 2302 AudioService I In onReceive(), mScoAudioState: 0, broadcast: true
07-22 13:19:21.943 2302 2426 AudioService E Audioserver started.
<<< finally onErrorBeforeClose() is called on my class, tries to lock a mutex, and fails because it's already destroyed >>>
07-22 13:19:22.179 30803 30803 DEBUG F *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-22 13:19:22.179 30803 30803 DEBUG F Build fingerprint: 'xiaomi/lavender/lavender:9/PKQ1.180904.001/V11.0.6.0.PFGMIXM:user/release-keys'
07-22 13:19:22.179 30803 30803 DEBUG F Revision: '0'
07-22 13:19:22.179 30803 30803 DEBUG F ABI: 'arm64'
07-22 13:19:22.179 30803 30803 DEBUG F pid: 30366, tid: 30795, name: Binder:30366_4 >>> tech.boring.boringaudio <<<
07-22 13:19:22.179 30803 30803 DEBUG F signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-22 13:19:22.180 30803 30803 DEBUG F Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x4fca929940)'
07-22 13:19:22.180 30803 30803 DEBUG F x0 0000000000000000 x1 000000000000784b x2 0000000000000006 x3 0000000000000008
07-22 13:19:22.180 30803 30803 DEBUG F x4 0000000000008000 x5 0000000000008000 x6 0000000000008000 x7 0000000000000038
07-22 13:19:22.180 30803 30803 DEBUG F x8 0000000000000083 x9 d1059fcae7630153 x10 0000000000000000 x11 fffffffc7ffffbdf
07-22 13:19:22.180 30803 30803 DEBUG F x12 0000000000000001 x13 0000001e6ab8a808 x14 0000000000000000 x15 0000000000000007
07-22 13:19:22.180 30803 30803 DEBUG F x16 00000073534672b0 x17 0000007353386cd0 x18 0000000000000010 x19 000000000000769e
07-22 13:19:22.181 30803 30803 DEBUG F x20 000000000000784b x21 00000072b50b8588 x22 00000072b4757628 x23 000000735387c88c
07-22 13:19:22.181 30803 30803 DEBUG F x24 00000072b50b8570 x25 00000072b4fbb000 x26 00000072b4758588 x27 0000000000000000
07-22 13:19:22.181 30803 30803 DEBUG F x28 000000000000dd50 x29 00000072b50b8210
07-22 13:19:22.181 30803 30803 DEBUG F sp 00000072b50b81d0 lr 000000735337a144 pc 000000735337a16c
07-22 13:19:22.185 30803 30803 DEBUG F backtrace:
07-22 13:19:22.185 30803 30803 DEBUG F #00 pc 000000000002216c /system/lib64/libc.so (abort+116)
07-22 13:19:22.185 30803 30803 DEBUG F #01 pc 00000000000919e8 /system/lib64/libc.so (__fortify_fatal(char const*, ...)+120)
07-22 13:19:22.185 30803 30803 DEBUG F #02 pc 0000000000091050 /system/lib64/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+52)
07-22 13:19:22.185 30803 30803 DEBUG F #03 pc 0000000000090ecc /system/lib64/libc.so (pthread_mutex_lock+228)
07-22 13:19:22.185 30803 30803 DEBUG F #04 pc 000000000018dd0c /data/app/tech.boring.boringaudio-csuMIRDDKG2QLeTG1hLEdw==/lib/arm64/lib MYAPP.so (std::__ndk1::mutex::lock()+8)
07-22 13:19:22.185 30803 30803 DEBUG F #05 pc 00000000000e85f8 /data/app/tech.boring.boringaudio-csuMIRDDKG2QLeTG1hLEdw==/lib/arm64/lib MYAPP.so
07-22 13:19:22.185 30803 30803 DEBUG F #06 pc 000000000013a16c /data/app/tech.boring.boringaudio-csuMIRDDKG2QLeTG1hLEdw==/lib/arm64/lib MYAPP.so (tech::boring::boringaudio::OboeStream::onErrorBeforeClose(oboe::AudioStream*, oboe::Result)+52)
07-22 13:19:22.185 30803 30803 DEBUG F #07 pc 000000000014af48 /data/app/tech.boring.boringaudio-csuMIRDDKG2QLeTG1hLEdw==/lib/arm64/lib MYAPP.so
07-22 13:19:22.185 30803 30803 DEBUG F #08 pc 000000000014c4c8 /data/app/tech.boring.boringaudio-csuMIRDDKG2QLeTG1hLEdw==/lib/arm64/lib MYAPP.so (_ZNSt6__ndk114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEPFvNS_10shared_ptrIN4oboe11AudioStreamEEENS8_6ResultEESA_SB_EEEEEPvSF_+80)
07-22 13:19:22.185 30803 30803 DEBUG F #09 pc 0000000000090328 /system/lib64/libc.so (__pthread_start(void*)+36)
07-22 13:19:22.185 30803 30803 DEBUG F #10 pc 0000000000023a28 /system/lib64/libc.so (__start_thread+68)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment