Gearboy icon indicating copy to clipboard operation
Gearboy copied to clipboard

Freeze after temporary interruptions

Open hngouveia01 opened this issue 5 years ago • 6 comments

Have you guys seen the GearBoy for iOS freezes every time the app is interrupted by an incoming phone call, SMS message or even the alarm? It only returns after killing the app and opening again. No state is saved during this freeze.

iOS version: 13.3 Model name: iPhone 6s The build is based on master, commit 770ab652dd09ae36cca62c558ccfa3420ad239d8

This is reproducible. I'll try to debug this one.

log.txt

hngouveia01 avatar Jan 09 '20 15:01 hngouveia01

Thanks for reporting, iOS 13 has introduced some new issues. I'll have a look asap.

drhelius avatar Jan 09 '20 15:01 drhelius

It is possible that this bug is caused by not handling correctly the audio interruption.

When the mute is on, the app doesn't freeze.

Emulator.mm gave this insight.

if (_audioEnabled && (sampleCount > 0)) { theSoundQueue->write(theSampleBufffer, sampleCount); }

I'll try to apply some fixes.

hngouveia01 avatar Jan 22 '20 19:01 hngouveia01

I didn't have success fixing this issue. I can't catch interruptions neither before nor after receiving it.

hngouveia01 avatar Feb 23 '20 15:02 hngouveia01

It seems that the problem is how Sound_Queue manages concurrence with semaphores.

If I comment out

SDL_SemValue and SDL_SemPost( free_sem );

in

void Sound_Queue::fill_buffer( Uint8* out, int count )

it won't freeze the app, but the sound obviously is very buggy.

hngouveia01 avatar Mar 24 '20 21:03 hngouveia01

Thanks for the hint.

I'm about to migrate the app to SwiftUI if I manage to get it working with Metal.

This will address iOS 13 and future releases I hope.

drhelius avatar Mar 24 '20 21:03 drhelius

Nice! I worked recently with a migration from OpenGL to Metal. We are using this project to transform OpenGL calls to Metal.

It is called MetalANGLE.

https://github.com/kakashidinho/metalangle

It is updated frequently and the "project owner" helped us a lot.

hngouveia01 avatar Mar 25 '20 12:03 hngouveia01