0

我正在使用这个项目在 android 设备上编写音乐流应用程序:https ://github.com/spotify/psyonspotify

不幸的是,我的应用程序随机崩溃。我试图用 ndk-stack 调试 c 代码。根据输出,问题出在以下行:

assert(SL_RESULT_SUCCESS != result);

(sounddriver.cpp 中的 l.92)。我试图更改和/或注释掉这一行,但错误仍然存​​在......

这似乎是与不正确的内存分配有关的某种问题,但它似乎与缓冲区大小没有任何关系,因为似乎还有足够的存储大小(请参阅日志输出)

09-03 20:00:50.556: I/DEBUG(4356): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-03 20:00:50.556: I/DEBUG(4356): Build fingerprint: 'samsung/p4notewifixx/p4notewifiww:4.1.2/JZO54K/N8010XXUCMH2:user/release-keys'
09-03 20:00:50.556: I/DEBUG(4356): pid: 2103, tid: 2204, name: Network Thread  >>> com.masterarbeit.wheel4tunes <<<
09-03 20:00:50.556: I/DEBUG(4356): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
09-03 20:00:50.576: D/dalvikvm(2150): GC_EXPLICIT freed 122K, 43% free 29046K/50183K, paused 3ms+8ms, total 123ms
09-03 20:00:50.636: I/DEBUG(4356):     r0 00000027  r1 deadbaad  r2 40115b0c  r3 00000000
09-03 20:00:50.636: I/DEBUG(4356):     r4 00000000  r5 5e791acc  r6 00000800  r7 00000002
09-03 20:00:50.636: I/DEBUG(4356):     r8 00000000  r9 00000001  sl 00004e1f  fp 5e791b1c
09-03 20:00:50.636: I/DEBUG(4356):     ip 00004000  sp 5e791ac8  lr 400e7c65  pc 400e42fe  cpsr 60000030
09-03 20:00:50.636: I/DEBUG(4356):     d0  3f7aaaab0142ff80  d1  3ff0000042c80000
09-03 20:00:50.636: I/DEBUG(4356):     d2  000000003f800000  d3  443c000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d4  0000000000000000  d5  3f80000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d6  3f80000000000000  d7  0142ff803f800000
09-03 20:00:50.636: I/DEBUG(4356):     d8  0000000000000000  d9  0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d10 0000000000000000  d11 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d12 0000000000000000  d13 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d14 0000000000000000  d15 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d16 41742ff808000000  d17 3fe0000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d18 0000000000000000  d19 2000000840070c00
09-03 20:00:50.636: I/DEBUG(4356):     d20 0000000000000000  d21 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d22 0000000000000000  d23 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d24 0000000000000000  d25 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d26 0000000000000000  d27 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d28 0000000000000000  d29 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     d30 0000000000000000  d31 0000000000000000
09-03 20:00:50.636: I/DEBUG(4356):     scr 20000010
09-03 20:00:50.641: I/DEBUG(4356): backtrace:
09-03 20:00:50.641: I/DEBUG(4356):     #00  pc 000182fe  /system/lib/libc.so
09-03 20:00:50.641: I/DEBUG(4356):     #01  pc 0000dc04  /system/lib/libc.so (abort+4)
09-03 20:00:50.641: I/DEBUG(4356):     #02  pc 0001f0bf  /system/lib/libc.so (__assert2+30)
09-03 20:00:50.641: I/DEBUG(4356):     #03  pc 000121f0  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so (enqueue(short*, int)+176)
09-03 20:00:50.641: I/DEBUG(4356):     #04  pc 00012568  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so (music_delivery(sp_session*, sp_audioformat const*, void const*, int)+620)
09-03 20:00:50.641: I/DEBUG(4356):     #05  pc 00168758  /data/data/com.masterarbeit.wheel4tunes/lib/libspotify.so
09-03 20:00:50.641: I/DEBUG(4356): stack:
09-03 20:00:50.641: I/DEBUG(4356):          5e791a88  5aa21e70  
09-03 20:00:50.641: I/DEBUG(4356):          5e791a8c  5a1b1d2c  /system/framework/twframework-res.apk
09-03 20:00:50.641: I/DEBUG(4356):          5e791a90  40004fb0  
09-03 20:00:50.641: I/DEBUG(4356):          5e791a94  00000000  
09-03 20:00:50.641: I/DEBUG(4356):          5e791a98  00000000  
09-03 20:00:50.641: I/DEBUG(4356):          5e791a9c  00000000  
09-03 20:00:50.641: I/DEBUG(4356):          5e791aa0  40110774  /system/lib/libc.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791aa4  40115d10  
09-03 20:00:50.641: I/DEBUG(4356):          5e791aa8  00000000  
09-03 20:00:50.641: I/DEBUG(4356):          5e791aac  400e7c65  /system/lib/libc.so (_fwalk+32)
09-03 20:00:50.641: I/DEBUG(4356):          5e791ab0  00000001  
09-03 20:00:50.641: I/DEBUG(4356):          5e791ab4  5e791acc  
09-03 20:00:50.641: I/DEBUG(4356):          5e791ab8  00000800  
09-03 20:00:50.641: I/DEBUG(4356):          5e791abc  00000002  
09-03 20:00:50.641: I/DEBUG(4356):          5e791ac0  df0027ad  
09-03 20:00:50.641: I/DEBUG(4356):          5e791ac4  00000000  
09-03 20:00:50.641: I/DEBUG(4356):     #00  5e791ac8  5e3e1e48  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791acc  fffffbdf  
09-03 20:00:50.641: I/DEBUG(4356):          5e791ad0  40106ecc  /system/lib/libc.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791ad4  00000800  
09-03 20:00:50.641: I/DEBUG(4356):          5e791ad8  00000002  
09-03 20:00:50.641: I/DEBUG(4356):          5e791adc  400e71d1  /system/lib/libc.so (fprintf+16)
09-03 20:00:50.641: I/DEBUG(4356):          5e791ae0  40110718  /system/lib/libc.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791ae4  5e3e1e48  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791ae8  40106ecc  /system/lib/libc.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791aec  400d9c08  /system/lib/libc.so (__pthread_clone)
09-03 20:00:50.641: I/DEBUG(4356):     #01  5e791af0  5e791af0  
09-03 20:00:50.641: I/DEBUG(4356):          5e791af4  400eb0c3  /system/lib/libc.so (__assert2+34)
09-03 20:00:50.641: I/DEBUG(4356):     #02  5e791af8  0000005c  
09-03 20:00:50.641: I/DEBUG(4356):          5e791afc  5e3e2178  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so
09-03 20:00:50.641: I/DEBUG(4356):          5e791b00  5e3e2178  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so
09-03 20:00:50.646: I/DEBUG(4356):          5e791b04  5e3d91f4  /data/data/com.masterarbeit.wheel4tunes/lib/libspotifywrapper.so (enqueue(short*, int)+180)
09-03 20:00:50.646: I/DEBUG(4356): memory near r2:
09-03 20:00:50.646: I/DEBUG(4356):     40115aec 00000000 00000000 00000000 00000000  ................
09-03 20:00:50.646: I/DEBUG(4356):     40115afc 00000000 00000000 00000000 00000000  ................
09-03 20:00:50.646: I/DEBUG(4356):     40115b0c 00000001 00000000 00000000 00000000  ................
09-03 20:00:50.646: I/DEBUG(4356):     40115b1c 00000000 00000000 00000000 00000000  ................
09-03 20:00:50.646: I/DEBUG(4356):     40115b2c 00000000 00000000 00000000 00000000  ................
09-03 20:00:50.646: I/DEBUG(4356): memory near r5:
09-03 20:00:50.646: I/DEBUG(4356):     5e791aac 400e7c65 00000001 5e791acc 00000800  e|.@......y^....
09-03 20:00:50.646: I/DEBUG(4356):     5e791abc 00000002 df0027ad 00000000 5e3e1e48  .....'......H.>^
09-03 20:00:50.646: I/DEBUG(4356):     5e791acc fffffbdf 40106ecc 00000800 00000002  .....n.@........
09-03 20:00:50.646: I/DEBUG(4356):     5e791adc 400e71d1 40110718 5e3e1e48 40106ecc  .q.@...@H.>^.n.@
09-03 20:00:50.646: I/DEBUG(4356):     5e791aec 400d9c08 5e791af0 400eb0c3 0000005c  ...@..y^...@\...
09-03 20:00:50.646: I/DEBUG(4356): memory near sl:
09-03 20:00:50.646: I/DEBUG(4356):     00004dfc ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.646: I/DEBUG(4356):     00004e0c ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.646: I/DEBUG(4356):     00004e1c ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.646: I/DEBUG(4356):     00004e2c ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.646: I/DEBUG(4356):     00004e3c ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.646: I/DEBUG(4356): memory near fp:
09-03 20:00:50.646: I/DEBUG(4356):     5e791afc 5e3e2178 5e3e2178 5e3d91f4 0000c000  x!>^x!>^..=^....
09-03 20:00:50.646: I/DEBUG(4356):     5e791b0c 5e3e50c0 5e3e1f18 00000000 5e791b3c  .P>^..>^....<.y^
09-03 20:00:50.646: I/DEBUG(4356):     5e791b1c 5e3d956c 00000800 5f44b10c 5e791b44  l.=^......D_D.y^
09-03 20:00:50.646: I/DEBUG(4356):     5e791b2c 40004698 00002000 0000c000 00000004  .F.@. ..........
09-03 20:00:50.646: I/DEBUG(4356):     5e791b3c 5e32975c 00000000 00000000 0000ac44  \.2^........D...
09-03 20:00:50.646: I/DEBUG(4356): memory near ip:
09-03 20:00:50.646: I/DEBUG(4356):     00003fe0 ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.646: I/DEBUG(4356):     00003ff0 ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.651: I/DEBUG(4356):     00004000 ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.651: I/DEBUG(4356):     00004010 ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.651: I/DEBUG(4356):     00004020 ffffffff ffffffff ffffffff ffffffff  ................
09-03 20:00:50.651: I/DEBUG(4356): memory near sp:
09-03 20:00:50.651: I/DEBUG(4356):     5e791aa8 00000000 400e7c65 00000001 5e791acc  ....e|.@......y^
09-03 20:00:50.651: I/DEBUG(4356):     5e791ab8 00000800 00000002 df0027ad 00000000  .........'......
09-03 20:00:50.651: I/DEBUG(4356):     5e791ac8 5e3e1e48 fffffbdf 40106ecc 00000800  H.>^.....n.@....
09-03 20:00:50.651: I/DEBUG(4356):     5e791ad8 00000002 400e71d1 40110718 5e3e1e48  .....q.@...@H.>^
09-03 20:00:50.651: I/DEBUG(4356):     5e791ae8 40106ecc 400d9c08 5e791af0 400eb0c3  .n.@...@..y^...@
09-03 20:00:50.651: I/DEBUG(4356): code around pc:
09-03 20:00:50.651: I/DEBUG(4356):     400e42dc e000b164 6823461c d1fb2b00 68e3e026  d....F#h.+..&..h
09-03 20:00:50.651: I/DEBUG(4356):     400e42ec 4a17b123 447a2401 47986014 20274911  #..J.$zD.`.G.I' 
09-03 20:00:50.651: I/DEBUG(4356):     400e42fc 70082400 ebb2f7f4 f7f52106 a902ecf2  .$.p.....!......
09-03 20:00:50.651: I/DEBUG(4356):     400e430c f04f2006 460a5380 94029304 f7f59403  . O..S.F........
09-03 20:00:50.651: I/DEBUG(4356):     400e431c 4629e8d0 20024622 e8d8f7f5 eb9ef7f4  ..)F"F. ........
09-03 20:00:50.651: I/DEBUG(4356): code around lr:
09-03 20:00:50.651: I/DEBUG(4356):     400e7c44 41f0e92d 4c0b2600 447c4680 68a56824  -..A.&.L.F|D$h.h
09-03 20:00:50.651: I/DEBUG(4356):     400e7c54 e0076867 300cf9b5 dd022b00 47c04628  gh.....0.+..(F.G
09-03 20:00:50.651: I/DEBUG(4356):     400e7c64 35544306 d5f53f01 2c006824 4630d1ef  .CT5.?..$h.,..0F
09-03 20:00:50.651: I/DEBUG(4356):     400e7c74 81f0e8bd 000288b2 43f0e92d fb01461f  ........-..C.F..
09-03 20:00:50.651: I/DEBUG(4356):     400e7c84 f8dff602 b0878058 44f8460c 8000f8d8  ....X....F.D....
09-03 20:00:50.651: I/DEBUG(4356): memory map around fault addr deadbaad:
09-03 20:00:50.651: I/DEBUG(4356):     beb7b000-beb9c000 [stack]
09-03 20:00:50.651: I/DEBUG(4356):     (no map for address)
09-03 20:00:50.651: I/DEBUG(4356):     ffff0000-ffff1000 [vectors]

不幸的是,我在处理或调试 c 代码方面不是很有经验。如果有人能指出我正确的方向,那就太好了!谢谢。

4

1 回答 1

0

如果assert(SL_RESULT_SUCCESS != result);正在触发,则与您的问题有关SLresult result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer, size);

SLAndroidSimpleBufferQueueItf在 OpenSL 中实现。在尝试排入缓冲区之前,您是否使用 init_audio_player() 正确初始化了音频播放器?

SLAndroidSimpleBufferQueueItf调试的一些想法:在调用 Enqueue 之前探索以了解其接口并验证所有假设都已满足。还要寻找它提供的其他返回码。如果它提供了一个有用的错误代码,这将使您的生活更轻松。

还要查看您如何调用 psyonspotify.so 以确保您正确遵守其接口和假设(即所需的任何 init 函数)。

于 2013-09-25T16:50:05.440 回答