首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS上的Opus解码器正在崩溃,没有明显的原因。

iOS上的Opus解码器正在崩溃,没有明显的原因。
EN

Stack Overflow用户
提问于 2016-11-03 13:08:32
回答 1查看 724关注 0票数 6

我有一个简单的代码,可以将opus帧解码成音频样本。它在Android上工作,但在Unity3D iOS项目中崩溃,在常规iOS项目中不崩溃。

代码语言:javascript
复制
EXC_BAD_ACCESS (code=1, address=0x2f)

两个项目共享相同的opus静态库和头文件。

代码语言:javascript
复制
#include "opus.h"

int test1(){
    unsigned char opus_chunk[] = {0x68, 0x97, 0x50, 0x0d,
        0xba, 0xa4, 0x80, 0x0d, 0x31, 0x21, 0x9c, 0xcf, 0x74, 0x98, 0xda, 0xc6,
        0xd5, 0x27, 0xcb, 0xd9, 0x51, 0xd7, 0xce, 0x90, 0xc5, 0x58, 0x94, 0x53,
        0xb0, 0xe9, 0xb4, 0xe4, 0xf4, 0x42, 0x4d, 0xc7, 0xa4, 0x61, 0xfa, 0xfe};
    int len = sizeof(opus_chunk);
    short samples[5760];
    int err1;
    OpusDecoder *decoder;
    decoder = opus_decoder_create(48000, 1, &err1);
    int n = opus_decode(decoder, opus_chunk, len, samples, 5760, 0);
    opus_decoder_destroy(decoder);

}

堆栈跟踪:

代码语言:javascript
复制
#0  0x00b944ec in compute_allocation ()
#1  0x00c03698 in celt_decode_with_ec at ./opus_ios/build/src/opus-1.1.2/celt/celt_decoder.c:956
#2  0x00c2400c in opus_decode_frame at ./opus_ios/build/src/opus-1.1.2/src/opus_decoder.c:490
#3  0x00c24ea2 in opus_decode_native [inlined] at ./opus_ios/build/src/opus-1.1.2/src/opus_decoder.c:692
#4  0x00c24e80 in opus_decode at ./opus_ios/build/src/opus-1.1.2/src/opus_decoder.c:782

我比较了构建设置,并使它们几乎相同。

错误听起来像是--分配有问题。

opus_decoder_create能够分配OpusDecoder,但错误在opus_decode

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-19 22:20:54

这是由于符号冲突造成的。Unity3D库定义了一些符号,包括compute_allocation(),这些符号也是由libopus定义和使用的。如果Unity3D库在链接器命令行的libopus之前,那么它可能会使用该版本,这将不能与libopus一起工作。如果需要这两种设置,那么可能需要重命名冲突的符号。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40402328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档