TheSwissKnife/xbmc — comment on commit 1b1c0bb122b2106111d09206f917b5a6625881c4
File: xbmc/cores/dvdplayer/DVDPlayerVideo.cpp line 285
By FernetMenta:

It is less important which thread would release vdpau but we must ensure that gl resources are clear down first. Output thread has allocated the textures and it has to clear them down. It can only do this when they are not in use by renderer. My current idea about this is as follows:

- player calls output thread Reset (sync message) to stop it. After this it is guaranteed that no more pics go into renderer
- player can call renderManager.WaitDrained if desired to play out remaining frames
- player calls renderManager.Flush. This does a glFinish then tells output thread to release textures
- player can dispose decoder