cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.28k stars 7.05k forks source link

cocos2d::experimental::AudioDecoder::read - iOS Crash #19016

Open ermanhaskan opened 6 years ago

ermanhaskan commented 6 years ago

Hi everyone,

This has been number one crash in our game for a long time. "10k CRASHES 9658 USERS" last 7 days. Occurs on all iOS versions. Do you guys have any ideas?

Crashed: Thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000143414141

0 AudioToolbox 0x185567e28 CompressedPacketTable::operator[](long long) const + 348 1 AudioToolbox 0x185680570 AudioFileObject::ReadPacketDataVBR_InTable(unsigned char, unsigned int, AudioStreamPacketDescription, long long, unsigned int, void) + 96 2 AudioToolbox 0x1857018ac AudioFileReadPacketData + 208 3 AudioToolbox 0x1854e5cdc ExtAudioFile::ReadInputProc(OpaqueAudioConverter, unsigned int, AudioBufferList*, AudioStreamPacketDescription, void) + 332 4 AudioToolbox 0x18558ba3c AudioConverterChain::DirectCallInputProc(unsigned int, unsigned int, AudioBufferList, AudioStreamPacketDescription const) + 452 5 AudioToolbox 0x1856659b8 CodecConverter::CallInputProc(unsigned int&) + 308 6 AudioToolbox 0x185663d84 CodecConverter::DecoderFillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription) + 868 7 AudioToolbox 0x185445dd0 AudioConverterChain::RenderOutput(CABufferList, unsigned int, unsigned int&, AudioStreamPacketDescription) + 120 8 AudioToolbox 0x185446170 BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription) + 804 9 AudioToolbox 0x1857657ec AudioConverterFillComplexBuffer + 964 10 AudioToolbox 0x1854e56d8 ExtAudioFile::Read(unsigned int, unsigned int&, AudioBufferList) + 500 11 AudioToolbox 0x1854a3c58 ExtAudioFileRead + 104 12 APPNAME 0x1010c6b78 cocos2d::experimental::AudioDecoder::read(unsigned int, char) + 4783936 13 APPNAME 0x1010c6bdc cocos2d::experimental::AudioDecoder::readFixedFrames(unsigned int, char) + 4784036 14 APPNAME 0x1011974ac cocos2d::experimental::AudioPlayer::rotateBufferThread(int) + 5638260 15 APPNAME 0x1011978b0 void std::1::thread_proxy<std::1::tuple<std::1::unique_ptr<std::1::thread_struct, std::__1::default_delete >, void (cocos2d::experimental::AudioPlayer::)(int), cocos2d::experimental::AudioPlayer, unsigned int> >(void*) + 5639288 16 libsystem_pthread.dylib 0x181531220 _pthread_body + 272 17 libsystem_pthread.dylib 0x181531110 _pthread_body + 290 18 libsystem_pthread.dylib 0x18152fb10 thread_start + 4

guilhemvors commented 6 years ago

Are you are using a non native audio format (basically anything beside linear pcm, which I guess because there is a call to AudioConverterFillComplexBuffer) with the new openAL software player (3.16 and above)?

If you are, this crash may be due to audio buffer data being freed before the conversion has finished.

You can check this bug for a more detailed answer: https://github.com/cocos2d/cocos2d-x/issues/18948

ermanhaskan commented 6 years ago

@guilhemvors I am not uncaching any audio files, only preloading them. Only wav and mp3 files are used. Can this be an issue about preload?