在三星Galaxy Note 8上加载WAV文件时Soundpool崩溃

时间:2017-09-27 19:43:54

标签: android wav soundpool

我使用SoundPool对象加载2个wav文件,如下所示:

 public RingtoneManager(Context context) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        soundPool = createSoundPool();
    } else {
        soundPool = createLegacySoundPool();
    }

    RING_OUT = soundPool.load(context, R.raw.groovy, 1);
    sounds.put(RING_OUT, -1);

    RING_IN = soundPool.load(context, R.raw.ring_ring_wav, 1); // crashes on this line
    sounds.put(RING_IN, -1);

}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected SoundPool createSoundPool() {

    Logger.log(TAG, "createSoundPool load attributes");
    AudioAttributes attributes = new AudioAttributes.Builder()
            .setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING)
            .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
            .build();

    Logger.log(TAG, "build soundpool");
    return new SoundPool.Builder()
            .setAudioAttributes(attributes)
            .build();
}

@SuppressWarnings("deprecation")
protected SoundPool createLegacySoundPool() {
    Logger.log(TAG, "createLegacySoundPool");
    return new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
}

我在使用此代码的设备上没有任何问题,直到最近我在新的Samsung Galaxy Note 8上进行了测试。当尝试使用以下堆栈跟踪加载ring_ring_wav.wav文件时,它始终崩溃:

    09-27 20:30:20.033 23644-23644/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-27 20:30:20.033 23644-23644/? A/DEBUG: Build fingerprint: 'samsung/greatltexx/greatlte:7.1.1/NMF26X/N950FXXU1AQI1:user/release-keys'
09-27 20:30:20.033 23644-23644/? A/DEBUG: Revision: '9'
09-27 20:30:20.033 23644-23644/? A/DEBUG: ABI: 'arm'
09-27 20:30:20.034 23644-23644/? A/DEBUG: pid: 23526, tid: 23629, name: SoundPoolThread  >>> com.wizix.gridme <<<
09-27 20:30:20.034 23644-23644/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
09-27 20:30:20.041 23644-23644/? A/DEBUG: Abort message: 'buffer(0xddf28068) localRefcount 1 != 0, remoteRefcount 0'
09-27 20:30:20.041 23644-23644/? A/DEBUG:     r0 00000000  r1 00005c4d  r2 00000006  r3 00000008
09-27 20:30:20.041 23644-23644/? A/DEBUG:     r4 c59b9978  r5 00000006  r6 c59b9920  r7 0000010c
09-27 20:30:20.041 23644-23644/? A/DEBUG:     r8 c6018120  r9 e7ae5ee6  sl e7ae5fb0  fp c9e716b0
09-27 20:30:20.041 23644-23644/? A/DEBUG:     ip 00000000  sp c59b92f0  lr e9ff1097  pc e9ff38f4  cpsr 200e0010
09-27 20:30:20.052 23644-23644/? A/DEBUG: backtrace:
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #00 pc 0004a8f4  /system/lib/libc.so (tgkill+12)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #01 pc 00048093  /system/lib/libc.so (pthread_kill+34)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #02 pc 0001db6d  /system/lib/libc.so (raise+10)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #03 pc 00019271  /system/lib/libc.so (__libc_android_abort+34)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #04 pc 0001718c  /system/lib/libc.so (abort+4)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #05 pc 0000c971  /system/lib/libcutils.so (__android_log_assert+112)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #06 pc 00018355  /system/lib/libstagefright_foundation.so (_ZN7android16MediaBufferGroupD1Ev+168)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #07 pc 00018399  /system/lib/libstagefright_foundation.so (_ZN7android16MediaBufferGroupD0Ev+2)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #08 pc 00121eb1  /system/lib/libstagefright.so (_ZN7android9WAVSource4stopEv+20)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #09 pc 00121aeb  /system/lib/libstagefright.so (_ZN7android9WAVSourceD2Ev+34)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #10 pc 00121bd7  /system/lib/libstagefright.so (_ZTv0_n12_N7android9WAVSourceD0Ev+18)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #11 pc 0000bd87  /system/lib/libutils.so (_ZNK7android7RefBase9decStrongEPKv+58)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #12 pc 0000520b  /system/lib/libsoundextractor.so (_ZN7android20SoundExtractorParserD1Ev+46)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #13 pc 00005343  /system/lib/libsoundextractor.so (_ZN7android23SoundExtractorMp3ParserD0Ev+2)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #14 pc 0000bd87  /system/lib/libutils.so (_ZNK7android7RefBase9decStrongEPKv+58)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #15 pc 00005b31  /system/lib/libsoundextractor.so (_ZN7android19SoundExtractorCodecD1Ev+24)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #16 pc 00005bdb  /system/lib/libsoundextractor.so (_ZN7android22SoundExtractorRawCodecD0Ev+2)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #17 pc 0000bd87  /system/lib/libutils.so (_ZNK7android7RefBase9decStrongEPKv+58)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #18 pc 0000513d  /system/lib/libsoundextractor.so (_ZN7android14SoundExtractor7releaseEv+12)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #19 pc 00005ecf  /system/lib/libsoundpool.so (_ZN7android6Sample6doLoadEv+258)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #20 pc 000069ad  /system/lib/libsoundpool.so (_ZN7android15SoundPoolThread12doLoadSampleEi+32)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #21 pc 0000695f  /system/lib/libsoundpool.so (_ZN7android15SoundPoolThread3runEv+18)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #22 pc 000068e7  /system/lib/libsoundpool.so (_ZN7android15SoundPoolThread11beginThreadEPv+2)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #23 pc 0006b65d  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+80)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #24 pc 00047b63  /system/lib/libc.so (_ZL15__pthread_startPv+22)
09-27 20:30:20.053 23644-23644/? A/DEBUG:     #25 pc 00019ee1  /system/lib/libc.so (__start_thread+6)

