We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4155 - On iOS, audio skips when suspending and resuming
Summary: On iOS, audio skips when suspending and resuming
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.8
Hardware: iPhone/iPod touch iOS 11
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-04 17:48 UTC by philhassey
Modified: 2019-03-25 17:00 UTC (History)
1 user (show)

See Also:


Attachments
audio thread priority patch (544 bytes, patch)
2018-05-04 17:48 UTC, philhassey
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description philhassey 2018-05-04 17:48:12 UTC
Created attachment 3236 [details]
audio thread priority patch

I've noticed that the audio skips really badly during suspending and resuming on iOS.  Sometimes it skips other times as well.

This issue is new to versions of SDL2 that use core audio.

I'm using these settings:

want.freq = 44100;
want.format = AUDIO_F32SYS;
want.channels = 2;
want.samples = 1024;

I've attached a patch that sets the audio thread priority to HIGH which largely resolves the issue.
Comment 1 Sam Lantinga 2018-05-05 17:37:05 UTC
The iOS audio code has been changed, can you check the latest version and see if the issue still happens, and if so, can you provide an updated patch?
http://www.libsdl.org/tmp/SDL-2.0.zip

Thanks!
Comment 2 philhassey 2018-05-05 18:30:35 UTC
The coreaudio code contained in SDL-2.0.8-11956 appears to resolve the issue.  Thanks!
Comment 3 Sam Lantinga 2018-05-06 02:11:32 UTC
You're welcome!
Comment 4 Ryan C. Gordon 2019-03-25 17:00:33 UTC
Just backed out the code that solved this previously, so this commit should _also_ fix this for 2.0.10, if you find yourself in a position to verify the latest in revision control: https://hg.libsdl.org/SDL/rev/a7b99312d9f3

--ryan.