Posts: 6,810
Joined: Jul 2010
Reputation:
198
The next step to a better video player is to separate rendering from the main thread. This is necessary and has many advantages:
- Smooth playback even if the main thread is hijacked by addons or work intensive tasks
- Prevent from lots of deadlocks
- Further step to componentise VideoPlayer and make it independent from application
- Finally have a proper headless Kodi
- ....
Posts: 252
Joined: May 2009
Reputation:
10
Paxxi
Team-Kodi Member
Posts: 252
+100.
Can you share some rough design so we have an idea of what your vision is?
I've been thinking rendering runs one thread and something like inputmanager runs the UI-thread/input/messaging. Is this along the lines you're thinking or am I totally wrong?
The janitor, cleaner of cruft, defender of style. Also known as the unfunny guy that doesn't understand signatures.
Posts: 9,007
Joined: Feb 2011
Reputation:
431
+1
Currently on Pi2 the first subtitle that appears causes a noticeable video stutter as font rendering is done on the main thread.
There are other cases such as loading the OSD dialog for the first time causes video to stutter.
Just to be clear, which thread will be attached to the GL context? Still application, or will this be moved to a dedicated thread?
Posts: 252
Joined: May 2009
Reputation:
10
Paxxi
Team-Kodi Member
Posts: 252
We can have several message pumps and have everything go through appmessenger. We just have to queue messages into different queues or flag messages so they're only visible the correct message pump.
We already have some of this today with the handling of GUIMessage.
The janitor, cleaner of cruft, defender of style. Also known as the unfunny guy that doesn't understand signatures.
Posts: 252
Joined: May 2009
Reputation:
10
Paxxi
Team-Kodi Member
Posts: 252
I haven't had time to think this through fully but basically we use the same interface as we have now for sending using sendmsg/postmsg.
Not sure if we should limit ourselves internally to a certain amount of queues to keep it simple or basically have a vector of queues so we can extend it if need arises.
Easiest filtering is to continue on the current path where we filter by receiver such as MESSAGE_MASK_WINDOWMANAGER.
Retrieving messages need to be rewritten a bit so the thread calls ProcessMessages(MESSAGE_MASK_WINDOWMANAGER) to process that specific queue.
That's the rough idea I have, I bet I'm missing some details that will need to be fixed for it to work.
The janitor, cleaner of cruft, defender of style. Also known as the unfunny guy that doesn't understand signatures.
Posts: 6,566
Joined: Apr 2008
Reputation:
160
natethomas
Enjoying Retirement by Staying Busy
Posts: 6,566
Sorry to ask this so late, but I'd been kind of wrapped up in devcon planning, so I missed this. It seems as though the biggest (or at least a big) potential benefit of going down this road is always on video for PVR users, making for an appliance-like setup more consistent with more traditional DVRs. Is that a reasonable expectation for this work?
Posts: 6,810
Joined: Jul 2010
Reputation:
198
I consider it as a key step to get Kodi to the next level. Long desired headless becomes true. VideoPlayer infrastructure can be used for transcoding. Kodi's architechtue is more than 15 years behind. Combining main thread and gui rendering is old school mfc style of the 90s. I posted this in VideoPlayer section but this is more important then video player. Without this step Kodi will die.
Posts: 6,255
Joined: Jun 2009
Reputation:
115
da-anda
Team-Kodi Member
Posts: 6,255
thanks for working on this Rainer. How far did you plan to go with this? I suppose a full decoupling of GUI and core would be a too big task in one go? With decoupling I mean that core only uses some sort of messaging/signal/event system to communicate with a self-contained GUI component.