AVAudioRecorder with FLAC settings stopped working

I'm working on application that records audio. The user can choose between quality settings, and one of the settings results in FLAC recording.

Here are the settings:

[
AVFormatIDKey: kAudioFormatFLAC,
AVSampleRateKey: 48000,
AVEncoderAudioQualityKey: AVAudioQuality.max.rawValue,
AVEncoderBitRateKey: 192000,
AVLinearPCMBitDepthKey: 32,
AVLinearPCMIsBigEndianKey: false,
AVLinearPCMIsFloatKey: false
]

AVAudioRecorder's code is pretty simple:

...
let recorder = try AVAudioRecorder(url: outputUrl, settings: audioQuality.settings)
recorder.delegate = self
recorder.isMeteringEnabled = true
recorder.prepareToRecord()
recorder.record()
self.recorder = recorder
...

And these settings used to work, at least on iOS 15.1.

Now on iOS 15.4.1 (maybe earlier) the audio is corrupted.

There is no issue with AVAudioPlayer output. It starts recording, displays time, and stops recording. And the AVAudioRecorder's delegate function

func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool)

is called after

...
recorder.stop()
...

with successfully flag == true. Works good with other settings. And used to work with given settings earlier.

Any idea why it started to happen?

PS I've tried to change settings to what I've found on stackoverflow (flac) but with no success.