我必须维护一个使用MediaSessionCompat
和MediaPlayer
来从服务器流音频文件的应用程序。
我在Pixel XL和Nexus 5(API 23)上重现了一个错误,该错误在运行(API 27)的同一设备上不会发生。我听说有一个运行API 28的XL用户也遇到过这样的报告。
当有电话打进来时,应用无法屏蔽它,所以我们暂停了。在API 27上,调用结束,该应用获得音频焦点,然后我们再次开始播放。在API 23(和28(我尚未确认))上,调用结束后,Media Server崩溃,错误为100(MEDIA_ERROR_SERVER_DIED
)。每次通话结束时可靠地崩溃。
我不能做它的正面或反面。
有人知道为什么27岁就可以,但是23岁就可以吗?或者我可以采取什么措施来防止崩溃(而不是尝试在崩溃之后重新启动所有内容)?
堆栈跟踪看起来像这样
10-31 17:36:04.499 8062-8074/? A/AudioTrackShared: Assertion failed: buffer == NULL || buffer->mFrameCount == 0
10-31 17:36:04.499 8062-8074/? A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 8074 (FastMixer)
10-31 17:36:04.500 1362-1362/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-31 17:36:04.500 1362-1362/? A/DEBUG: Build fingerprint: 'Android/sdk_google_phone_x86/generic_x86:6.0/MASTER/5056751:userdebug/test-keys'
10-31 17:36:04.500 1362-1362/? A/DEBUG: Revision: '0'
10-31 17:36:04.500 1362-1362/? A/DEBUG: ABI: 'x86'
10-31 17:36:04.500 1362-1362/? A/DEBUG: pid: 8062, tid: 8074, name: FastMixer >>> /system/bin/mediaserver <<<
10-31 17:36:04.500 1362-1362/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
10-31 17:36:04.500 1639-1727/system_process W/NativeCrashListener: Couldn't find ProcessRecord for pid 8062
10-31 17:36:04.502 1362-1362/? A/DEBUG: Abort message: 'Assertion failed: buffer == NULL || buffer->mFrameCount == 0'
10-31 17:36:04.502 1362-1362/? E/DEBUG: AM write failed: Broken pipe
10-31 17:36:04.502 1362-1362/? A/DEBUG: eax 00000000 ebx 00001f7e ecx 00001f8a edx 00000006
10-31 17:36:04.502 1362-1362/? A/DEBUG: esi b427f980 edi 00000000
10-31 17:36:04.502 1362-1362/? A/DEBUG: xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
10-31 17:36:04.502 1362-1362/? A/DEBUG: eip b6fb7f56 ebp 00001f8a esp b427ee80 flags 00200206
10-31 17:36:04.504 1362-1362/? A/DEBUG: backtrace:
10-31 17:36:04.504 1362-1362/? A/DEBUG: #00 pc 00083f56 /system/lib/libc.so (tgkill+22)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #01 pc 000815e8 /system/lib/libc.so (pthread_kill+70)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #02 pc 00027205 /system/lib/libc.so (raise+36)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #03 pc 000209e4 /system/lib/libc.so (abort+80)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #04 pc 0000cbc3 /system/lib/libcutils.so (__android_log_assert+128)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #05 pc 0008353d /system/lib/libmedia.so (android::ServerProxy::obtainBuffer(android::Proxy::Buffer*, bool)+669)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #06 pc 00053af7 /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #07 pc 00066155 /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #08 pc 0002630a /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #09 pc 00026d42 /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #10 pc 00025e93 /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #11 pc 0006c19a /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #12 pc 0006d88f /system/lib/libaudioflinger.so
10-31 17:36:04.504 1362-1362/? A/DEBUG: #13 pc 00014aac /system/lib/libutils.so (android::Thread::_threadLoop(void*)+418)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #14 pc 000141cf /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+122)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #15 pc 00080a93 /system/lib/libc.so (__pthread_start(void*)+56)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #16 pc 00021952 /system/lib/libc.so (__start_thread+25)
10-31 17:36:04.504 1362-1362/? A/DEBUG: #17 pc 000170b6 /system/lib/libc.so (__bionic_clone+70)