我有一个可以工作的OPENSL ES声音引擎,在Eclipse中的旧项目上工作,用android NDK 9编译,并且它在那个配置下工作得很好。
当我将这个项目转移到Android studio时,当我试图播放任何声音时,当它试图CreateAudioPlayer时就崩溃了。除了声音问题之外,一切都很正常。
我使用的是Android Studio1.5.1,带有com.android.tools.build:gradle-experimental:0.4.0插件和NDK10R(最新版本)。
SLDataLocator_AndroidFD loc_fd = {SL_DATALOCATOR_ANDROIDFD, _FileDescriptor, cache_FileDescriptorStart, cache_FileDescriptorLength};
SLDataFormat_MIME format_mime = {SL_DATAFORMAT_MIME, NULL, SL_CONTAINERTYPE_UNSPECIFIED};
audioSrc = {&loc_fd, &format_mime};
// configure audio sink
SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject};
SLDataSink audioSnk = {&loc_outmix, NULL};
// create audio player
const SLInterfaceID ids[3] = {SL_IID_SEEK, SL_IID_MUTESOLO, SL_IID_VOLUME};
const SLboolean req[3] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
LOG("Sound: error with %s", _SoundName);
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &uriPlayerObject, &audioSrc,&audioSnk, 3, ids, req);
LOG("playStream end");它在下面这一行崩溃:
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &uriPlayerObject, &audioSrc,&audioSnk, 3, ids, req);我已经检查了文件描述符值、ID值、进入CreateAudioPlayer函数的每个参数,在我看来一切都很正常。
LogCat没有给出任何合理的消息,这是日志:
01-20 20:59:34.705 6256-6287/com.test.full W/google- breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
01-20 20:59:34.706 6256-6287/com.test.full W/google-breakpad: Chrome build fingerprint:
01-20 20:59:34.706 6256-6287/com.test.full W/google-breakpad: 2
01-20 20:59:34.706 6256-6287/com.test.full W/google-breakpad: 869b37da-2f6d-4460-8f9f-e1bd9177efc1
01-20 20:59:34.706 6256-6287/com.test.full W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
01-20 20:59:34.706 6256-6287/com.test.full A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1 in tid 6287 (GLThread 2240)在我看来,问题出在Android NDK 10中,因为当我用版本9编译它时,它工作得很好。
有没有人遇到过这样的问题?
谢谢。
发布于 2016-01-28 02:26:28
我已经在Android studio中编译了支持multiDex和OpenSL ES的版本9d。它现在运行得很好。
https://stackoverflow.com/questions/34935401
复制相似问题