@AVFoundation engineers, my users am seeing the following crash which I can not reproduce at my end.
*** -[__NSArrayI objectAtIndexedSubscript:]: index 2 beyond bounds [0 .. 1]
Fatal Exception: NSRangeException
0 CoreFoundation 0x99288 __exceptionPreprocess
1 libobjc.A.dylib 0x16744 objc_exception_throw
2 CoreFoundation 0x1a431c -[__NSCFString characterAtIndex:].cold.1
3 CoreFoundation 0x4c96c CFDateFormatterCreateStringWithAbsoluteTime
4 AVFCapture 0x6cad4 -[AVCaptureConnection getAvgAudioLevelForChannel:]
All I am doing is this:
func updateMeters() {
var channelCount = 0
var decibels:[Float] = []
let audioConnection = self.audioConnection
if let audioConnection = audioConnection {
for audioChannel in audioConnection.audioChannels {
decibels.append(audioChannel.averagePowerLevel)
channelCount = channelCount + 1
}
}
What am I doing wrong?