GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

video camera audioEncodingTarget iOS6 issue with multiple recordings

Open phil-m opened this issue 14 years ago • 2 comments

Hi,

I've got the same use case as mentioned in this fixed issue: https://github.com/BradLarson/GPUImage/issues/390

"I'm using the same GPUImageVideoCamera to record multiple videos, so when I stop recording the first video I set videoCamera.audioEncodingTarget to nil, but the problem is that later when I start my second recording I cannot set the audioEncodingTarget to my new movieWriter:"

Everything works fine in iOS 4 & 5 using the latest build, but on iOS6 I'm getting a frozen camera preview when attempting to set the audioEncodingTarget a second time. Seeing this on both an iPhone5 & iPod 4th gen.

If I skip setting the audioEncodingTarget, everything works fine, but obviously get no audio.

Has anyone else come across this issue? Is there anything special that needs to be done to re-use the video camera with new recordings that might have changed for iOS6?

Any help/ideas would be greatly appreciated.

Thanks Phil

phil-m avatar Sep 29 '12 03:09 phil-m

I have the same Problem. But not all the time. If I'm only recording, then stoping, then recording one more time - everything is fine. But if there is an incoming call, and I'm answering it, talking some time, and then returning to the app and then recording one more time, then I get that error, and after stopping the recording, the app crashes.

2energycell avatar Oct 03 '12 11:10 2energycell

Hey 2energycell, I haven't tested interruptions like that yet, thanks for the heads up, I'll certainly give those a try soon, I wonder if the issues are linked.

I was just starting to put a test project together to try & reproduce the issue with some bare bones code, & have found a possible fix/work-around for the freeze (& potentially crash if trying to record after the video freezes), although it re-introduces an old issue.

Due to the auto focus issue mentioned here: https://github.com/BradLarson/GPUImage/issues/74 I setup the movie writer at the start, & just start the recording when a button is later pressed. As soon as the recording is finished the current movie writer is cleaned up & a new one created straight away, ready to start the recording process again when needed. This is where the freeze is happening on iOS6 for me, when it attempts to set the audio target to the new movie writer object.

If I move the setting of the audio target to just before the call to startRecording, rather than when the movie writer is (re)setup, I don't get the freeze on iOS6, & can record with sound fine multiple times - happy days!

However doing that seems to re-introduce the auto focus bug, where it auto focuses as soon as you set the audio target (which is now when I start a recording). Unlike the issue link, I seem to be getting it for each recording, not just the first one.

Will carry on setting up a test project & looking into this further, although I'm hoping someone else may have some ideas or has come across it as well...

phil-m avatar Oct 04 '12 21:10 phil-m