I'm currently programming an app that extracts frames from a movie clip. I designed it so that the extraction will be done on a separate thread to prevent the application from freezing. The extraction process itself is taking a lot of resources, but works fine when used in the simulator. However, there are problems when building it for the iPad. When I perform another action (I'm telling my AV player to play while I extract frames), the thread unexpectedly stops working, and I believe it's being killed.
I assume it's becauase I'm using a lot of resources, but not entirely sure.
Here are my questions: 1. How can I tell if/why my thread stopping? 2. If it's really from over processing what should I do? I really need this action to be implemented.
Heres some code im using: To create the thread:
[NSThread detachNewThreadSelector:@selector(startReading) toTarget:self withObject:nil];
I'll post any information you need, Thanks so much!
Update I'm using GCD now and it populates the threads for me. However the OS still kills the threads.
I know exactly when is it happening. when i tell my [AVplayer play]; it kills the thread.
This issue is only happening in the actual iPad and not on the simulator
It sounds to me like you are trying to decode two video clips at the same time. Due to the hardware based decoding nature of the iPad, it can only support one decode process at a time. When you play a new item the old will be cancelled. This would explain why it works in the simulator, but not on the device.
As for a solution, you can switch to a pure software decoder like libav (GPL) or the CoreAVC SDK (commercial). That way you won't interfere with the HW decoder for playback.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With