gpt4 book ai didi

android - OpenSL ES - 安卓工作室 - NDK 10R

转载 作者:太空宇宙 更新时间:2023-11-04 13:21:58 25 4
gpt4 key购买 nike

我有一个工作的 OPENSL ES 声音引擎在我的 Eclipse 中的旧项目上工作,用 android NDK 9 编译。它在那里工作正常,使用那个配置。

当我将项目转移到 Android studio 时,当我尝试播放任何声音时,它会在尝试 CreateAudioPlayer 时崩溃。除了声音问题,一切正常。

我使用的是 Android Studio 1.5.1,带有 com.android.tools.build:gradle-experimental:0.4.0 插件和 NDK 10 R(最新版本)。

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);

我检查了文件描述符值、ids 值、进入 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 编译它时它工作正常。

有人遇到过这样的问题吗?

谢谢。

最佳答案

我在 Android studio 中用支持 multiDex 和 OpenSL ES 的 9d 版本编译了它。现在工作正常。

关于android - OpenSL ES - 安卓工作室 - NDK 10R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34935401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com