BradLarson / GPUImage2

GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.
BSD 3-Clause "New" or "Revised" License
4.87k stars 609 forks source link

iphone 5s 10.1.1, always crash when play movie by using GPUImageMovie #248

Closed suixinsam closed 6 years ago

suixinsam commented 6 years ago

In my case, I play movie when app on foreground, when app switch to background mode, I need to stop playing. So when the movie is going to be played, switch to background mode immediately, then it crashed.

I played movie by url.

I debug the code, found it crashed in the function startProcessing :

[inputAsset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:@"tracks"] completionHandler: ^{
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            NSError *error = nil;
            AVKeyValueStatus tracksStatus = [inputAsset statusOfValueForKey:@"tracks" error:&error];
            if (tracksStatus != AVKeyValueStatusLoaded)
            {
                return;
            }
            blockSelf.asset = inputAsset;
            [blockSelf processAsset];
            blockSelf = nil;
        });
    }];

I figured out that the loadValuesAsynchronouslyForKeys too slow cause this kind of crash. In my case, I already called the endProcessing to stop playing, but the loading for asset is too slow on iPhone 5s 10.1.1, the completionHandler of loading is delayed.

Hope this clue will help to solve the same issue on iphone 5/5s/5c of its 10.1.1+ os version

this issue occurred on Object-c version, will transfer to right place, just close it on this branch