如果我将文件直接下载到设备,它可以通过Chrome播放。另一个wav文件加载并在soundpool中正常播放。

1 个答案:

答案 0 :(得分:0)

我也是。它只发生在三星Galaxy Note 8上。 编辑:声音是wav类型。


我的代码很简单

SoundPool soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
soundPool.load(activity, R.raw.music01, 1);


崩溃日志:

12-04 15:33:10.226 28617-29183/com.company.appname D/MediaBufferGroup: creating MemoryDealer
12-04 15:33:10.232 28617-29183/com.company.appname A/MediaBufferGroup: buffer(0xaf561118) localRefcount 1 != 0, remoteRefcount 0
12-04 15:33:10.308 3823-4594/? E/Watchdog: !@Sync 237 [2017-12-04 15:33:10.308]

                                           --------- beginning of crash
12-04 15:33:10.395 29207-29183/? A/google-breakpad: Microdump skipped (uninteresting)
12-04 15:33:10.417 28617-29183/com.company.appname W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
12-04 15:33:10.417 28617-29183/com.company.appname W/google-breakpad: Chrome build fingerprint:
12-04 15:33:10.417 28617-29183/com.company.appname W/google-breakpad: 1.0.0
12-04 15:33:10.417 28617-29183/com.company.appname W/google-breakpad: 1
12-04 15:33:10.417 28617-29183/com.company.appname W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
12-04 15:33:10.419 28617-29183/com.company.appname A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 29183 (SoundPoolThread)

                                                        [ 12-04 15:33:10.422  3230: 3230 W/         ]
                                                        debuggerd: handling request: pid=28617 uid=10215 gid=10215 tid=29183
