2016-11-03 1 views
5

오푸스 프레임을 오디오 샘플로 디코딩하는 간단한 코드가 있습니다. Android에서 작동하지만 Unity3D iOS 프로젝트에서 충돌하며 일반 iOS 프로젝트에서 충돌하지 않습니다.iOS의 Opus 디코더가 충돌하는 이유가 없습니다.

EXC_BAD_ACCESS (code=1, address=0x2f) 

두 프로젝트 모두 동일한 opus 정적 라이브러리 및 헤더 파일을 공유합니다.

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

} 

xcode opus crash in celt

스택 추적 : 나는 빌드 설정을 비교하고 거의 동일하게

#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

답변

1

이 발생입니다. Unity 3D 라이브러리는 libopus에 의해 정의되고 사용되는 심볼을 정의합니다 (예 : compute_allocation()). Unity 3D 라이브러리가 링커 명령 행에서 libopus 앞에 있으면 libopus에서 작동하지 않는 해당 버전을 가져올 수 있습니다. 두 세트가 모두 필요한 경우 충돌하는 심볼의 이름을 변경해야 할 수 있습니다.

+0

여기에 반갑습니다! 다시 한번 감사드립니다. – Tema

+0

이에 대한 대체 솔루션이 있습니까 (예 : 특정 이름을 제외한 모든 것을 제거하도록 컴파일러를 구성하는 경우)? 이 솔루션은 언제든지 중단 될 수 있습니다. Unity는 새로운 내부 함수 이름을 도입합니다. – Martin

관련 문제