GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

iOS 6, finishWriting should not be called on the main thread, completionBlock called twice

Open taberrr opened this issue 14 years ago • 8 comments

Hi, I noticed a couple of small issues while using SimpleVideoFileFilter on iOS 6:

2012-09-26 13:46:28.399 SimpleVideoFileFilter[7836:11f03] WARNING: -finishWriting should not be called on the main thread. 2012-09-26 13:46:28.483 SimpleVideoFileFilter[7836:13803] finished!!!!!! 2012-09-26 13:46:28.484 SimpleVideoFileFilter[7836:13803] finished!!!!!!

The warning probably doesn't matter, just figured I'd bring it to your attention. Also, the block set with setCompletionBlock seems to be called twice. (eg: NSLog("finished!!!!!!")) Right now I'm checking a "count" integer to only act on the first call, but this seems dirty. Is there a better way to check (once) that writing has indeed completely finished?

Thanks!

taberrr avatar Sep 26 '12 17:09 taberrr

same here, is there any more info on this? anyone?

dasantonym avatar Sep 28 '12 17:09 dasantonym

I have solved the "-finishWriting should not be called on the main thread" warning with this solution:

dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(queue, ^{ [self.movieWriter finishRecording]; self.movieWriter = nil; });

Just invoking the "finishRecording" not on the main thread. I do not know if it is the good solution, but it works for me.

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

Does that fix work in the simulator? I'm calling finishRecording on a background thread, but doesn't work in the 6.0 simulator

jessbowers avatar Oct 18 '12 15:10 jessbowers

@2energycell I tried that, but that didn't fix it for me (on iOS6)

rizzow avatar Oct 23 '12 07:10 rizzow

I have same warning.

Does anyone has problem that after recording, the sound of just recorded video starts to reproduce for about 2-3 seconds?

balabs avatar Oct 24 '12 15:10 balabs

running into similar issues. trying to find out how to access if the recording is finished. the property "encodingLiveVideo" seems to stay true whether recording or not. my use case is that i want the recording to stop either on user hitting the stop button or after X seconds.

randyarrowood avatar Nov 02 '12 14:11 randyarrowood

I just tried on GPUImageMovieWriter (latest version) with this and works ok so far:

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
        {
            [assetWriter finishWriting];
        });

I went for this, because it freezes the app for a second when flushing the file.

hernangonzalez avatar Dec 07 '12 18:12 hernangonzalez

I have the same problem as well, do we have a solution to the issue yet? Currently running IOS 6 and it is part of the video processing.

OlyRice avatar Dec 20 '12 14:12 OlyRice