12-04 15:33:10.492 3426-3426/? E/audit: type=1400 audit(1512369190.486:741): avc:  denied  { search } for  pid=29208 comm="debuggerd" name="com.company.appname" dev="dm-1" ino=1310724 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 SEPF_SECMOBILE_7.1.1_0001 audit_filtered
12-04 15:33:10.493 3426-3426/? E/audit: type=1300 audit(1512369190.486:741): arch=40000028 syscall=322 per=8 success=no exit=-13 a0=ffffff9c a1=f4c97880 a2=20000 a3=0 items=0 ppid=3230 pid=29208 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="debuggerd" exe="/system/bin/debuggerd" subj=u:r:debuggerd:s0 key=(null)
12-04 15:33:10.493 3426-3426/? E/audit: type=1327 audit(1512369190.486:741): proctitle="/system/bin/debuggerd"
12-04 15:33:10.618 29208-29208/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-04 15:33:10.619 29208-29208/? A/DEBUG: Build fingerprint: 'samsung/greatlteks/greatlteks:7.1.1/NMF26X/N950NKSU1AQI2:user/release-keys'
12-04 15:33:10.619 29208-29208/? A/DEBUG: Revision: '9'
12-04 15:33:10.619 29208-29208/? A/DEBUG: ABI: 'arm'
12-04 15:33:10.619 29208-29208/? A/DEBUG: pid: 28617, tid: 29183, name: SoundPoolThread  >>> com.company.appname <<<
12-04 15:33:10.619 29208-29208/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
12-04 15:33:10.625 29208-29208/? A/DEBUG: Abort message: 'buffer(0xaf561118) localRefcount 1 != 0, remoteRefcount 0'
12-04 15:33:10.625 29208-29208/? A/DEBUG:     r0 00000000  r1 000071ff  r2 00000006  r3 00000008
12-04 15:33:10.626 29208-29208/? A/DEBUG:     r4 b0800978  r5 00000006  r6 b0800920  r7 0000010c
12-04 15:33:10.626 29208-29208/? A/DEBUG:     r8 af52b4c0  r9 e9459ee6  sl e9459fb0  fp ae9ffd70
12-04 15:33:10.626 29208-29208/? A/DEBUG:     ip 00000000  sp b08002f0  lr e76da097  pc e76dc8f4  cpsr 20070010
12-04 15:33:10.636 29208-29208/? A/DEBUG: backtrace:
12-04 15:33:10.636 29208-29208/? A/DEBUG:     #00 pc 0004a8f4  /system/lib/libc.so (tgkill+12)
12-04 15:33:10.636 29208-29208/? A/DEBUG:     #01 pc 00048093  /system/lib/libc.so (pthread_kill+34)
12-04 15:33:10.636 29208-29208/? A/DEBUG:     #02 pc 0001db6d  /system/lib/libc.so (raise+10)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #03 pc 00019271  /system/lib/libc.so (__libc_android_abort+34)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #04 pc 0001718c  /system/lib/libc.so (abort+4)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #05 pc 0000c971  /system/lib/libcutils.so (__android_log_assert+112)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #06 pc 00018355  /system/lib/libstagefright_foundation.so (_ZN7android16MediaBufferGroupD1Ev+168)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #07 pc 00018399  /system/lib/libstagefright_foundation.so (_ZN7android16MediaBufferGroupD0Ev+2)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #08 pc 001220b1  /system/lib/libstagefright.so (_ZN7android9WAVSource4stopEv+20)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #09 pc 00121ceb  /system/lib/libstagefright.so (_ZN7android9WAVSourceD2Ev+34)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #10 pc 00121dd7  /system/lib/libstagefright.so (_ZTv0_n12_N7android9WAVSourceD0Ev+18)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #11 pc 0000bd87  /system/lib/libutils.so (_ZNK7android7RefBase9decStrongEPKv+58)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #12 pc 0000520b  /system/lib/libsoundextractor.so (_ZN7android20SoundExtractorParserD1Ev+46)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #13 pc 00005343  /system/lib/libsoundextractor.so (_ZN7android23SoundExtractorMp3ParserD0Ev+2)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #14 pc 0000bd87  /system/lib/libutils.so (_ZNK7android7RefBase9decStrongEPKv+58)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #15 pc 00005b31  /system/lib/libsoundextractor.so (_ZN7android19SoundExtractorCodecD1Ev+24)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #16 pc 00005bdb  /system/lib/libsoundextractor.so (_ZN7android22SoundExtractorRawCodecD0Ev+2)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #17 pc 0000bd87  /system/lib/libutils.so (_ZNK7android7RefBase9decStrongEPKv+58)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #18 pc 0000513d  /system/lib/libsoundextractor.so (_ZN7android14SoundExtractor7releaseEv+12)
12-04 15:33:10.637 29208-29208/? A/DEBUG:     #19 pc 00005ecf  /system/lib/libsoundpool.so (_ZN7android6Sample6doLoadEv+258)
12-04 15:33:10.638 29208-29208/? A/DEBUG:     #20 pc 000069ad  /system/lib/libsoundpool.so (_ZN7android15SoundPoolThread12doLoadSampleEi+32)
12-04 15:33:10.638 29208-29208/? A/DEBUG:     #21 pc 0000695f  /system/lib/libsoundpool.so (_ZN7android15SoundPoolThread3runEv+18)
12-04 15:33:10.638 29208-29208/? A/DEBUG:     #22 pc 000068e7  /system/lib/libsoundpool.so (_ZN7android15SoundPoolThread11beginThreadEPv+2)
12-04 15:33:10.638 29208-29208/? A/DEBUG:     #23 pc 0006b65d  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+80)
12-04 15:33:10.638 29208-29208/? A/DEBUG:     #24 pc 00047b63  /system/lib/libc.so (_ZL15__pthread_startPv+22)
12-04 15:33:10.638 29208-29208/? A/DEBUG:     #25 pc 00019ee1  /system/lib/libc.so (__start_thread+6)