Added some logic to cope with buffer size changes in iOS audio.