-
Notifications
You must be signed in to change notification settings - Fork 67
Threading
Currently the threading model is relatively minimal within the playback/decoder, with a couple levels of threads for the GUI and the IO and just one serialized queue for the playback logic and audio/video decoding.
Main thread (OGVPlayerView, OGVFrameView)
|
+-- Decode thread (OGVPlayerState internals, OGVDecoder)
|
+-- Network thread (OGVInputStream internals, NSURLConnection)
In some cases the decode thread will block on i/o in the network thread. This is unfortunate, but necessary for the moment to avoid rewriting synchronous logic flow in the demuxer libraries.
Unfortunately it is also a source of bugs, as hung NSURLConnection states can block the decode thread and keep the player state from updating until it eventually times out. YAY CONCURRENCY!
All iOS 8-compatible devices are dual-core, from the iPhone 4S and iPod touch on up to the latest 64-bit A8X whizbang iThing.
The serialized decode queue currently means we, for instance, decode audio and video in sequence.
It should be possible to safely run audio and video decodes concurrently, but would probably take some refactoring to do without feeling very sketchy. Also may not be worth it.
Running multiple cores on the video codecs might be more useful but might require specially-formatted files (eg VP9 WebM using multiple tiles or whatever they call it). Need to do research.