Hi all, I am getting bunch of these errors below in Google Play Console.Please, anyone here can give me some insights to fix?
pid: 0, tid: 0 >>> com.company.mygame <<<
backtrace:
#00 pc 00000000003f3fce /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d12experimental15PcmAudioService6resumeEv+5)
#01 pc 00000000003e18d3 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d12experimental15AudioEngineImpl17onEnterForegroundEPNS_11EventCustomE+10)
#02 pc 000000000050c384 /data/app/com.company.mygame-1/lib/arm/libMyGame.so
#03 pc 0000000000507bc4 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d15EventDispatcher24dispatchEventToListenersEPNS0_19EventListenerVectorERKSt8functionIFbPNS_13EventListenerEEE+412)
#04 pc 00000000005082c8 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d15EventDispatcher13dispatchEventEPNS_5EventE+336)
#05 pc 00000000003aad3b /data/app/com.company.mygame-1/lib/arm/libMyGame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume+82)
#06 pc 000000000072fd6d /data/app/com.company.mygame-1/oat/arm/base.odex
Thank you! But, I don’t think they’re the same issue.
What file format are you using?
Do you have any idea how this is happening?
@slackmoehrle by looking at the stack trace it seems to come from onEnterForeground
and crash on PcmAudioService::resume()
#00 pc 00000000003f3fce /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d12experimental15PcmAudioService6resumeEv+5)
#01 pc 00000000003e18d3 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d12experimental15AudioEngineImpl17onEnterForegroundEPNS_11EventCustomE+10)
0 PcmAudioService::resume()
1 AudioEngineImpl::onEnterForeground(EventCustom* event)
@tink3r_t I am usingf mp3 format. You think that format can cause an issue?
Thanks!
Sorry, what I mean but didn’t write was do you have anything custom there or just stock engine code?
@slackmoehrle NP! No changes just the stock 3.17 engine code.
@slackmoehrle
Any ideas how we can fix this? It’s pushing our game crash rate over Google Console threshold. Which it’s very bad now due to the new alg changed.
Thanks!
Any ideas guys @slackmoehrle @drelaptop ?? I understand you guys are super busy with deprecation of opengl but helping with the latest 3.17 release issues will help us all.
Thanks!
sorry for a long response. is it possible to add a case to reproduce this issue? @vkreal2
NP @drelaptop !
Sorry, we can’t find a repro… just the logs in Play console below. Any help be greatly appreciated!
pid: 0, tid: 0 >>> com.company.mygame <<<
backtrace:
#00 pc 00000000003f3fce /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d12experimental15PcmAudioService6resumeEv+5)
#01 pc 00000000003e18d3 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d12experimental15AudioEngineImpl17onEnterForegroundEPNS_11EventCustomE+10)
#02 pc 000000000050c384 /data/app/com.company.mygame-1/lib/arm/libMyGame.so
#03 pc 0000000000507bc4 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d15EventDispatcher24dispatchEventToListenersEPNS0_19EventListenerVectorERKSt8functionIFbPNS_13EventListenerEEE+412)
#04 pc 00000000005082c8 /data/app/com.company.mygame-1/lib/arm/libMyGame.so (_ZN7cocos2d15EventDispatcher13dispatchEventEPNS_5EventE+336)
#05 pc 00000000003aad3b /data/app/com.company.mygame-1/lib/arm/libMyGame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume+82)
#06 pc 000000000072fd6d /data/app/com.company.mygame-1/oat/arm/base.odex
vkreal2:
PcmAudioService6resume
Please check this PR. It fixes above issue.
@umairjaved6 Thank you!!!
@drelaptop @umairjaved6
Looked at the PR. Sorry, I might be missing something but how is _playItf
not being initialized when calling pause
or resume
? Please help me understand this fix for my education.
check PcmAudioService::init.
r = (*_engineItf)->CreateAudioPlayer(_engineItf, &_playObj, &source, &sink,
sizeof(ids) / sizeof(ids[0]), ids, req);
SL_RETURN_VAL_IF_FAILED(r, false, "CreateAudioPlayer failed");
r = (*_playObj)->Realize(_playObj, SL_BOOLEAN_FALSE);
SL_RETURN_VAL_IF_FAILED(r, false, "Realize failed");
r = (*_playObj)->GetInterface(_playObj, SL_IID_PLAY, &_playItf);
SL_RETURN_VAL_IF_FAILED(r, false, "GetInterface SL_IID_PLAY failed");
If any of these three fails, _playItf will not get initialised. Currently, I dont know under what conditions these checks fail.
Out of the init()
method, at AudioPlayerProvider::AudioPlayerProvider()
.
new PcmAudioService()
success, but if the init()
method failed. might lead to _pcmAudioService !=null
and _playItf = null
.
_pcmAudioService = new (std::nothrow) PcmAudioService(engineItf, outputMixObject);
_pcmAudioService->init(_mixController, 2, deviceSampleRate, bufferSizeInFrames * 2);
next see the AudioPlayerProvider::pause()
and resume()
if (_pcmAudioService != nullptr)
{
_pcmAudioService->resume();
}
it called,
SLresult r = (*_playItf)->SetPlayState(_playItf, SL_PLAYSTATE_PLAYING);
SL_RETURN_IF_FAILED(r, "PcmAudioService::resume failed");
crash occurs when _playItf = null
Your patch make the audio more stable, crash will not occurs even if init failed. that’s wonderful. I try to reproduce this issue, but I failed. even no better method, I select to to simulate init failed, crash will occur when calling pause()
. with your patch, even init failed, crash won’t occur, sure, the audio can’t work, all in silence, but other feature works.
@drelaptop I can live with audio failing compare to a crash Thanks for the explanation!