syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

Recorder failed to get total frames. (-50) crash on recording audio #229

Open rbarbish opened 9 years ago

rbarbish commented 9 years ago

I receive a crash when attempting to record audio on my iPhone 6 w/ iOS9. Strangely enough, the crash does not occur via the iOS9 iPhone6 simulator. The crash occurs after I stop fetching audio from the microphone and close the audio file. Anyone else receiving this crash?

Thanks

Vortec4800 commented 8 years ago

I'm running into this too and it's a major roadblock. Happening on iOS 9 iPad Air 2. Haven't been able to track down the cause yet.

Vortec4800 commented 8 years ago

I was able to fix my problem by releasing (setting to nil in my case) my recorder instance immediately after closing the file. It seems like something was trying to calculate the current recorder time after the file closed which caused the crash. Maybe that would help you?

rbarbish commented 8 years ago

Thanks @Vortec4800 , I'll try that and post the results. @syedhali are you in the process of looking into EZAudio's iOS9 compatibility? I haven't seen a release in a while and I'd just like to know that support is still being generated for this framework on the latest iOS versions and devices.

Thanks - Ross

Vortec4800 commented 8 years ago

More or less, I was going through and updating all the Pods in my project and EZAudio was one of them. So far I haven't found any incompatibility issues, but I really only use the recorder and plot view so there may be issues elsewhere that I haven't seen.

syedhali commented 8 years ago

Hm interesting, sorry to hear it's crashing. I just updated all my devices to iOS 9 today so I'll test out the examples tonight and see if I can reproduce.

tmspzz commented 8 years ago

Hi, this happens for me as well.

Steveybrown commented 8 years ago

having the same problem but it seems to be an edge case. Using microphone and recorder.

Charlisim commented 8 years ago

I had the same problem because I was stop fetching audio and stop the recording before the recorder had updated last current time, so I set a flag, recordingShouldStopRecording and in recorderUpdatedCurrentTime check and rally stopFeching audio and recording

  func recorderUpdatedCurrentTime(recorder:EZRecorder){
    NSOperationQueue.mainQueue().addOperationWithBlock { () -> Void in

        self.recordButton.progressStatus = CGFloat(recorder.duration / 30.0)
        if self.shouldStopRecording{
            self.microphone.stopFetchingAudio()

            self.recorder.closeAudioFile()
            self.shouldStopRecording = false
            self.recordButton.progressStatus = 1.0

        }

    }
   }
amitshelgaonkar commented 8 years ago

having the same problem on ios 8 also with version 1.1.5

Mindbowser commented 8 years ago

Any update here? We are also waiting to get this fixed asap, as it is affecting lot of users.

Charlisim commented 8 years ago

Where are you stopping fetching audio and close the audio file? Since I moved the code that stops audio to EZMicrophoneDelegate there are no crashes func microphone(microphone: EZMicrophone!, hasBufferList bufferList: UnsafeMutablePointer<AudioBufferList>, withBufferSize bufferSize: UInt32, withNumberOfChannels numberOfChannels: UInt32)

After appending data from buffer to the recorder I stop the recording and close the file.

Also you need to know that there is a method(not well documented) to choose if there is an error in the recording the app should crash or not.

EZAudioUtilities.setShouldExitOnCheckResultFail(false), by default is set to true

imphila commented 8 years ago

i meet the same problem.You can try this in the function recorderUpdatedCurrentTime(recorder: EZRecorder!)

func recorderUpdatedCurrentTime(recorder: EZRecorder!) { var formarredCurrentTime:String? formarredCurrentTime = recorder.formattedCurrentTime dispatch_async(dispatch_get_main_queue()) { self.timeLabel.text = formarredCurrentTime

    }

}

i don't meet the problem anymore but i don't know why it can solve the problem. I think maybe it is associated with thread. if anynoe knows please tell me.