Different block size in prepareToPlay and getNextAudioBlock

Hey,
I’m building an audio app in iOS 9.3 using AudioProcessorGraph.
I set up the graph in in prepareToPlay(). However the block size given in prepareToplay is different to that given in getNextAudioBlock, screwing everything up. I tried using AudioProcessorPlayer to play the graph directly, but it also fails to deal with the block size change.
I have to manually check to see the block size has changed like so:

if(channelInfo.numSamples != processorGraph.getBlockSize()){
processorGraph.setPlayConfigDetails(0, 2, getSampleRate(), channelInfo.numSamples);
processorGraph.prepareToPlay(getSampleRate(), channelInfo.numSamples);
}

This makes it work…but it seems ugly. Shouldn’t AudioProcessorPlayer deal with buffer size changes automatically?

You need to be able to handle different sizes, the value sent to prepareToPlay() is only a strong hint. On iOS the OS will use different sizes sometimes. For example, if your app play background audio and the device screen is locked then it may default to a larger buffer size since latency (and screen interaction) is likely to be less critical.