I writing my iOS app to record audio.
I called session.setPreferredIOBufferDuration(0.001) to set the duration, and recorded the intervals between two callbacks.
This is data of my iPhone 8:
max = 198 avg = 2.75314 min = 0
======================================================
4 2 2 3 5 3 1 3 6 1
2 2 6 0 5 3 1 3 3 5
1 3 3 2 3 5 1 3 3 3
3 4 1 4 3 2 4 2 3 3
3 3 3 3 2 3 3 3 5 1
3 2 3 3 3 3 3 5 1 3
3 3 3 3 3 3 4 1 3 3
3 3 3 2 3 4 2 3 3 3
3 4 5 0 2 3 3 3 3 3
3 3 3 3 2 3 4 2 3 3
3 3 3 3 3 3 4 2 2 4
3 2 4 2 3 2 4 3 4 2
2 3 3 3 3 2 4 3 5 1
2 4 2 3 2 3 4 3 3 2
4 5 1 2 3 4 2 4 1 3
3 3 3 5 2 2 2 4 2 3
3 3 3 6 0 3 3 3 2 3
3 3 4 2 3 3 2 3 3 3
3 3 3 3 5 1 2 3 3 3
3 3 4 4 1 2 3 3 4 2
3 3 3 3 3 2 3 6 0 3
3 3 4 2 3 3 3 2 5 1
And this is data of my iPhone 7:
max = 246 avg = 2.59249 min = 0
======================================================
3 2 3 2 3 3 5 2 2 3
3 3 3 4 2 2 3 3 3 3
221 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 2 0 0 0
0 0 0 0 0 0 0 1 7 1
1 3 2 3 3 3 3 2 4 4
1 3 4 2 3 3 5 4 0 2
3 5 2 3 2 3 3 4 2 3
2 6 0 4 2 3 3 3 4 3
1 3 3 3 5 3 1 3 3 2
as you see, the max interval is far away from 1ms I set to AudioSession
.
and huge numbers form iPhone 7 is appeared much often.
Why iOS don't call my callback smoothly? Can I do any thing, such as set some preference, to get more smooth data?
Thank you.